diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-03-26 02:48:13 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2010-03-26 02:48:13 (GMT) |
commit | d19ad17aed345433ab34cf165ccd7c7ddf917c19 (patch) | |
tree | 72caa7d4b462b18510ffa7723825c3f5f3ff5fe6 /src/plugins/mediaservices/gstreamer | |
parent | 194013d9db1b3e4ba6f56a864f3b64f523202948 (diff) | |
download | Qt-d19ad17aed345433ab34cf165ccd7c7ddf917c19.zip Qt-d19ad17aed345433ab34cf165ccd7c7ddf917c19.tar.gz Qt-d19ad17aed345433ab34cf165ccd7c7ddf917c19.tar.bz2 |
Support the Expanding aspect ratio mode in the gstreamer window control.
Reviewed-by: Dmytro Poplavskiy
Task-number: QTBUG-9118
Diffstat (limited to 'src/plugins/mediaservices/gstreamer')
3 files changed, 30 insertions, 2 deletions
diff --git a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp index 427d514..f381f7f 100644 --- a/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp +++ b/src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp @@ -192,21 +192,36 @@ void QGstreamerVideoOverlay::surfaceFormatChanged() void QGstreamerVideoOverlay::setScaledDisplayRect() { + QRect formatViewport = m_surface->surfaceFormat().viewport(); + switch (m_aspectRatioMode) { case Qt::KeepAspectRatio: { - QSize size = m_surface->surfaceFormat().viewport().size(); - + QSize size = m_surface->surfaceFormat().sizeHint(); size.scale(m_displayRect.size(), Qt::KeepAspectRatio); QRect rect(QPoint(0, 0), size); rect.moveCenter(m_displayRect.center()); m_surface->setDisplayRect(rect); + m_surface->setViewport(formatViewport); } break; case Qt::IgnoreAspectRatio: m_surface->setDisplayRect(m_displayRect); + m_surface->setViewport(formatViewport); + break; + case Qt::KeepAspectRatioByExpanding: + { + QSize size = m_displayRect.size(); + size.scale(m_surface->surfaceFormat().sizeHint(), Qt::KeepAspectRatio); + + QRect viewport(QPoint(0, 0), size); + viewport.moveCenter(formatViewport.center()); + + m_surface->setDisplayRect(m_displayRect); + m_surface->setViewport(viewport); + } break; }; } diff --git a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp index cbd5a76..70b8527 100644 --- a/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp +++ b/src/plugins/mediaservices/gstreamer/qx11videosurface.cpp @@ -213,6 +213,16 @@ void QX11VideoSurface::setDisplayRect(const QRect &rect) m_displayRect = rect; } +QRect QX11VideoSurface::viewport() const +{ + return m_viewport; +} + +void QX11VideoSurface::setViewport(const QRect &rect) +{ + m_viewport = rect; +} + int QX11VideoSurface::brightness() const { return getAttribute("XV_BRIGHTNESS", m_brightnessRange.first, m_brightnessRange.second); diff --git a/src/plugins/mediaservices/gstreamer/qx11videosurface.h b/src/plugins/mediaservices/gstreamer/qx11videosurface.h index 1be963e..10f79a6 100644 --- a/src/plugins/mediaservices/gstreamer/qx11videosurface.h +++ b/src/plugins/mediaservices/gstreamer/qx11videosurface.h @@ -67,6 +67,9 @@ public: QRect displayRect() const; void setDisplayRect(const QRect &rect); + QRect viewport() const; + void setViewport(const QRect &rect); + int brightness() const; void setBrightness(int brightness); |