From fcf5d826a0e2d3ea6a01bf4c962e0d4fe096d321 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 11 Feb 2015 12:40:10 +0100 Subject: GStreamer: improved logic for window and widget controls usage. Provide these controls only when the xvimagesink gstreamer element is available. This allows QVideoWidget to fallback to QVideoRendererControl when xvimagesink is not available. Task-number: QTBUG-41618 Change-Id: I59f90ea8857c7ec0ffa08be9804e5458d95b79c4 Reviewed-by: Christian Stromme --- src/plugins/gstreamer/camerabin/camerabinservice.cpp | 14 ++++++++++++++ src/plugins/gstreamer/camerabin/camerabinservice.h | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/plugins/gstreamer/camerabin') diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp index 969955f8a..e4aa594d5 100644 --- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp @@ -121,9 +121,23 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa #else m_videoWindow = new QGstreamerVideoWindow(this); #endif + // If the GStreamer sink element is not available (xvimagesink), don't provide + // the video window control since it won't work anyway. + if (!m_videoWindow->videoSink()) { + delete m_videoWindow; + m_videoWindow = 0; + } #if defined(HAVE_WIDGETS) m_videoWidgetControl = new QGstreamerVideoWidgetControl(this); + + // If the GStreamer sink element is not available (xvimagesink or ximagesink), don't provide + // the video widget control since it won't work anyway. + // QVideoWidget will fall back to QVideoRendererControl in that case. + if (!m_videoWidgetControl->videoSink()) { + delete m_videoWidgetControl; + m_videoWidgetControl = 0; + } #endif m_audioInputSelector = new QGstreamerAudioInputSelector(this); diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.h b/src/plugins/gstreamer/camerabin/camerabinservice.h index cadae6e88..a38e36034 100644 --- a/src/plugins/gstreamer/camerabin/camerabinservice.h +++ b/src/plugins/gstreamer/camerabin/camerabinservice.h @@ -48,6 +48,7 @@ class CameraBinControl; class QGstreamerMessage; class QGstreamerBusHelper; class QGstreamerVideoRenderer; +class QGstreamerVideoWindow; class QGstreamerVideoWidgetControl; class QGstreamerElementFactory; class CameraBinMetaData; @@ -79,7 +80,7 @@ private: QMediaControl *m_videoOutput; QMediaControl *m_videoRenderer; - QMediaControl *m_videoWindow; + QGstreamerVideoWindow *m_videoWindow; #if defined(HAVE_WIDGETS) QGstreamerVideoWidgetControl *m_videoWidgetControl; #endif -- cgit v1.2.3