diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-05-23 13:15:45 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-05-23 13:15:45 +0200 |
commit | 0ef52f01029176a8fb8fbef2c22ae9350635ebe1 (patch) | |
tree | fad805097d0e40ba57dcfb61ac3067737c7a2ae3 /src/imports/multimedia/qdeclarativevideooutput.cpp | |
parent | cb324a50c920b275ef6c04162712b1a6f19bbe8d (diff) | |
parent | 5c087bb6153b951e1c5709ee7f998819d08a6122 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I24ffb71c4cc2e262394797deb8a22b2cf9a80c3c
Diffstat (limited to 'src/imports/multimedia/qdeclarativevideooutput.cpp')
-rw-r--r-- | src/imports/multimedia/qdeclarativevideooutput.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/imports/multimedia/qdeclarativevideooutput.cpp b/src/imports/multimedia/qdeclarativevideooutput.cpp index fc17a20fa..53c810403 100644 --- a/src/imports/multimedia/qdeclarativevideooutput.cpp +++ b/src/imports/multimedia/qdeclarativevideooutput.cpp @@ -484,13 +484,18 @@ QRectF QDeclarativeVideoOutput::contentRect() const This property holds the area of the source video content that is considered for rendering. The - values are in source pixel coordinates. + values are in source pixel coordinates, adjusted for + the source's pixel aspect ratio. Note that typically the top left corner of this rectangle will be \c {0,0} while the width and height will be the - width and height of the input content. + width and height of the input content. Only when the video + source has a viewport set, these values will differ. The orientation setting does not affect this rectangle. + + \sa QVideoSurfaceFormat::pixelAspectRatio() + \sa QVideoSurfaceFormat::viewport() */ QRectF QDeclarativeVideoOutput::sourceRect() const { @@ -499,7 +504,19 @@ QRectF QDeclarativeVideoOutput::sourceRect() const if (!qIsDefaultAspect(m_orientation)) { size.transpose(); } - return QRectF(QPointF(), size); // XXX ignores viewport + + // No backend? Just assume no viewport. + if (!m_nativeSize.isValid() || !m_backend) { + return QRectF(QPointF(), size); + } + + // Take the viewport into account for the top left position. + // m_nativeSize is already adjusted to the viewport, as it originats + // from QVideoSurfaceFormat::sizeHint(), which includes pixel aspect + // ratio and viewport. + const QRectF viewport = m_backend->adjustedViewport(); + Q_ASSERT(viewport.size() == size); + return QRectF(viewport.topLeft(), size); } /*! |