summaryrefslogtreecommitdiffstats
path: root/src/plugins/mediaservices/gstreamer
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/mediaservices/gstreamer')
-rw-r--r--src/plugins/mediaservices/gstreamer/qgstreamervideooverlay.cpp19
-rw-r--r--src/plugins/mediaservices/gstreamer/qx11videosurface.cpp10
-rw-r--r--src/plugins/mediaservices/gstreamer/qx11videosurface.h3
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);