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>
This commit is contained in:
committed by
Andrew den Exter
parent
7e3d69668e
commit
108dda7a90
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user