summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2015-05-19 15:50:10 +0200
committerYoann Lopes <yoann.lopes@theqtcompany.com>2015-05-26 11:57:40 +0000
commita3f82a8995543288dd004349bbe94beece170d6a (patch)
tree5cf924d09a796420d6e710f6be74d138426f6330
parent10b3466ce43dc650d1abc46ffe2cbe81905547bb (diff)
GStreamer: don't use xvimagesink when Qt is not using Xcb.
We need a native X window handle to be able to use xvimagesink. If Qt doesn't use the Xcb platform plugin, don't try to use that element. This patch makes QVideoWidget usable when the system doesn't run X11 but xvimagesink is installed anyway. Widget and window controls become invalid and the plugin therefore falls back to the renderer control. Change-Id: I6efd410508f35b06f00f6e4e5149c97cbd280d0d Task-number: QTBUG-46169 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
-rw-r--r--src/gsttools/qgstreamervideowidget.cpp5
-rw-r--r--src/gsttools/qgstreamervideowindow.cpp5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/gsttools/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp
index 9a29d327f..6e65b3065 100644
--- a/src/gsttools/qgstreamervideowidget.cpp
+++ b/src/gsttools/qgstreamervideowidget.cpp
@@ -98,7 +98,10 @@ QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent)
, m_widget(0)
, m_fullScreen(false)
{
- m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
+ // The QWidget needs to have a native X window handle to be able to use xvimagesink.
+ // Bail out if Qt is not using xcb (the control will then be ignored by the plugin)
+ if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0)
+ m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
if (m_videoSink) {
// Check if the xv sink is usable
diff --git a/src/gsttools/qgstreamervideowindow.cpp b/src/gsttools/qgstreamervideowindow.cpp
index 7dd6ab253..a0697003a 100644
--- a/src/gsttools/qgstreamervideowindow.cpp
+++ b/src/gsttools/qgstreamervideowindow.cpp
@@ -35,6 +35,7 @@
#include <private/qgstutils_p.h>
#include <QtCore/qdebug.h>
+#include <QtGui/qguiapplication.h>
#include <gst/gst.h>
@@ -57,7 +58,9 @@ QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const char *elemen
{
if (elementName) {
m_videoSink = gst_element_factory_make(elementName, NULL);
- } else {
+ } else if (QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive) == 0) {
+ // We need a native X window handle to be able to use xvimagesink.
+ // Bail out if Qt is not using xcb (the control will then be ignored by the plugin)
m_videoSink = gst_element_factory_make("xvimagesink", NULL);
}