summaryrefslogtreecommitdiffstats
path: root/src/gsttools/qgstreamervideowidget.cpp
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2014-11-20 17:54:18 +0100
committerAndrew den Exter <andrew.den.exter@qinetic.com.au>2014-11-27 23:30:05 +0100
commit108dda7a90bd0f0337358b0db47ae55acd16dea6 (patch)
treee74c44c004b257fb99fdc96063641c76ac0426cf /src/gsttools/qgstreamervideowidget.cpp
parent7e3d69668e3f04110a651dee1850a1d0c885947b (diff)
GStreamer: port to 1.0.
0.10 is still used by default. To enable GStreamer 1.0, pass GST_VERSION=1.0 to qmake for qtmultimedia.pro. Contributions from: Andrew den Exter <andrew.den.exter@qinetic.com.au> Ilya Smelykh <ilya@videoexpertsgroup.com> Jim Hodapp <jim.hodapp@canonical.com> Sergio Schvezov <sergio.schvezov@canonical.com> Change-Id: I72a46d1170a8794a149bdb5e20767afcc5b7587c Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'src/gsttools/qgstreamervideowidget.cpp')
-rw-r--r--src/gsttools/qgstreamervideowidget.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/gsttools/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp
index aa2e2a30..1ae57a0e 100644
--- a/src/gsttools/qgstreamervideowidget.cpp
+++ b/src/gsttools/qgstreamervideowidget.cpp
@@ -40,8 +40,13 @@
#include <QtGui/qpainter.h>
#include <gst/gst.h>
+
+#if !GST_CHECK_VERSION(1,0,0)
#include <gst/interfaces/xoverlay.h>
#include <gst/interfaces/propertyprobe.h>
+#else
+#include <gst/video/videooverlay.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -130,8 +135,6 @@ void QGstreamerVideoWidgetControl::createVideoWidget()
m_videoSink = gst_element_factory_make ("ximagesink", NULL);
qt_gst_object_ref_sink(GST_OBJECT (m_videoSink)); //Take ownership
-
-
}
GstElement *QGstreamerVideoWidgetControl::videoSink()
@@ -169,9 +172,13 @@ bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &m
{
GstMessage* gm = message.rawMessage();
+#if !GST_CHECK_VERSION(1,0,0)
if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
gst_structure_has_name(gm->structure, "prepare-xwindow-id")) {
-
+#else
+ if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
+ gst_structure_has_name(gst_message_get_structure(gm), "prepare-window-handle")) {
+#endif
setOverlay();
QMetaObject::invokeMethod(this, "updateNativeVideoSize", Qt::QueuedConnection);
return true;
@@ -199,17 +206,24 @@ bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &me
void QGstreamerVideoWidgetControl::setOverlay()
{
+#if !GST_CHECK_VERSION(1,0,0)
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
}
+#else
+ if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
+ gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId);
+ }
+#endif
}
void QGstreamerVideoWidgetControl::updateNativeVideoSize()
{
if (m_videoSink) {
//find video native size to update video widget size hint
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
+ GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
+ GstCaps *caps = qt_gst_pad_get_current_caps(pad);
+
gst_object_unref(GST_OBJECT(pad));
if (caps) {
@@ -225,8 +239,13 @@ void QGstreamerVideoWidgetControl::updateNativeVideoSize()
void QGstreamerVideoWidgetControl::windowExposed()
{
+#if !GST_CHECK_VERSION(1,0,0)
if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink))
gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
+#else
+ if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink))
+ gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink));
+#endif
}
QWidget *QGstreamerVideoWidgetControl::videoWidget()