summaryrefslogtreecommitdiffstats
path: root/src/gsttools/qgstreamervideowidget.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:38:46 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-02-24 17:38:46 +0100
commit39bb642cb297dcd95273ba0dba417beec03e686c (patch)
treeae8a58b76224e1ba6a83c00cfdbbb095756213ad /src/gsttools/qgstreamervideowidget.cpp
parentf86a3b7bb3a601da9705ef178fda9658cdbfebb0 (diff)
parentfcf5d826a0e2d3ea6a01bf4c962e0d4fe096d321 (diff)
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts: qtmultimedia.pro src/gsttools/qgstreamervideowidget.cpp src/plugins/gstreamer/camerabin/camerabinservice.cpp Change-Id: I883f20dc17924ab42514a1aa00d16675a0f13d99
Diffstat (limited to 'src/gsttools/qgstreamervideowidget.cpp')
-rw-r--r--src/gsttools/qgstreamervideowidget.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/gsttools/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp
index 1c1d9245..5261ccb8 100644
--- a/src/gsttools/qgstreamervideowidget.cpp
+++ b/src/gsttools/qgstreamervideowidget.cpp
@@ -98,6 +98,22 @@ QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent)
, m_widget(0)
, m_fullScreen(false)
{
+ m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
+
+ if (!m_videoSink)
+ m_videoSink = gst_element_factory_make ("ximagesink", NULL);
+
+ if (m_videoSink) {
+ // Check if the xv sink is usable
+ if (gst_element_set_state(m_videoSink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) {
+ gst_object_unref(GST_OBJECT(m_videoSink));
+ m_videoSink = 0;
+ } else {
+ gst_element_set_state(m_videoSink, GST_STATE_NULL);
+ g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
+ qt_gst_object_ref_sink(GST_OBJECT (m_videoSink)); //Take ownership
+ }
+ }
}
QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
@@ -110,36 +126,17 @@ QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
void QGstreamerVideoWidgetControl::createVideoWidget()
{
- if (m_widget)
+ if (!m_videoSink || m_widget)
return;
m_widget = new QGstreamerVideoWidget;
m_widget->installEventFilter(this);
m_windowId = m_widget->winId();
-
- m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
- if (m_videoSink) {
- // Check if the xv sink is usable
- if (gst_element_set_state(m_videoSink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) {
- gst_object_unref(GST_OBJECT(m_videoSink));
- m_videoSink = 0;
- } else {
- gst_element_set_state(m_videoSink, GST_STATE_NULL);
-
- g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
- }
- }
-
- if (!m_videoSink)
- m_videoSink = gst_element_factory_make ("ximagesink", NULL);
-
- qt_gst_object_ref_sink(GST_OBJECT (m_videoSink)); //Take ownership
}
GstElement *QGstreamerVideoWidgetControl::videoSink()
{
- createVideoWidget();
return m_videoSink;
}