1 From 8d396ebedaa9ed6d9152fb8a4f90a3ea347fdec0 Mon Sep 17 00:00:00 2001
2 From: Yoann Lopes <yoann.lopes@digia.com>
3 Date: Thu, 31 Oct 2013 15:06:30 +0100
4 Subject: [PATCH 1/2] Initial porting effort to GStreamer 1.0.
6 Imported from git@github.com:jhodapp/qtmultimedia.git
9 Ilya Smelykh <ilya@videoexpertsgroup.com>
10 Jim Hodapp <jim.hodapp@canonical.com>
11 Sergio Schvezov <sergio.schvezov@canonical.com>
13 Change-Id: I10fa5e5078efa4564ce833befd417008e26a90a9
14 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
15 (cherry picked from commit d91dac090d92fdbc3a3425e8d969c62e5c79eff9)
18 src/gsttools/qgstreamervideorenderer.cpp
19 src/gsttools/qgstreamervideowidget.cpp
20 src/gsttools/qgstreamervideowindow.cpp
21 src/plugins/gstreamer/camerabin/camerabinsession.cpp
22 src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
23 src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
25 config.tests/gstreamer/gstreamer.pro | 11 +-
26 config.tests/gstreamer_appsrc/gstreamer_appsrc.pro | 13 +-
27 .../gstreamer_encodingprofiles.pro | 13 +-
28 .../gstreamer_photography.pro | 15 +-
29 qtmultimedia.pro | 22 ++-
30 src/gsttools/gsttools.pro | 22 +--
31 src/gsttools/gstvideoconnector.c | 199 +++++++++++++++++++--
32 src/gsttools/qgstappsrc.cpp | 29 ++-
33 src/gsttools/qgstreameraudioprobecontrol.cpp | 19 +-
34 src/gsttools/qgstreamerbushelper.cpp | 8 +
35 src/gsttools/qgstreamervideoprobecontrol.cpp | 9 +
36 src/gsttools/qgstreamervideorenderer.cpp | 3 +-
37 src/gsttools/qgstreamervideowidget.cpp | 29 ++-
38 src/gsttools/qgstreamervideowindow.cpp | 79 +++++++-
39 src/gsttools/qgstutils.cpp | 27 ++-
40 src/gsttools/qgstvideobuffer.cpp | 18 +-
41 src/gsttools/qvideosurfacegstsink.cpp | 143 +++++++++++++--
42 src/multimedia/gsttools_headers/qgstappsrc_p.h | 3 +
43 .../qgstreameraudioprobecontrol_p.h | 5 +-
44 .../qgstreamervideoprobecontrol_p.h | 4 +
45 .../gsttools_headers/qgstreamervideowindow_p.h | 4 +
46 src/multimedia/gsttools_headers/qgstutils_p.h | 4 +
47 .../gsttools_headers/qgstvideobuffer_p.h | 3 +
48 .../gsttools_headers/qvideosurfacegstsink_p.h | 6 +-
49 .../qgstreameraudiodecoderserviceplugin.cpp | 27 ++-
50 .../audiodecoder/qgstreameraudiodecodersession.cpp | 33 +++-
51 .../gstreamer/camerabin/camerabinsession.cpp | 25 +++
52 src/plugins/gstreamer/common.pri | 21 ++-
53 src/plugins/gstreamer/gstreamer.pro | 3 +-
54 .../mediacapture/qgstreamercapturesession.cpp | 5 +
55 src/plugins/gstreamer/mediaplayer/mediaplayer.pro | 1 -
56 .../mediaplayer/qgstreamerplayercontrol.cpp | 2 +
57 .../mediaplayer/qgstreamerplayerservice.cpp | 9 +-
58 .../mediaplayer/qgstreamerplayerserviceplugin.cpp | 27 ++-
59 .../mediaplayer/qgstreamerplayersession.cpp | 154 ++++++++++++++--
60 .../mediaplayer/qgstreamerplayersession.h | 9 +
61 36 files changed, 873 insertions(+), 131 deletions(-)
63 diff --git a/config.tests/gstreamer/gstreamer.pro b/config.tests/gstreamer/gstreamer.pro
64 index 02a7e34..6b9843a 100644
65 --- a/config.tests/gstreamer/gstreamer.pro
66 +++ b/config.tests/gstreamer/gstreamer.pro
67 @@ -3,11 +3,10 @@ SOURCES += main.cpp
68 CONFIG += link_pkgconfig
72 - gstreamer-base-0.10 \
73 - gstreamer-interfaces-0.10 \
74 - gstreamer-audio-0.10 \
75 - gstreamer-video-0.10 \
76 - gstreamer-pbutils-0.10
77 + gstreamer-$$GST_VERSION \
78 + gstreamer-base-$$GST_VERSION \
79 + gstreamer-audio-$$GST_VERSION \
80 + gstreamer-video-$$GST_VERSION \
81 + gstreamer-pbutils-$$GST_VERSION
84 diff --git a/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro b/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro
85 index 9f61703..0f3ca2b 100644
86 --- a/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro
87 +++ b/config.tests/gstreamer_appsrc/gstreamer_appsrc.pro
88 @@ -3,11 +3,8 @@ SOURCES += main.cpp
89 CONFIG += link_pkgconfig
93 - gstreamer-base-0.10 \
94 - gstreamer-interfaces-0.10 \
95 - gstreamer-audio-0.10 \
96 - gstreamer-video-0.10 \
100 + gstreamer-$$GST_VERSION \
101 + gstreamer-base-$$GST_VERSION \
102 + gstreamer-audio-$$GST_VERSION \
103 + gstreamer-video-$$GST_VERSION \
104 + gstreamer-pbutils-$$GST_VERSION
105 diff --git a/config.tests/gstreamer_encodingprofiles/gstreamer_encodingprofiles.pro b/config.tests/gstreamer_encodingprofiles/gstreamer_encodingprofiles.pro
106 index 7e8a9e7..fad40b0 100644
107 --- a/config.tests/gstreamer_encodingprofiles/gstreamer_encodingprofiles.pro
108 +++ b/config.tests/gstreamer_encodingprofiles/gstreamer_encodingprofiles.pro
109 @@ -2,11 +2,10 @@ SOURCES += main.cpp
111 CONFIG += link_pkgconfig
115 - gstreamer-base-0.10 \
116 - gstreamer-interfaces-0.10 \
117 - gstreamer-audio-0.10 \
118 - gstreamer-video-0.10 \
119 - gstreamer-pbutils-0.10
122 + gstreamer-$$GST_VERSION \
123 + gstreamer-base-$$GST_VERSION \
124 + gstreamer-audio-$$GST_VERSION \
125 + gstreamer-video-$$GST_VERSION \
126 + gstreamer-pbutils-$$GST_VERSION
127 diff --git a/config.tests/gstreamer_photography/gstreamer_photography.pro b/config.tests/gstreamer_photography/gstreamer_photography.pro
128 index 6b530cb..975991f 100644
129 --- a/config.tests/gstreamer_photography/gstreamer_photography.pro
130 +++ b/config.tests/gstreamer_photography/gstreamer_photography.pro
131 @@ -3,12 +3,11 @@ SOURCES += main.cpp
132 CONFIG += link_pkgconfig
136 - gstreamer-base-0.10 \
137 - gstreamer-interfaces-0.10 \
138 - gstreamer-audio-0.10 \
139 - gstreamer-video-0.10 \
140 - gstreamer-pbutils-0.10
142 -LIBS += -lgstphotography-0.10
143 + gstreamer-$$GST_VERSION \
144 + gstreamer-base-$$GST_VERSION \
145 + gstreamer-audio-$$GST_VERSION \
146 + gstreamer-video-$$GST_VERSION \
147 + gstreamer-pbutils-$$GST_VERSION
149 +LIBS += -lgstphotography-$$GST_VERSION
151 diff --git a/qtmultimedia.pro b/qtmultimedia.pro
152 index c7f093c..37f42a0 100644
153 --- a/qtmultimedia.pro
154 +++ b/qtmultimedia.pro
155 @@ -21,10 +21,24 @@ win32 {
158 qtCompileTest(pulseaudio)
159 - qtCompileTest(gstreamer) {
160 - qtCompileTest(gstreamer_photography)
161 - qtCompileTest(gstreamer_encodingprofiles)
162 - qtCompileTest(gstreamer_appsrc)
163 + !done_config_gstreamer {
165 + cache(GST_VERSION, set, gstver);
166 + qtCompileTest(gstreamer) {
167 + qtCompileTest(gstreamer_photography)
168 + qtCompileTest(gstreamer_encodingprofiles)
169 + qtCompileTest(gstreamer_appsrc)
172 + cache(GST_VERSION, set, gstver);
173 + # Force a re-run of the test
174 + CONFIG -= done_config_gstreamer
175 + qtCompileTest(gstreamer) {
176 + qtCompileTest(gstreamer_photography)
177 + qtCompileTest(gstreamer_encodingprofiles)
178 + qtCompileTest(gstreamer_appsrc)
182 qtCompileTest(resourcepolicy)
183 qtCompileTest(gpu_vivante)
184 diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro
185 index 15edd04..d252344 100644
186 --- a/src/gsttools/gsttools.pro
187 +++ b/src/gsttools/gsttools.pro
188 @@ -2,7 +2,7 @@ TEMPLATE = lib
192 -QT = core-private multimedia-private gui-private
193 +QT = core-private multimedia-private gui-private opengl
195 !static:DEFINES += QT_MAKEDLL
196 DEFINES += GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
197 @@ -15,13 +15,14 @@ LIBS_PRIVATE += \
199 CONFIG += link_pkgconfig
201 -PKGCONFIG_PRIVATE += \
203 - gstreamer-base-0.10 \
204 - gstreamer-interfaces-0.10 \
205 - gstreamer-audio-0.10 \
206 - gstreamer-video-0.10 \
207 - gstreamer-pbutils-0.10
209 + gstreamer-$$GST_VERSION \
210 + gstreamer-base-$$GST_VERSION \
211 + gstreamer-audio-$$GST_VERSION \
212 + gstreamer-video-$$GST_VERSION \
213 + gstreamer-pbutils-$$GST_VERSION
215 +equals(GST_VERSION,"0.10"): PKGCONFIG_PRIVATE += gstreamer-interfaces-$$GST_VERSION
217 maemo*: PKGCONFIG_PRIVATE +=gstreamer-plugins-bad-0.10
219 @@ -33,6 +34,7 @@ config_resourcepolicy {
220 # Header files must go inside source directory of a module
221 # to be installed by syncqt.
222 INCLUDEPATH += ../multimedia/gsttools_headers/
223 +INCLUDEPATH += ../plugins/gstreamer/mediaplayer/
224 VPATH += ../multimedia/gsttools_headers/
227 @@ -91,13 +93,13 @@ maemo6 {
230 config_gstreamer_appsrc {
231 - PKGCONFIG_PRIVATE += gstreamer-app-0.10
232 + PKGCONFIG_PRIVATE += gstreamer-app-$$GST_VERSION
233 PRIVATE_HEADERS += qgstappsrc_p.h
234 SOURCES += qgstappsrc.cpp
236 DEFINES += HAVE_GST_APPSRC
238 - LIBS_PRIVATE += -lgstapp-0.10
239 + LIBS_PRIVATE += -lgstapp-$$GST_VERSION
242 HEADERS += $$PRIVATE_HEADERS
243 diff --git a/src/gsttools/gstvideoconnector.c b/src/gsttools/gstvideoconnector.c
244 index 3e08fe5..ff3f9a3 100644
245 --- a/src/gsttools/gstvideoconnector.c
246 +++ b/src/gsttools/gstvideoconnector.c
247 @@ -67,26 +67,93 @@ GST_STATIC_PAD_TEMPLATE ("src",
249 GST_STATIC_CAPS_ANY);
252 +#if GST_CHECK_VERSION(1,0,0)
254 +G_DEFINE_TYPE(GstVideoConnector, gst_video_connector, GST_TYPE_ELEMENT);
256 #define _do_init(bla) \
257 GST_DEBUG_CATEGORY_INIT (video_connector_debug, \
258 "video-connector", 0, "An identity like element for reconnecting video stream");
260 GST_BOILERPLATE_FULL (GstVideoConnector, gst_video_connector, GstElement,
261 GST_TYPE_ELEMENT, _do_init);
264 static void gst_video_connector_dispose (GObject * object);
266 +#if GST_CHECK_VERSION(1,0,0)
267 +static GstFlowReturn gst_video_connector_chain (GstPad * pad, GstObject* parent, GstBuffer * buf);
269 static GstFlowReturn gst_video_connector_chain (GstPad * pad, GstBuffer * buf);
270 static GstFlowReturn gst_video_connector_buffer_alloc (GstPad * pad,
271 guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
274 static GstStateChangeReturn gst_video_connector_change_state (GstElement *
275 element, GstStateChange transition);
277 +#if GST_CHECK_VERSION(1,0,0)
278 +static gboolean gst_video_connector_handle_sink_event (GstPad * pad, GstObject* parent,
281 static gboolean gst_video_connector_handle_sink_event (GstPad * pad,
285 +#if GST_CHECK_VERSION(1,0,0)
286 +static GstPadProbeReturn gst_video_connector_new_buffer_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object);
287 +static GstPadProbeReturn gst_video_connector_new_event_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object);
288 +static GstPadProbeReturn gst_video_connector_new_query_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object);
290 static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *buffer, guint * object);
291 -static void gst_video_connector_resend_new_segment(GstElement * element, gboolean emitFailedSignal);
292 static gboolean gst_video_connector_setcaps (GstPad *pad, GstCaps *caps);
293 static GstCaps *gst_video_connector_getcaps (GstPad * pad);
294 static gboolean gst_video_connector_acceptcaps (GstPad * pad, GstCaps * caps);
297 +static void gst_video_connector_resend_new_segment(GstElement * element, gboolean emitFailedSignal);
299 +#if GST_CHECK_VERSION(1,0,0)
301 +gst_video_connector_class_init (GstVideoConnectorClass * klass)
303 + GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
304 + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
306 + gst_element_class_set_details_simple (gstelement_class, "Video Connector",
308 + "An identity like element used for reconnecting video stream",
309 + "Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>");
310 + gst_element_class_add_pad_template (gstelement_class,
311 + gst_static_pad_template_get (&gst_video_connector_sink_factory));
312 + gst_element_class_add_pad_template (gstelement_class,
313 + gst_static_pad_template_get (&gst_video_connector_src_factory));
315 + gst_video_connector_parent_class = g_type_class_peek_parent (klass);
317 + gobject_class->dispose = gst_video_connector_dispose;
318 + gstelement_class->change_state = gst_video_connector_change_state;
319 + klass->resend_new_segment = gst_video_connector_resend_new_segment;
321 + gst_video_connector_signals[SIGNAL_RESEND_NEW_SEGMENT] =
322 + g_signal_new ("resend-new-segment", G_TYPE_FROM_CLASS (klass),
323 + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
324 + G_STRUCT_OFFSET (GstVideoConnectorClass, resend_new_segment), NULL, NULL,
325 + g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
327 + gst_video_connector_signals[SIGNAL_CONNECTION_FAILED] =
328 + g_signal_new ("connection-failed", G_TYPE_FROM_CLASS (klass),
331 + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
333 + GST_DEBUG_CATEGORY_INIT(video_connector_debug, "video-connector", 0,
334 + "An identity like element for reconnecting video stream");
341 gst_video_connector_base_init (gpointer g_class)
342 @@ -128,18 +195,33 @@ gst_video_connector_class_init (GstVideoConnectorClass * klass)
343 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
349 -gst_video_connector_init (GstVideoConnector *element,
350 - GstVideoConnectorClass *g_class)
351 +gst_video_connector_init (GstVideoConnector *element
352 +#if GST_CHECK_VERSION(1,0,0)
354 + ,GstVideoConnectorClass *g_class
358 +#if GST_CHECK_VERSION(1,0,0)
363 gst_pad_new_from_static_template (&gst_video_connector_sink_factory,
365 gst_pad_set_chain_function(element->sinkpad,
366 GST_DEBUG_FUNCPTR (gst_video_connector_chain));
367 +#if GST_CHECK_VERSION(1,0,0)
368 + /* gstreamer 1.x uses QUERIES and EVENTS for allocation and caps handiling purposes */
369 + GST_OBJECT_FLAG_SET (element->sinkpad, GST_PAD_FLAG_PROXY_CAPS);
370 + GST_OBJECT_FLAG_SET (element->sinkpad, GST_PAD_FLAG_PROXY_ALLOCATION);
372 gst_pad_set_event_function(element->sinkpad,
373 GST_DEBUG_FUNCPTR (gst_video_connector_handle_sink_event));
375 gst_pad_set_bufferalloc_function(element->sinkpad,
376 GST_DEBUG_FUNCPTR (gst_video_connector_buffer_alloc));
377 gst_pad_set_setcaps_function(element->sinkpad,
378 @@ -148,14 +230,23 @@ gst_video_connector_init (GstVideoConnector *element,
379 GST_DEBUG_FUNCPTR(gst_video_connector_getcaps));
380 gst_pad_set_acceptcaps_function(element->sinkpad,
381 GST_DEBUG_FUNCPTR(gst_video_connector_acceptcaps));
384 gst_element_add_pad (GST_ELEMENT (element), element->sinkpad);
387 gst_pad_new_from_static_template (&gst_video_connector_src_factory,
389 +#if GST_CHECK_VERSION(1,0,0)
390 + gst_pad_add_probe(element->srcpad, GST_PAD_PROBE_TYPE_BUFFER,
391 + gst_video_connector_new_buffer_probe, element, NULL);
392 + gst_pad_add_probe(element->srcpad, GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM,
393 + gst_video_connector_new_query_probe, element, NULL);
394 + gst_pad_add_probe(element->sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
395 + gst_video_connector_new_event_probe, element, NULL);
397 gst_pad_add_buffer_probe(element->srcpad,
398 G_CALLBACK(gst_video_connector_new_buffer_probe), element);
400 gst_element_add_pad (GST_ELEMENT (element), element->srcpad);
402 element->relinked = FALSE;
403 @@ -183,9 +274,16 @@ gst_video_connector_dispose (GObject * object)
405 gst_video_connector_reset (element);
407 +#if GST_CHECK_VERSION(1,0,0)
408 + G_OBJECT_CLASS (gst_video_connector_parent_class)->dispose (object);
410 G_OBJECT_CLASS (parent_class)->dispose (object);
414 +#if GST_CHECK_VERSION(1,0,0)
415 +/* For gstreamer 1.x we handle it in ALLOCATION Query */
417 // "When this function returns anything else than GST_FLOW_OK,
418 // the buffer allocation failed and buf does not contain valid data."
420 @@ -229,6 +327,7 @@ gst_video_connector_buffer_alloc (GstPad * pad, guint64 offset, guint size,
421 if (state == GST_STATE_NULL) {
422 GST_DEBUG_OBJECT (element, "Downstream element is in NULL state");
423 // Downstream filter seems to be in the wrong state
425 return GST_FLOW_UNEXPECTED;
428 @@ -301,6 +400,7 @@ static GstCaps *gst_video_connector_getcaps (GstPad * pad)
433 static gboolean gst_video_connector_acceptcaps (GstPad * pad, GstCaps * caps)
435 GstVideoConnector *element;
436 @@ -308,6 +408,7 @@ static gboolean gst_video_connector_acceptcaps (GstPad * pad, GstCaps * caps)
438 return gst_pad_peer_accept_caps(element->srcpad, caps);
443 gst_video_connector_resend_new_segment(GstElement * element, gboolean emitFailedSignal)
444 @@ -319,11 +420,39 @@ gst_video_connector_resend_new_segment(GstElement * element, gboolean emitFailed
445 connector->failedSignalEmited = FALSE;
448 +#if GST_CHECK_VERSION(1,0,0)
449 +static GstPadProbeReturn gst_video_connector_new_event_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object)
451 + GstVideoConnector *connector = GST_VIDEO_CONNECTOR (object);
452 + GstEvent *event = gst_pad_probe_info_get_event(info);
454 + GST_DEBUG_OBJECT(connector, "Event %"GST_PTR_FORMAT" received\n", event);
456 + return GST_PAD_PROBE_OK;
459 +static GstPadProbeReturn gst_video_connector_new_query_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object)
461 + GstVideoConnector *connector = GST_VIDEO_CONNECTOR (object);
462 + GstQuery *query = gst_pad_probe_info_get_query(info);
464 + GST_DEBUG_OBJECT(connector, "Query %"GST_PTR_FORMAT" received\n", query);
466 + return GST_PAD_PROBE_OK;
470 +#if GST_CHECK_VERSION(1,0,0)
471 +static GstPadProbeReturn gst_video_connector_new_buffer_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object)
475 static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *buffer, guint * object)
483 GstVideoConnector *element = GST_VIDEO_CONNECTOR (object);
485 @@ -335,16 +464,23 @@ static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *
486 if (element->relinked)
487 GST_LOG_OBJECT(element, "rejected buffer because of new segment request");
489 - return !element->relinked;
490 + return element->relinked ? GST_PAD_PROBE_DROP : GST_PAD_PROBE_OK;
495 +#if GST_CHECK_VERSION(1,0,0)
496 +gst_video_connector_chain (GstPad * pad, GstObject* parent, GstBuffer * buf)
498 gst_video_connector_chain (GstPad * pad, GstBuffer * buf)
502 GstVideoConnector *element;
504 +#if GST_CHECK_VERSION(1,0,0)
508 element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad));
511 @@ -356,20 +492,29 @@ gst_video_connector_chain (GstPad * pad, GstBuffer * buf)
513 while (element->relinked) {
514 element->relinked = FALSE;
516 +#if GST_CHECK_VERSION(1,0,0)
517 + if (element->latest_buffer && GST_BUFFER_TIMESTAMP_IS_VALID(element->latest_buffer)) {
518 + element->segment.position = GST_BUFFER_TIMESTAMP (element->latest_buffer);
521 gint64 pos = element->segment.last_stop;
523 if (element->latest_buffer && GST_BUFFER_TIMESTAMP_IS_VALID(element->latest_buffer)) {
524 pos = GST_BUFFER_TIMESTAMP (element->latest_buffer);
528 //push a new segment and last buffer
529 +#if GST_CHECK_VERSION(1,0,0)
530 + GstEvent *ev = gst_event_new_segment (&element->segment);
533 GstEvent *ev = gst_event_new_new_segment (TRUE,
534 element->segment.rate,
535 element->segment.format,
537 element->segment.stop,
541 GST_DEBUG_OBJECT (element, "Pushing new segment event");
542 if (!gst_pad_push_event (element->srcpad, ev)) {
543 @@ -432,8 +577,11 @@ gst_video_connector_change_state (GstElement * element,
544 GstStateChangeReturn result;
546 connector = GST_VIDEO_CONNECTOR(element);
547 +#if GST_CHECK_VERSION(1,0,0)
548 + result = GST_ELEMENT_CLASS (gst_video_connector_parent_class)->change_state(element, transition);
550 result = GST_ELEMENT_CLASS (parent_class)->change_state(element, transition);
553 switch (transition) {
554 case GST_STATE_CHANGE_PAUSED_TO_READY:
555 gst_video_connector_reset (connector);
556 @@ -448,9 +596,32 @@ gst_video_connector_change_state (GstElement * element,
561 -gst_video_connector_handle_sink_event (GstPad * pad, GstEvent * event)
562 +#if GST_CHECK_VERSION(1,0,0)
563 +static gboolean gst_video_connector_handle_sink_event (GstPad * pad, GstObject* parent,
566 + GstVideoConnector *element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad));
568 + switch (GST_EVENT_TYPE (event)) {
569 + case GST_EVENT_SEGMENT:
571 + case GST_EVENT_CAPS:
577 + gst_object_unref (element);
578 + return gst_pad_event_default (pad, parent, event);
583 +static gboolean gst_video_connector_handle_sink_event (GstPad * pad,
588 if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
589 GstVideoConnector *element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad));
591 @@ -461,7 +632,6 @@ gst_video_connector_handle_sink_event (GstPad * pad, GstEvent * event)
593 gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
594 &start, &stop, &time);
596 GST_LOG_OBJECT (element,
597 "NEWSEGMENT update %d, rate %lf, applied rate %lf, "
598 "format %d, " "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
599 @@ -469,9 +639,10 @@ gst_video_connector_handle_sink_event (GstPad * pad, GstEvent * event)
601 gst_segment_set_newsegment_full (&element->segment, update,
602 rate, arate, format, start, stop, time);
604 gst_object_unref (element);
607 return gst_pad_event_default (pad, event);
611 diff --git a/src/gsttools/qgstappsrc.cpp b/src/gsttools/qgstappsrc.cpp
612 index 2c9f64c..7916d89 100644
613 --- a/src/gsttools/qgstappsrc.cpp
614 +++ b/src/gsttools/qgstappsrc.cpp
615 @@ -155,23 +155,44 @@ void QGstAppSrc::pushDataToAppSrc()
616 size = qMin(m_stream->bytesAvailable(), (qint64)m_dataRequestSize);
619 - void *data = g_malloc(size);
620 - GstBuffer* buffer = gst_app_buffer_new(data, size, g_free, data);
621 + GstBuffer* buffer = gst_buffer_new_and_alloc(size);
623 +#if GST_CHECK_VERSION(1,0,0)
624 + GstMapInfo mapInfo;
625 + gst_buffer_map(buffer, &mapInfo, GST_MAP_WRITE);
626 + void* bufferData = mapInfo.data;
628 + void* bufferData = GST_BUFFER_DATA(buffer);
631 buffer->offset = m_stream->pos();
632 - qint64 bytesRead = m_stream->read((char*)GST_BUFFER_DATA(buffer), size);
633 + qint64 bytesRead = m_stream->read((char*)bufferData, size);
634 buffer->offset_end = buffer->offset + bytesRead - 1;
636 +#if GST_CHECK_VERSION(1,0,0)
637 + gst_buffer_unmap(buffer, &mapInfo);
641 m_dataRequested = false;
642 m_enoughData = false;
643 GstFlowReturn ret = gst_app_src_push_buffer (GST_APP_SRC (element()), buffer);
644 if (ret == GST_FLOW_ERROR) {
645 qWarning()<<"appsrc: push buffer error";
646 +#if GST_CHECK_VERSION(1,0,0)
647 + } else if (ret == GST_FLOW_FLUSHING) {
648 + qWarning()<<"appsrc: push buffer wrong state";
651 } else if (ret == GST_FLOW_WRONG_STATE) {
652 qWarning()<<"appsrc: push buffer wrong state";
653 - } else if (ret == GST_FLOW_RESEND) {
656 +#if GST_VERSION_MAJOR < 1
657 + else if (ret == GST_FLOW_RESEND) {
658 qWarning()<<"appsrc: push buffer resend";
664 diff --git a/src/gsttools/qgstreameraudioprobecontrol.cpp b/src/gsttools/qgstreameraudioprobecontrol.cpp
665 index 94d07c9..8c85973 100644
666 --- a/src/gsttools/qgstreameraudioprobecontrol.cpp
667 +++ b/src/gsttools/qgstreameraudioprobecontrol.cpp
668 @@ -53,9 +53,14 @@ QGstreamerAudioProbeControl::~QGstreamerAudioProbeControl()
672 +#if GST_CHECK_VERSION(1,0,0)
673 +void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer, GstCaps* caps)
676 void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer)
678 - GstCaps* caps = gst_buffer_get_caps(buffer);
679 + gst_buffer_get_caps(buffer);
684 @@ -64,8 +69,20 @@ void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer)
685 if (!format.isValid())
688 + #if GST_CHECK_VERSION(1,0,0)
692 + gst_buffer_map (buffer, &info, GST_MAP_READ);
693 + QAudioBuffer audioBuffer = QAudioBuffer(QByteArray((const char*)info.data, info.size), format);
694 + gst_buffer_unmap(buffer, &info);
698 QAudioBuffer audioBuffer = QAudioBuffer(QByteArray((const char*)buffer->data, buffer->size), format);
703 QMutexLocker locker(&m_bufferMutex);
704 m_pendingBuffer = audioBuffer;
705 diff --git a/src/gsttools/qgstreamerbushelper.cpp b/src/gsttools/qgstreamerbushelper.cpp
706 index da7506e..6b4cdd2 100644
707 --- a/src/gsttools/qgstreamerbushelper.cpp
708 +++ b/src/gsttools/qgstreamerbushelper.cpp
709 @@ -162,13 +162,21 @@ QGstreamerBusHelper::QGstreamerBusHelper(GstBus* bus, QObject* parent):
712 d = new QGstreamerBusHelperPrivate(this, bus);
713 +#if GST_CHECK_VERSION(1,0,0)
714 + gst_bus_set_sync_handler(bus, (GstBusSyncHandler)syncGstBusFilter, d, 0);
716 gst_bus_set_sync_handler(bus, (GstBusSyncHandler)syncGstBusFilter, d);
718 gst_object_ref(GST_OBJECT(bus));
721 QGstreamerBusHelper::~QGstreamerBusHelper()
723 +#if GST_CHECK_VERSION(1,0,0)
724 + gst_bus_set_sync_handler(d->bus(), 0, 0, 0);
726 gst_bus_set_sync_handler(d->bus(),0,0);
728 gst_object_unref(GST_OBJECT(d->bus()));
731 diff --git a/src/gsttools/qgstreamervideoprobecontrol.cpp b/src/gsttools/qgstreamervideoprobecontrol.cpp
732 index f2e6c3f..55632ff 100644
733 --- a/src/gsttools/qgstreamervideoprobecontrol.cpp
734 +++ b/src/gsttools/qgstreamervideoprobecontrol.cpp
735 @@ -75,12 +75,21 @@ void QGstreamerVideoProbeControl::stopFlushing()
739 +#if GST_CHECK_VERSION(1,0,0)
740 +void QGstreamerVideoProbeControl::bufferProbed(GstBuffer* buffer, GstCaps* caps)
742 void QGstreamerVideoProbeControl::bufferProbed(GstBuffer* buffer)
748 +#if GST_CHECK_VERSION(1,0,0)
750 + // GstCaps* caps = NULL;//gst_buffer_get_caps(buffer);
752 GstCaps* caps = gst_buffer_get_caps(buffer);
757 diff --git a/src/gsttools/qgstreamervideorenderer.cpp b/src/gsttools/qgstreamervideorenderer.cpp
758 index 36c9f78..da85dea 100644
759 --- a/src/gsttools/qgstreamervideorenderer.cpp
760 +++ b/src/gsttools/qgstreamervideorenderer.cpp
762 #include <private/qvideosurfacegstsink_p.h>
763 #include <private/qgstutils_p.h>
764 #include <qabstractvideosurface.h>
767 +#include <QtCore/qdebug.h>
771 diff --git a/src/gsttools/qgstreamervideowidget.cpp b/src/gsttools/qgstreamervideowidget.cpp
772 index 7e11bfb..7848f2f 100644
773 --- a/src/gsttools/qgstreamervideowidget.cpp
774 +++ b/src/gsttools/qgstreamervideowidget.cpp
776 #include <QtGui/qpainter.h>
780 +#if !GST_CHECK_VERSION(1,0,0)
781 #include <gst/interfaces/xoverlay.h>
782 #include <gst/interfaces/propertyprobe.h>
784 +#include <gst/video/videooverlay.h>
789 @@ -177,9 +182,13 @@ bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &m
791 GstMessage* gm = message.rawMessage();
793 +#if !GST_CHECK_VERSION(1,0,0)
794 if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
795 gst_structure_has_name(gm->structure, "prepare-xwindow-id")) {
798 + if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
799 + gst_structure_has_name(gst_message_get_structure(gm), "prepare-window-handle")) {
802 QMetaObject::invokeMethod(this, "updateNativeVideoSize", Qt::QueuedConnection);
804 @@ -207,18 +216,29 @@ bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &me
806 void QGstreamerVideoWidgetControl::setOverlay()
808 +#if !GST_CHECK_VERSION(1,0,0)
809 if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
810 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
813 + if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
814 + gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId);
819 void QGstreamerVideoWidgetControl::updateNativeVideoSize()
822 //find video native size to update video widget size hint
823 - GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
824 + GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
825 +#if !GST_CHECK_VERSION(1,0,0)
826 GstCaps *caps = gst_pad_get_negotiated_caps(pad);
827 gst_object_unref(GST_OBJECT(pad));
829 + GstCaps *caps = gst_pad_get_current_caps(pad);
830 + gst_object_unref(GST_OBJECT(pad));
834 m_widget->setNativeSize(QGstUtils::capsCorrectedResolution(caps));
835 @@ -233,8 +253,13 @@ void QGstreamerVideoWidgetControl::updateNativeVideoSize()
837 void QGstreamerVideoWidgetControl::windowExposed()
839 +#if !GST_CHECK_VERSION(1,0,0)
840 if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink))
841 gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
843 + if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink))
844 + gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink));
848 QWidget *QGstreamerVideoWidgetControl::videoWidget()
849 diff --git a/src/gsttools/qgstreamervideowindow.cpp b/src/gsttools/qgstreamervideowindow.cpp
850 index 2dc3510..45e9374 100644
851 --- a/src/gsttools/qgstreamervideowindow.cpp
852 +++ b/src/gsttools/qgstreamervideowindow.cpp
854 #include <QtCore/qdebug.h>
857 +#include <gst/video/videooverlay.h>
859 +#if !GST_CHECK_VERSION(1,0,0)
860 #include <gst/interfaces/xoverlay.h>
861 #include <gst/interfaces/propertyprobe.h>
865 QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const char *elementName)
866 @@ -57,18 +61,25 @@ QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const char *elemen
867 , m_fullScreen(false)
868 , m_colorKey(QColor::Invalid)
872 m_videoSink = gst_element_factory_make(elementName, NULL);
875 m_videoSink = gst_element_factory_make("xvimagesink", NULL);
879 qt_gst_object_ref_sink(GST_OBJECT(m_videoSink)); //Take ownership
881 GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
882 +#if GST_CHECK_VERSION(1,0,0)
883 + m_bufferProbeId = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, padBufferProbe, this, NULL);
885 m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this);
887 gst_object_unref(GST_OBJECT(pad));
890 + qDebug() << "No m_videoSink available!";
893 QGstreamerVideoWindow::~QGstreamerVideoWindow()
894 @@ -90,11 +101,15 @@ void QGstreamerVideoWindow::setWinId(WId id)
895 WId oldId = m_windowId;
899 +#if GST_CHECK_VERSION(1,0,0)
900 + if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
901 + gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId);
904 if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
905 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
910 emit readyChanged(true);
912 @@ -105,7 +120,20 @@ void QGstreamerVideoWindow::setWinId(WId id)
913 bool QGstreamerVideoWindow::processSyncMessage(const QGstreamerMessage &message)
915 GstMessage* gm = message.rawMessage();
916 +#if GST_CHECK_VERSION(1,0,0)
917 + const GstStructure *s = gst_message_get_structure(gm);
918 + if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
919 + gst_structure_has_name(s, "prepare-window-handle") &&
920 + m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
922 + gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId);
924 + GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
925 + m_bufferProbeId = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, padBufferProbe, this, NULL);
930 if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
931 gst_structure_has_name(gm->structure, "prepare-xwindow-id") &&
932 m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
933 @@ -118,7 +146,7 @@ bool QGstreamerVideoWindow::processSyncMessage(const QGstreamerMessage &message)
942 @@ -130,7 +158,19 @@ QRect QGstreamerVideoWindow::displayRect() const
943 void QGstreamerVideoWindow::setDisplayRect(const QRect &rect)
945 m_displayRect = rect;
947 +#if GST_CHECK_VERSION(1,0,0)
948 + if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
949 + if (m_displayRect.isEmpty())
950 + gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink), -1, -1, -1, -1);
952 + gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink),
955 + m_displayRect.width(),
956 + m_displayRect.height());
960 if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
961 #if GST_VERSION_MICRO >= 29
962 if (m_displayRect.isEmpty())
963 @@ -144,6 +184,7 @@ void QGstreamerVideoWindow::setDisplayRect(const QRect &rect)
970 Qt::AspectRatioMode QGstreamerVideoWindow::aspectRatioMode() const
971 @@ -165,6 +206,16 @@ void QGstreamerVideoWindow::setAspectRatioMode(Qt::AspectRatioMode mode)
973 void QGstreamerVideoWindow::repaint()
975 +#if GST_CHECK_VERSION(1,0,0)
976 + if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) {
977 + //don't call gst_x_overlay_expose if the sink is in null state
978 + GstState state = GST_STATE_NULL;
979 + GstStateChangeReturn res = gst_element_get_state(m_videoSink, &state, NULL, 1000000);
980 + if (res != GST_STATE_CHANGE_FAILURE && state != GST_STATE_NULL) {
981 + gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink));
985 if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
986 //don't call gst_x_overlay_expose if the sink is in null state
987 GstState state = GST_STATE_NULL;
988 @@ -173,6 +224,7 @@ void QGstreamerVideoWindow::repaint()
989 gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
995 QColor QGstreamerVideoWindow::colorKey() const
996 @@ -304,11 +356,22 @@ QSize QGstreamerVideoWindow::nativeSize() const
1000 +#if GST_CHECK_VERSION(1,0,0)
1001 +GstPadProbeReturn QGstreamerVideoWindow::padBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data)
1003 void QGstreamerVideoWindow::padBufferProbe(GstPad *pad, GstBuffer * /* buffer */, gpointer user_data)
1006 QGstreamerVideoWindow *control = reinterpret_cast<QGstreamerVideoWindow*>(user_data);
1007 QMetaObject::invokeMethod(control, "updateNativeVideoSize", Qt::QueuedConnection);
1009 +#if GST_CHECK_VERSION(1,0,0)
1012 + return GST_PAD_PROBE_REMOVE;
1014 gst_pad_remove_buffer_probe(pad, control->m_bufferProbeId);
1018 void QGstreamerVideoWindow::updateNativeVideoSize()
1019 @@ -319,7 +382,11 @@ void QGstreamerVideoWindow::updateNativeVideoSize()
1021 //find video native size to update video widget size hint
1022 GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
1023 +#if GST_CHECK_VERSION(1,0,0)
1024 + GstCaps *caps = gst_pad_get_current_caps(pad);
1026 GstCaps *caps = gst_pad_get_negotiated_caps(pad);
1028 gst_object_unref(GST_OBJECT(pad));
1031 diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
1032 index 41bd005..3ca1921 100644
1033 --- a/src/gsttools/qgstutils.cpp
1034 +++ b/src/gsttools/qgstutils.cpp
1035 @@ -89,8 +89,13 @@ static void addTagToMap(const GstTagList *list,
1038 // GST_TYPE_DATE is a function, not a constant, so pull it out of the switch
1039 +#if GST_CHECK_VERSION(1,0,0)
1040 + if (G_VALUE_TYPE(&val) == G_TYPE_DATE) {
1041 + const GDate *date = (const GDate *)g_value_get_boxed(&val);
1043 if (G_VALUE_TYPE(&val) == GST_TYPE_DATE) {
1044 const GDate *date = gst_value_get_date(&val);
1046 if (g_date_valid(date)) {
1047 int year = g_date_get_year(date);
1048 int month = g_date_get_month(date);
1049 @@ -254,6 +259,24 @@ QAudioFormat QGstUtils::audioFormatForCaps(const GstCaps *caps)
1054 +#if GST_CHECK_VERSION(1,0,0)
1056 + Returns audio format for a buffer.
1057 + If the buffer doesn't have a valid audio format, an empty QAudioFormat is returned.
1060 +QAudioFormat QGstUtils::audioFormatForSample(GstSample *sample)
1062 + GstCaps* caps = gst_sample_get_caps(sample);
1064 + return QAudioFormat();
1066 + QAudioFormat format = QGstUtils::audioFormatForCaps(caps);
1067 + gst_caps_unref(caps);
1072 Returns audio format for a buffer.
1073 If the buffer doesn't have a valid audio format, an empty QAudioFormat is returned.
1074 @@ -269,7 +292,7 @@ QAudioFormat QGstUtils::audioFormatForBuffer(GstBuffer *buffer)
1075 gst_caps_unref(caps);
1082 Builds GstCaps for an audio format.
1083 @@ -403,7 +426,7 @@ QMultimedia::SupportEstimate QGstUtils::hasSupport(const QString &mimeType,
1085 void qt_gst_object_ref_sink(gpointer object)
1087 -#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 24)
1088 +#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 24) || GST_CHECK_VERSION(1,0,0)
1089 gst_object_ref_sink(object);
1091 g_return_if_fail (GST_IS_OBJECT(object));
1092 diff --git a/src/gsttools/qgstvideobuffer.cpp b/src/gsttools/qgstvideobuffer.cpp
1093 index 45556d1..750a07f 100644
1094 --- a/src/gsttools/qgstvideobuffer.cpp
1095 +++ b/src/gsttools/qgstvideobuffer.cpp
1096 @@ -78,21 +78,33 @@ QAbstractVideoBuffer::MapMode QGstVideoBuffer::mapMode() const
1097 uchar *QGstVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
1099 if (mode != NotMapped && m_mode == NotMapped) {
1101 - *numBytes = m_buffer->size;
1105 *bytesPerLine = m_bytesPerLine;
1108 +#if GST_CHECK_VERSION(1,0,0)
1109 + gst_buffer_map(m_buffer, &m_mapInfo, GST_MAP_READ);
1111 + *numBytes = m_mapInfo.size;
1113 + return m_mapInfo.data;
1116 + *numBytes = m_buffer->size;
1118 return m_buffer->data;
1124 void QGstVideoBuffer::unmap()
1126 +#if GST_CHECK_VERSION(1,0,0)
1127 + if (m_mode != NotMapped)
1128 + gst_buffer_unmap(m_buffer, &m_mapInfo);
1133 diff --git a/src/gsttools/qvideosurfacegstsink.cpp b/src/gsttools/qvideosurfacegstsink.cpp
1134 index 81d5f60..51c4107 100644
1135 --- a/src/gsttools/qvideosurfacegstsink.cpp
1136 +++ b/src/gsttools/qvideosurfacegstsink.cpp
1139 #include "qvideosurfacegstsink_p.h"
1141 -//#define DEBUG_VIDEO_SURFACE_SINK
1142 +#if GST_VERSION_MAJOR >=1
1143 +#include <gst/video/video.h>
1146 +#define DEBUG_VIDEO_SURFACE_SINK
1150 @@ -71,10 +75,12 @@ QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(
1152 foreach (QObject *instance, bufferPoolLoader()->instances(QGstBufferPoolPluginKey)) {
1153 QGstBufferPoolInterface* plugin = qobject_cast<QGstBufferPoolInterface*>(instance);
1156 m_pools.append(plugin);
1160 updateSupportedFormats();
1161 connect(m_surface, SIGNAL(supportedFormatsChanged()), this, SLOT(updateSupportedFormats()));
1163 @@ -208,6 +214,8 @@ GstFlowReturn QVideoSurfaceGstDelegate::render(GstBuffer *buffer)
1164 if (QThread::currentThread() == thread()) {
1165 if (!m_surface.isNull())
1166 m_surface->present(m_frame);
1168 + qWarning() << "m_surface.isNull().";
1170 QMetaObject::invokeMethod(this, "queuedRender", Qt::QueuedConnection);
1171 m_renderCondition.wait(&m_mutex, 300);
1172 @@ -310,6 +318,27 @@ void QVideoSurfaceGstDelegate::updateSupportedFormats()
1176 +#if GST_CHECK_VERSION(1,0,0)
1179 + QVideoFrame::PixelFormat pixelFormat;
1180 + GstVideoFormat vfmt;
1185 +static const YuvFormat qt_yuvColorLookup[] =
1187 + { QVideoFrame::Format_YUV420P, GST_VIDEO_FORMAT_I420, GST_MAKE_FOURCC('I','4','2','0'), 8 },
1188 + { QVideoFrame::Format_YV12, GST_VIDEO_FORMAT_YV12, GST_MAKE_FOURCC('Y','V','1','2'), 8 },
1189 + { QVideoFrame::Format_UYVY, GST_VIDEO_FORMAT_UYVY, GST_MAKE_FOURCC('U','Y','V','Y'), 16 },
1190 + { QVideoFrame::Format_YUYV, GST_VIDEO_FORMAT_YUY2, GST_MAKE_FOURCC('Y','U','Y','2'), 16 },
1191 + { QVideoFrame::Format_NV12, GST_VIDEO_FORMAT_NV12, GST_MAKE_FOURCC('N','V','1','2'), 8 },
1192 + { QVideoFrame::Format_NV21, GST_VIDEO_FORMAT_NV21, GST_MAKE_FOURCC('N','V','2','1'), 8 },
1193 + { QVideoFrame::Format_AYUV444, GST_VIDEO_FORMAT_AYUV, GST_MAKE_FOURCC('A','Y','U','V'), 32 },
1199 QVideoFrame::PixelFormat pixelFormat;
1200 @@ -327,6 +356,7 @@ static const YuvFormat qt_yuvColorLookup[] =
1201 { QVideoFrame::Format_NV21, GST_MAKE_FOURCC('N','V','2','1'), 8 },
1202 { QVideoFrame::Format_AYUV444, GST_MAKE_FOURCC('A','Y','U','V'), 32 }
1206 static int indexOfYuvColor(QVideoFrame::PixelFormat format)
1208 @@ -339,12 +369,20 @@ static int indexOfYuvColor(QVideoFrame::PixelFormat format)
1212 +#if GST_VERSION_MAJOR >=1
1213 +static int indexOfYuvColor(GstVideoFormat vfmt)
1215 static int indexOfYuvColor(guint32 fourcc)
1218 const int count = sizeof(qt_yuvColorLookup) / sizeof(YuvFormat);
1220 for (int i = 0; i < count; ++i)
1221 +#if GST_VERSION_MAJOR >=1
1222 + if (qt_yuvColorLookup[i].vfmt == vfmt)
1224 if (qt_yuvColorLookup[i].fourcc == fourcc)
1229 @@ -417,13 +455,13 @@ GType QVideoSurfaceGstSink::get_type()
1231 static const GTypeInfo info =
1233 - sizeof(QVideoSurfaceGstSinkClass), // class_size
1234 + sizeof(QVideoSurfaceGstSinkClass), // class_size
1235 base_init, // base_init
1236 NULL, // base_finalize
1237 class_init, // class_init
1238 NULL, // class_finalize
1240 - sizeof(QVideoSurfaceGstSink), // instance_size
1241 + sizeof(QVideoSurfaceGstSink), // instance_size
1243 instance_init, // instance_init
1245 @@ -445,7 +483,11 @@ void QVideoSurfaceGstSink::class_init(gpointer g_class, gpointer class_data)
1246 GstBaseSinkClass *base_sink_class = reinterpret_cast<GstBaseSinkClass *>(g_class);
1247 base_sink_class->get_caps = QVideoSurfaceGstSink::get_caps;
1248 base_sink_class->set_caps = QVideoSurfaceGstSink::set_caps;
1250 +#if GST_CHECK_VERSION(1,0,0)
1252 base_sink_class->buffer_alloc = QVideoSurfaceGstSink::buffer_alloc;
1254 base_sink_class->start = QVideoSurfaceGstSink::start;
1255 base_sink_class->stop = QVideoSurfaceGstSink::stop;
1256 // base_sink_class->unlock = QVideoSurfaceGstSink::unlock; // Not implemented.
1257 @@ -464,6 +506,18 @@ void QVideoSurfaceGstSink::base_init(gpointer g_class)
1259 static GstStaticPadTemplate sink_pad_template = GST_STATIC_PAD_TEMPLATE(
1260 "sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS(
1261 +#if GST_CHECK_VERSION(1,0,0)
1263 + "format = (string) RGBA,"
1264 + "framerate = (fraction) [ 0, MAX ], "
1265 + "width = (int) [ 1, MAX ], "
1266 + "height = (int) [ 1, MAX ]; "
1268 + "format = (string) I420,"
1269 + "framerate = (fraction) [ 0, MAX ], "
1270 + "width = (int) [ 1, MAX ], "
1271 + "height = (int) [ 1, MAX ]"));
1274 "framerate = (fraction) [ 0, MAX ], "
1275 "width = (int) [ 1, MAX ], "
1276 @@ -472,6 +526,7 @@ void QVideoSurfaceGstSink::base_init(gpointer g_class)
1277 "framerate = (fraction) [ 0, MAX ], "
1278 "width = (int) [ 1, MAX ], "
1279 "height = (int) [ 1, MAX ]"));
1282 gst_element_class_add_pad_template(
1283 GST_ELEMENT_CLASS(g_class), gst_static_pad_template_get(&sink_pad_template));
1284 @@ -520,7 +575,11 @@ GstStateChangeReturn QVideoSurfaceGstSink::change_state(
1285 element, transition);
1288 -GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base)
1289 +GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base
1290 +#if GST_CHECK_VERSION(1,0,0)
1291 + , GstCaps* /*filterCaps*/
1297 @@ -533,6 +592,7 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base)
1298 QList<QVideoFrame::PixelFormat> poolHandleFormats;
1299 sink->delegate->poolMutex()->lock();
1300 QGstBufferPoolInterface *pool = sink->delegate->pool();
1303 poolHandleFormats = sink->delegate->supportedPixelFormats(pool->handleType());
1304 sink->delegate->poolMutex()->unlock();
1305 @@ -548,11 +608,19 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base)
1308 gst_caps_append_structure(caps, gst_structure_new(
1309 +#if GST_CHECK_VERSION(1,0,0)
1314 "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, INT_MAX, 1,
1315 "width" , GST_TYPE_INT_RANGE, 1, INT_MAX,
1316 "height" , GST_TYPE_INT_RANGE, 1, INT_MAX,
1317 - "format" , GST_TYPE_FOURCC, qt_yuvColorLookup[index].fourcc,
1318 +#if GST_CHECK_VERSION(1,0,0)
1319 + "format" , G_TYPE_STRING, gst_video_format_to_string(qt_yuvColorLookup[index].vfmt),
1321 + "format" , G_TYPE_STRING, qt_yuvColorLookup[index].fourcc,
1326 @@ -562,7 +630,18 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base)
1327 for (int i = 0; i < count; ++i) {
1328 if (qt_rgbColorLookup[i].pixelFormat == format) {
1329 GstStructure *structure = gst_structure_new(
1330 +#if GST_CHECK_VERSION(1,0,0)
1332 + "format" , G_TYPE_STRING, gst_video_format_to_string(gst_video_format_from_masks(qt_rgbColorLookup[i].depth,
1333 + qt_rgbColorLookup[i].bitsPerPixel,
1334 + qt_rgbColorLookup[i].endianness,
1335 + qt_rgbColorLookup[i].red,
1336 + qt_rgbColorLookup[i].green,
1337 + qt_rgbColorLookup[i].blue,
1338 + qt_rgbColorLookup[i].alpha)),
1342 "framerate" , GST_TYPE_FRACTION_RANGE, 0, 1, INT_MAX, 1,
1343 "width" , GST_TYPE_INT_RANGE, 1, INT_MAX,
1344 "height" , GST_TYPE_INT_RANGE, 1, INT_MAX,
1345 @@ -583,6 +662,7 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base)
1349 +// printf("get Caps %"GST_PTR_FORMAT"\n", caps);
1353 @@ -622,7 +702,7 @@ gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps)
1354 sink->lastRequestedCaps = 0;
1356 #ifdef DEBUG_VIDEO_SURFACE_SINK
1357 - qDebug() << "Staring video surface, format:";
1358 + qDebug() << "Starting video surface, format:";
1360 qDebug() << "bytesPerLine:" << bytesPerLine;
1362 @@ -647,11 +727,49 @@ QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *byte
1363 gst_structure_get_int(structure, "width", &size.rwidth());
1364 gst_structure_get_int(structure, "height", &size.rheight());
1366 +#if GST_CHECK_VERSION(1, 0, 0)
1367 + GstVideoInfo info;
1368 + gst_video_info_from_caps(&info, caps);
1370 + if (info.finfo->format == GST_VIDEO_FORMAT_I420) {
1371 + int index = indexOfYuvColor(GST_VIDEO_FORMAT_I420);
1373 + if (index != -1) {
1374 + pixelFormat = qt_yuvColorLookup[index].pixelFormat;
1375 + bitsPerPixel = qt_yuvColorLookup[index].bitsPerPixel;
1377 + } else if (info.finfo->format == GST_VIDEO_FORMAT_RGBx) {
1379 + int endianness = 0;
1385 + gst_structure_get_int(structure, "bpp", &bitsPerPixel);
1386 + gst_structure_get_int(structure, "depth", &depth);
1387 + gst_structure_get_int(structure, "endianness", &endianness);
1388 + gst_structure_get_int(structure, "red_mask", &red);
1389 + gst_structure_get_int(structure, "green_mask", &green);
1390 + gst_structure_get_int(structure, "blue_mask", &blue);
1391 + gst_structure_get_int(structure, "alpha_mask", &alpha);
1393 + int index = indexOfRgbColor(bitsPerPixel, depth, endianness, red, green, blue, alpha);
1394 + printf("INDEX %x\n", index);
1396 + pixelFormat = qt_rgbColorLookup[index].pixelFormat;
1400 if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-yuv") == 0) {
1402 +#if GST_CHECK_VERSION(1, 0, 0)
1403 + int index = indexOfYuvColor(gst_video_format_from_string(gst_structure_get_string(structure, "format")));
1405 gst_structure_get_fourcc(structure, "format", &fourcc);
1407 int index = indexOfYuvColor(fourcc);
1410 pixelFormat = qt_yuvColorLookup[index].pixelFormat;
1411 bitsPerPixel = qt_yuvColorLookup[index].bitsPerPixel;
1412 @@ -677,6 +795,7 @@ QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *byte
1414 pixelFormat = qt_rgbColorLookup[index].pixelFormat;
1418 if (pixelFormat != QVideoFrame::Format_Invalid) {
1419 QVideoSurfaceFormat format(size, pixelFormat, handleType);
1420 @@ -773,7 +892,11 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc(
1424 +#if GST_CHECK_VERSION(1,0,0)
1425 + GstCaps *intersection = gst_caps_intersect(get_caps(GST_BASE_SINK(sink), NULL), caps);
1427 GstCaps *intersection = gst_caps_intersect(get_caps(GST_BASE_SINK(sink)), caps);
1430 if (gst_caps_is_empty (intersection)) {
1431 gst_caps_unref(intersection);
1432 @@ -814,7 +937,7 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc(
1433 QVideoSurfaceFormat surfaceFormat = sink->delegate->surfaceFormat();
1435 if (!pool->isFormatSupported(surfaceFormat)) {
1436 - //qDebug() << "sink doesn't support native pool format, skip custom buffers allocation";
1437 + qDebug() << "sink doesn't support native pool format, skip custom buffers allocation";
1441 @@ -838,7 +961,6 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc(
1442 gboolean QVideoSurfaceGstSink::start(GstBaseSink *base)
1449 @@ -864,8 +986,9 @@ gboolean QVideoSurfaceGstSink::event(GstBaseSink *base, GstEvent *event)
1451 sink->delegate->setLastPrerolledBuffer(0);
1455 +#if GST_CHECK_VERSION(1, 0, 0)
1456 + return GST_BASE_SINK_CLASS (sink_parent_class)->event (base, event);
1460 GstFlowReturn QVideoSurfaceGstSink::preroll(GstBaseSink *base, GstBuffer *buffer)
1461 diff --git a/src/multimedia/gsttools_headers/qgstappsrc_p.h b/src/multimedia/gsttools_headers/qgstappsrc_p.h
1462 index bfb038e..a188e18 100644
1463 --- a/src/multimedia/gsttools_headers/qgstappsrc_p.h
1464 +++ b/src/multimedia/gsttools_headers/qgstappsrc_p.h
1467 #include <gst/gst.h>
1468 #include <gst/app/gstappsrc.h>
1470 +#if GST_VERSION_MAJOR < 1
1471 #include <gst/app/gstappbuffer.h>
1476 diff --git a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
1477 index 71ea2ff..879f071 100644
1478 --- a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
1479 +++ b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
1480 @@ -55,8 +55,11 @@ class QGstreamerAudioProbeControl : public QMediaAudioProbeControl
1482 explicit QGstreamerAudioProbeControl(QObject *parent);
1483 virtual ~QGstreamerAudioProbeControl();
1485 +#if GST_CHECK_VERSION(1,0,0)
1486 + void bufferProbed(GstBuffer* buffer, GstCaps* caps);
1488 void bufferProbed(GstBuffer* buffer);
1492 void bufferProbed();
1493 diff --git a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
1494 index c512b48..0a8a654 100644
1495 --- a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
1496 +++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
1497 @@ -56,7 +56,11 @@ public:
1498 explicit QGstreamerVideoProbeControl(QObject *parent);
1499 virtual ~QGstreamerVideoProbeControl();
1501 +#if GST_CHECK_VERSION(1,0,0)
1502 + void bufferProbed(GstBuffer* buffer, GstCaps*);
1504 void bufferProbed(GstBuffer* buffer);
1506 void startFlushing();
1507 void stopFlushing();
1509 diff --git a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
1510 index 45582d6..4440337 100644
1511 --- a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
1512 +++ b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
1513 @@ -112,7 +112,11 @@ private slots:
1514 void updateNativeVideoSize();
1517 +#if GST_CHECK_VERSION(1,0,0)
1518 + static GstPadProbeReturn padBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data);
1520 static void padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
1523 GstElement *m_videoSink;
1525 diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h
1526 index eea1e15..6369df7 100644
1527 --- a/src/multimedia/gsttools_headers/qgstutils_p.h
1528 +++ b/src/multimedia/gsttools_headers/qgstutils_p.h
1529 @@ -70,7 +70,11 @@ namespace QGstUtils {
1530 QSize capsResolution(const GstCaps *caps);
1531 QSize capsCorrectedResolution(const GstCaps *caps);
1532 QAudioFormat audioFormatForCaps(const GstCaps *caps);
1533 +#if GST_CHECK_VERSION(1,0,0)
1534 + QAudioFormat audioFormatForSample(GstSample *sample);
1536 QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
1538 GstCaps *capsForAudioFormat(QAudioFormat format);
1539 void initializeGst();
1540 QMultimedia::SupportEstimate hasSupport(const QString &mimeType,
1541 diff --git a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
1542 index 505a6c6..9bde1e0 100644
1543 --- a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
1544 +++ b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
1545 @@ -79,6 +79,9 @@ private:
1549 +#if GST_CHECK_VERSION(1,0,0)
1550 + GstMapInfo m_mapInfo;
1555 diff --git a/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h b/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
1556 index 7563f06..505ff39 100644
1557 --- a/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
1558 +++ b/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
1559 @@ -146,7 +146,11 @@ private:
1561 static GstStateChangeReturn change_state(GstElement *element, GstStateChange transition);
1563 - static GstCaps *get_caps(GstBaseSink *sink);
1564 + static GstCaps *get_caps(GstBaseSink *sink
1565 +#if GST_CHECK_VERSION(1,0,0)
1566 + , GstCaps* /*filterCaps*/
1569 static gboolean set_caps(GstBaseSink *sink, GstCaps *caps);
1571 static GstFlowReturn buffer_alloc(
1572 diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp
1573 index e6d2421..00291ab 100644
1574 --- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp
1575 +++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecoderserviceplugin.cpp
1576 @@ -82,29 +82,42 @@ void QGstreamerAudioDecoderServicePlugin::updateSupportedMimeTypes() const
1577 gst_init(NULL, NULL);
1579 GList *plugins, *orig_plugins;
1580 +#if GST_CHECK_VERSION(1,0,0)
1581 + orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get());
1583 orig_plugins = plugins = gst_default_registry_get_plugin_list ();
1587 GList *features, *orig_features;
1589 GstPlugin *plugin = (GstPlugin *) (plugins->data);
1590 plugins = g_list_next (plugins);
1592 +#if GST_CHECK_VERSION(1,0,0)
1593 + if (GST_OBJECT_FLAG_IS_SET(plugin, GST_PLUGIN_FLAG_BLACKLISTED))
1596 if (plugin->flags & (1<<1)) //GST_PLUGIN_FLAG_BLACKLISTED
1599 - orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get_default (),
1600 - plugin->desc.name);
1602 + orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get (),
1603 + gst_plugin_get_name(plugin));
1605 if (!G_UNLIKELY(features->data == NULL)) {
1606 GstPluginFeature *feature = GST_PLUGIN_FEATURE(features->data);
1607 if (GST_IS_ELEMENT_FACTORY (feature)) {
1608 GstElementFactory *factory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(feature));
1610 - && factory->numpadtemplates > 0
1611 + && gst_element_factory_get_num_pad_templates(factory) > 0
1612 +#if GST_CHECK_VERSION(1,0,0)
1613 + && (qstrcmp(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS), "Codec/Decoder/Audio") == 0
1614 + || qstrcmp(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS), "Codec/Demux") == 0 )
1616 && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0
1617 - || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )) {
1618 - const GList *pads = factory->staticpadtemplates;
1619 + || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )
1622 + const GList *pads = gst_element_factory_get_static_pad_templates(factory);
1624 GstStaticPadTemplate *padtemplate = (GstStaticPadTemplate*)(pads->data);
1625 pads = g_list_next (pads);
1626 diff --git a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
1627 index 9f1a765..dd6bd02 100644
1628 --- a/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
1629 +++ b/src/plugins/gstreamer/audiodecoder/qgstreameraudiodecodersession.cpp
1630 @@ -454,21 +454,40 @@ QAudioBuffer QGstreamerAudioDecoderSession::read()
1631 if (buffersAvailable == 1)
1632 emit bufferAvailableChanged(false);
1634 + const char* bufferData = 0;
1635 + int bufferSize = 0;
1637 +#if GST_CHECK_VERSION(1,0,0)
1638 + GstSample *sample = gst_app_sink_pull_sample(m_appSink);
1639 + GstBuffer *buffer = gst_sample_get_buffer(sample);
1640 + GstMapInfo mapInfo;
1641 + gst_buffer_map(buffer, &mapInfo, GST_MAP_READ);
1642 + bufferData = (const char*)mapInfo.data;
1643 + bufferSize = mapInfo.size;
1644 + QAudioFormat format = QGstUtils::audioFormatForSample(sample);
1646 GstBuffer *buffer = gst_app_sink_pull_buffer(m_appSink);
1648 + bufferData = (const char*)buffer->data;
1649 + bufferSize = buffer->size;
1650 QAudioFormat format = QGstUtils::audioFormatForBuffer(buffer);
1653 if (format.isValid()) {
1654 // XXX At the moment we have to copy data from GstBuffer into QAudioBuffer.
1655 // We could improve performance by implementing QAbstractAudioBuffer for GstBuffer.
1656 qint64 position = getPositionFromBuffer(buffer);
1657 - audioBuffer = QAudioBuffer(QByteArray((const char*)buffer->data, buffer->size), format, position);
1658 + audioBuffer = QAudioBuffer(QByteArray((const char*)bufferData, bufferSize), format, position);
1659 position /= 1000; // convert to milliseconds
1660 if (position != m_position) {
1661 m_position = position;
1662 emit positionChanged(m_position);
1665 +#if GST_CHECK_VERSION(1,0,0)
1666 + gst_sample_unref(sample);
1668 gst_buffer_unref(buffer);
1673 @@ -539,7 +558,12 @@ void QGstreamerAudioDecoderSession::addAppSink()
1675 GstAppSinkCallbacks callbacks;
1676 memset(&callbacks, 0, sizeof(callbacks));
1677 +#if GST_CHECK_VERSION(1,0,0)
1678 + // ### Should perhaps also rename new_buffer to new_sample.
1679 + callbacks.new_sample = &new_buffer;
1681 callbacks.new_buffer = &new_buffer;
1683 gst_app_sink_set_callbacks(m_appSink, &callbacks, this, NULL);
1684 gst_app_sink_set_max_buffers(m_appSink, MAX_BUFFERS_IN_QUEUE);
1685 gst_base_sink_set_sync(GST_BASE_SINK(m_appSink), FALSE);
1686 @@ -565,8 +589,13 @@ void QGstreamerAudioDecoderSession::updateDuration()
1687 gint64 gstDuration = 0;
1690 +#if GST_CHECK_VERSION(1,0,0)
1691 + if (m_playbin && gst_element_query_duration(m_playbin, format, &gstDuration))
1692 + duration = gstDuration / 1000000;
1694 if (m_playbin && gst_element_query_duration(m_playbin, &format, &gstDuration))
1695 duration = gstDuration / 1000000;
1698 if (m_duration != duration) {
1699 m_duration = duration;
1700 diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
1701 index 6e3448f..0dbf848 100644
1702 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
1703 +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
1704 @@ -726,7 +726,11 @@ qint64 CameraBinSession::duration() const
1705 GstFormat format = GST_FORMAT_TIME;
1706 gint64 duration = 0;
1708 +#if GST_CHECK_VERSION(1,0,0)
1709 + if ( m_camerabin && gst_element_query_duration(m_camerabin, format, &duration))
1711 if ( m_camerabin && gst_element_query_position(m_camerabin, &format, &duration))
1713 return duration / 1000000;
1716 @@ -759,8 +763,13 @@ void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data)
1719 GstIterator *elements = gst_bin_iterate_all_by_interface(GST_BIN(m_camerabin), GST_TYPE_TAG_SETTER);
1720 +#if GST_CHECK_VERSION(1,0,0)
1721 + GValue *element = 0;
1722 + while (gst_iterator_next(elements, element) == GST_ITERATOR_OK) {
1724 GstElement *element = 0;
1725 while (gst_iterator_next(elements, (void**)&element) == GST_ITERATOR_OK) {
1727 gst_tag_setter_reset_tags(GST_TAG_SETTER(element));
1729 QMapIterator<QByteArray, QVariant> it(data);
1730 @@ -821,7 +830,11 @@ bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message)
1732 if (gm && GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) {
1733 if (m_captureMode == QCamera::CaptureStillImage &&
1734 +#if GST_CHECK_VERSION(1,0,0)
1735 + gst_message_has_name (gm, "preview-image")) {
1737 gst_structure_has_name(gm->structure, "preview-image")) {
1739 st = gst_message_get_structure(gm);
1741 if (gst_structure_has_field_typed(st, "buffer", GST_TYPE_BUFFER)) {
1742 @@ -831,7 +844,11 @@ bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message)
1746 +#if GST_CHECK_VERSION(1,0,0)
1747 GstCaps *caps = gst_buffer_get_caps(buffer);
1749 + GstCaps *caps = gst_buffer_get_caps(buffer);
1752 GstStructure *structure = gst_caps_get_structure(caps, 0);
1754 @@ -1103,7 +1120,11 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame
1755 gst_structure_remove_all_fields(structure);
1756 gst_structure_set_value(structure, "framerate", &rate);
1758 +#if GST_CHECK_VERSION(1,0,0)
1759 + caps = gst_caps_simplify(caps);
1761 gst_caps_do_simplify(caps);
1765 for (uint i=0; i<gst_caps_get_size(caps); i++) {
1766 @@ -1223,7 +1244,11 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
1767 gst_structure_set_value(structure, "width", &w);
1768 gst_structure_set_value(structure, "height", &h);
1770 +#if GST_CHECK_VERSION(1,0,0)
1771 + caps = gst_caps_simplify(caps);
1773 gst_caps_do_simplify(caps);
1776 for (uint i=0; i<gst_caps_get_size(caps); i++) {
1777 GstStructure *structure = gst_caps_get_structure(caps, i);
1778 diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri
1779 index 8b421b8..2e7f746 100644
1780 --- a/src/plugins/gstreamer/common.pri
1781 +++ b/src/plugins/gstreamer/common.pri
1782 @@ -12,14 +12,17 @@ LIBS += -lqgsttools_p
1783 CONFIG += link_pkgconfig
1787 - gstreamer-base-0.10 \
1788 - gstreamer-interfaces-0.10 \
1789 - gstreamer-audio-0.10 \
1790 - gstreamer-video-0.10 \
1791 - gstreamer-pbutils-0.10
1792 + gstreamer-$$GST_VERSION \
1793 + gstreamer-base-$$GST_VERSION \
1794 + gstreamer-audio-$$GST_VERSION \
1795 + gstreamer-video-$$GST_VERSION \
1796 + gstreamer-pbutils-$$GST_VERSION
1798 -maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10
1799 +maemo*:PKGCONFIG +=gstreamer-plugins-bad-$$GST_VERSION
1802 + DEFINES += HAVE_MIR
1805 config_resourcepolicy {
1806 DEFINES += HAVE_RESOURCE_POLICY
1807 @@ -27,8 +30,8 @@ config_resourcepolicy {
1810 config_gstreamer_appsrc {
1811 - PKGCONFIG += gstreamer-app-0.10
1812 + PKGCONFIG += gstreamer-app-$$GST_VERSION
1813 DEFINES += HAVE_GST_APPSRC
1814 - LIBS += -lgstapp-0.10
1815 + LIBS += -lgstapp-$$GST_VERSION
1818 diff --git a/src/plugins/gstreamer/gstreamer.pro b/src/plugins/gstreamer/gstreamer.pro
1819 index 7649010..fce55ac 100644
1820 --- a/src/plugins/gstreamer/gstreamer.pro
1821 +++ b/src/plugins/gstreamer/gstreamer.pro
1822 @@ -2,11 +2,10 @@ TEMPLATE = subdirs
1829 config_gstreamer_encodingprofiles {
1830 - SUBDIRS += camerabin
1831 +# SUBDIRS += camerabin
1835 diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
1836 index 518a66b..0c99502 100644
1837 --- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
1838 +++ b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
1839 @@ -504,6 +504,11 @@ GstElement *QGstreamerCaptureSession::buildImageCapture()
1840 gst_pad_add_buffer_probe(pad, G_CALLBACK(passImageFilter), this);
1841 gst_object_unref(GST_OBJECT(pad));
1843 +#if GST_CHECK_VERSION(1,0,0)
1844 + gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, passImageFilter, this);
1846 + gst_pad_add_buffer_probe(pad, G_CALLBACK(passImageFilter), this);
1848 g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL);
1849 g_signal_connect(G_OBJECT(sink), "handoff",
1850 G_CALLBACK(saveImageFilter), this);
1851 diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro
1852 index 2ca9377..b986fc7 100644
1853 --- a/src/plugins/gstreamer/mediaplayer/mediaplayer.pro
1854 +++ b/src/plugins/gstreamer/mediaplayer/mediaplayer.pro
1855 @@ -28,4 +28,3 @@ SOURCES += \
1860 diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
1861 index ff99aa3..f9de6a7 100644
1862 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
1863 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
1864 @@ -527,6 +527,8 @@ void QGstreamerPlayerControl::processEOS()
1865 m_session->showPrerollFrames(false); // stop showing prerolled frames in stop state
1868 + qWarning() << "Processing EOS!";
1870 popAndNotifyState();
1873 diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
1874 index 854da46..2fd4345 100644
1875 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
1876 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
1878 #include <private/qgstreamervideorenderer_p.h>
1880 #if defined(Q_WS_MAEMO_6) && defined(__arm__)
1881 -#include "qgstreamergltexturerenderer.h"
1882 +#include "private/qgstreamergltexturerenderer.h"
1885 +#if defined(HAVE_MIR) && defined (__arm__)
1886 +#include "private/qgstreamermirtexturerenderer_p.h"
1889 #include "qgstreamerstreamscontrol.h"
1890 @@ -90,6 +94,9 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
1892 #if defined(Q_WS_MAEMO_6) && defined(__arm__)
1893 m_videoRenderer = new QGstreamerGLTextureRenderer(this);
1894 +#elif defined(HAVE_MIR) && defined (__arm__)
1895 + //m_videoRenderer = new QGstreamerVideoRenderer(this);
1896 + m_videoRenderer = new QGstreamerMirTextureRenderer(this, m_session);
1898 m_videoRenderer = new QGstreamerVideoRenderer(this);
1900 diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp
1901 index a9052ca..7968799 100644
1902 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp
1903 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp
1904 @@ -95,7 +95,11 @@ void QGstreamerPlayerServicePlugin::updateSupportedMimeTypes() const
1905 gst_init(NULL, NULL);
1907 GList *plugins, *orig_plugins;
1908 +#if GST_CHECK_VERSION(1,0,0)
1909 + orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get());
1911 orig_plugins = plugins = gst_default_registry_get_plugin_list ();
1915 GList *features, *orig_features;
1916 @@ -103,22 +107,33 @@ void QGstreamerPlayerServicePlugin::updateSupportedMimeTypes() const
1917 GstPlugin *plugin = (GstPlugin *) (plugins->data);
1918 plugins = g_list_next (plugins);
1920 +#if GST_CHECK_VERSION(1,0,0)
1921 + if (GST_OBJECT_FLAG_IS_SET(plugin, GST_PLUGIN_FLAG_BLACKLISTED))
1924 if (plugin->flags & (1<<1)) //GST_PLUGIN_FLAG_BLACKLISTED
1928 - orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get_default (),
1929 - plugin->desc.name);
1930 + orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get(),
1931 + gst_plugin_get_name(plugin));
1933 if (!G_UNLIKELY(features->data == NULL)) {
1934 GstPluginFeature *feature = GST_PLUGIN_FEATURE(features->data);
1935 if (GST_IS_ELEMENT_FACTORY (feature)) {
1936 GstElementFactory *factory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(feature));
1938 - && factory->numpadtemplates > 0
1939 - && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0
1940 +#if GST_CHECK_VERSION(1,0,0)
1941 + && (qstrcmp(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS), "Codec/Decoder/Audio") == 0
1942 + || qstrcmp(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS),"Codec/Decoder/Video") == 0
1943 + || qstrcmp(gst_element_factory_get_metadata(factory, GST_ELEMENT_METADATA_KLASS), "Codec/Demux") == 0 )
1945 + && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0
1946 || qstrcmp(factory->details.klass, "Codec/Decoder/Video") == 0
1947 - || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )) {
1948 - const GList *pads = factory->staticpadtemplates;
1949 + || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )
1952 + const GList *pads = gst_element_factory_get_static_pad_templates(factory);
1954 GstStaticPadTemplate *padtemplate = (GstStaticPadTemplate*)(pads->data);
1955 pads = g_list_next (pads);
1956 diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
1957 index 87b71d7..03185a2 100644
1958 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
1959 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
1960 @@ -93,6 +93,16 @@ typedef enum {
1961 GST_PLAY_FLAG_BUFFERING = 0x000000100
1964 +#if GST_CHECK_VERSION(1,0,0)
1965 +#define DEFAULT_RAW_CAPS \
1966 + "video/x-surface; " \
1968 + "text/x-pango-markup; " \
1969 + "video/x-dvd-subpicture; " \
1970 + "subpicture/x-pgs" \
1974 #define DEFAULT_RAW_CAPS \
1975 "video/x-raw-yuv; " \
1976 "video/x-raw-rgb; " \
1977 @@ -105,6 +115,8 @@ typedef enum {
1978 "text/x-pango-markup; " \
1979 "video/x-dvd-subpicture; " \
1983 static GstStaticCaps static_RawCaps = GST_STATIC_CAPS(DEFAULT_RAW_CAPS);
1985 QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
1986 @@ -145,8 +157,11 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
1987 gboolean result = gst_type_find_register(0, "playlist", GST_RANK_MARGINAL, playlistTypeFindFunction, 0, 0, this, 0);
1988 Q_ASSERT(result == TRUE);
1991 +#if GST_CHECK_VERSION(1,0,0)
1992 + m_playbin = gst_element_factory_make("playbin", NULL);
1994 m_playbin = gst_element_factory_make("playbin2", NULL);
1998 //GST_PLAY_FLAG_NATIVE_VIDEO omits configuration of ffmpegcolorspace and videoscale,
1999 @@ -196,7 +211,11 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
2000 m_videoIdentity = GST_ELEMENT(g_object_new(gst_video_connector_get_type(), 0)); // floating ref
2001 g_signal_connect(G_OBJECT(m_videoIdentity), "connection-failed", G_CALLBACK(insertColorSpaceElement), (gpointer)this);
2003 +#if GST_CHECK_VERSION(1,0,0)
2004 + m_colorSpace = gst_element_factory_make("videoconvert", "ffmpegcolorspace-vo");
2006 m_colorSpace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-vo");
2008 // might not get a parent, take ownership to avoid leak
2009 qt_gst_object_ref_sink(GST_OBJECT(m_colorSpace));
2011 @@ -214,7 +233,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
2014 GstPad *pad = gst_element_get_static_pad(m_videoIdentity,"sink");
2015 - gst_element_add_pad(GST_ELEMENT(m_videoOutputBin), gst_ghost_pad_new("videosink", pad));
2016 + gst_element_add_pad(GST_ELEMENT(m_videoOutputBin), gst_ghost_pad_new("sink", pad));
2017 gst_object_unref(GST_OBJECT(pad));
2019 if (m_playbin != 0) {
2020 @@ -226,7 +245,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
2021 g_object_set(G_OBJECT(m_playbin), "video-sink", m_videoOutputBin, NULL);
2023 g_signal_connect(G_OBJECT(m_playbin), "notify::source", G_CALLBACK(playbinNotifySource), this);
2024 - g_signal_connect(G_OBJECT(m_playbin), "element-added", G_CALLBACK(handleElementAdded), this);
2025 + //g_signal_connect(G_OBJECT(m_playbin), "element-added", G_CALLBACK(handleElementAdded), this);
2027 if (usePlaybinVolume()) {
2029 @@ -350,9 +369,13 @@ qint64 QGstreamerPlayerSession::position() const
2030 GstFormat format = GST_FORMAT_TIME;
2031 gint64 position = 0;
2033 +#if GST_CHECK_VERSION(1,0,0)
2034 + if ( m_playbin && gst_element_query_position(m_playbin, format, &position))
2035 + m_lastPosition = position / 1000000;
2037 if ( m_playbin && gst_element_query_position(m_playbin, &format, &position))
2038 m_lastPosition = position / 1000000;
2041 return m_lastPosition;
2044 @@ -482,9 +505,18 @@ bool QGstreamerPlayerSession::isAudioAvailable() const
2045 return m_audioAvailable;
2048 +#if GST_CHECK_VERSION(1,0,0)
2049 +static GstPadProbeReturn block_pad_cb(GstPad *pad, GstPadProbeInfo *info, gpointer user_data)
2051 static void block_pad_cb(GstPad *pad, gboolean blocked, gpointer user_data)
2055 +#if GST_CHECK_VERSION(1,0,0)
2057 + Q_UNUSED(user_data);
2058 + return GST_PAD_PROBE_OK;
2060 #ifdef DEBUG_PLAYBIN
2061 qDebug() << "block_pad_cb, blocked:" << blocked;
2063 @@ -493,6 +525,7 @@ static void block_pad_cb(GstPad *pad, gboolean blocked, gpointer user_data)
2064 QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession*>(user_data);
2065 QMetaObject::invokeMethod(session, "finishVideoOutputChange", Qt::QueuedConnection);
2070 void QGstreamerPlayerSession::updateVideoRenderer()
2071 @@ -537,7 +570,7 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput)
2072 m_renderer = renderer;
2074 #ifdef DEBUG_VO_BIN_DUMP
2075 - _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
2076 + gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
2077 GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
2080 @@ -641,7 +674,11 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput)
2082 //block pads, async to avoid locking in paused state
2083 GstPad *srcPad = gst_element_get_static_pad(m_videoIdentity, "src");
2084 +#if GST_CHECK_VERSION(1,0,0)
2085 + this->pad_probe_id = gst_pad_add_probe(srcPad, (GstPadProbeType)(GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BLOCK), block_pad_cb, this, NULL);
2087 gst_pad_set_blocked_async(srcPad, true, &block_pad_cb, this);
2089 gst_object_unref(GST_OBJECT(srcPad));
2091 //Unpause the sink to avoid waiting until the buffer is processed
2092 @@ -682,7 +719,11 @@ void QGstreamerPlayerSession::finishVideoOutputChange()
2093 //video output was change back to the current one,
2094 //no need to torment the pipeline, just unblock the pad
2095 if (gst_pad_is_blocked(srcPad))
2096 +#if GST_CHECK_VERSION(1,0,0)
2097 + gst_pad_remove_probe(srcPad, this->pad_probe_id);
2099 gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0);
2102 m_pendingVideoSink = 0;
2103 gst_object_unref(GST_OBJECT(srcPad));
2104 @@ -768,12 +809,17 @@ void QGstreamerPlayerSession::finishVideoOutputChange()
2106 //don't have to wait here, it will unblock eventually
2107 if (gst_pad_is_blocked(srcPad))
2108 - gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0);
2109 +#if GST_CHECK_VERSION(1,0,0)
2110 + gst_pad_remove_probe(srcPad, this->pad_probe_id);
2112 + gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0);
2115 gst_object_unref(GST_OBJECT(srcPad));
2117 #ifdef DEBUG_VO_BIN_DUMP
2118 - _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
2119 - GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
2120 + gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
2121 + GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* | GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES */),
2125 @@ -838,6 +884,7 @@ bool QGstreamerPlayerSession::play()
2126 #ifdef DEBUG_PLAYBIN
2127 qDebug() << Q_FUNC_INFO;
2130 m_everPlayed = false;
2132 m_pendingState = QMediaPlayer::PlayingState;
2133 @@ -1335,8 +1382,11 @@ void QGstreamerPlayerSession::getStreamsInfo()
2138 +#if GST_CHECK_VERSION(1,0,0)
2139 + if (tags && GST_IS_TAG_LIST(tags)) {
2141 if (tags && gst_is_tag_list(tags)) {
2143 gchar *languageCode = 0;
2144 if (gst_tag_list_get_string(tags, GST_TAG_LANGUAGE_CODE, &languageCode))
2145 streamProperties[QMediaMetaData::Language] = QString::fromUtf8(languageCode);
2146 @@ -1375,7 +1425,11 @@ void QGstreamerPlayerSession::updateVideoResolutionTag()
2149 GstPad *pad = gst_element_get_static_pad(m_videoIdentity, "src");
2150 +#if GST_CHECK_VERSION(1,0,0)
2151 + GstCaps *caps = gst_pad_get_current_caps(pad);
2153 GstCaps *caps = gst_pad_get_negotiated_caps(pad);
2157 const GstStructure *structure = gst_caps_get_structure(caps, 0);
2158 @@ -1419,7 +1473,11 @@ void QGstreamerPlayerSession::updateDuration()
2159 gint64 gstDuration = 0;
2162 +#if GST_CHECK_VERSION(1,0,0)
2163 + if (m_playbin && gst_element_query_duration(m_playbin, format, &gstDuration))
2165 if (m_playbin && gst_element_query_duration(m_playbin, &format, &gstDuration))
2167 duration = gstDuration / 1000000;
2169 if (m_duration != duration) {
2170 @@ -1475,7 +1533,11 @@ void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpo
2173 if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "extra-headers") != 0) {
2174 +#if GST_CHECK_VERSION(1,0,0)
2175 + GstStructure *extras = gst_structure_new_empty("extras");
2177 GstStructure *extras = gst_structure_empty_new("extras");
2180 foreach (const QByteArray &rawHeader, self->m_request.rawHeaderList()) {
2181 if (rawHeader == userAgentString) // Filter User-Agent
2182 @@ -1630,7 +1692,11 @@ GstAutoplugSelectResult QGstreamerPlayerSession::handleAutoplugSelect(GstBin *bi
2183 const gchar *factoryName = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory));
2184 if (g_str_has_prefix(factoryName, "vaapi")) {
2185 GstPad *sinkPad = gst_element_get_static_pad(session->m_videoSink, "sink");
2186 +#if GST_CHECK_VERSION(1,0,0)
2187 + GstCaps *sinkCaps = gst_pad_query_caps(sinkPad, NULL);
2189 GstCaps *sinkCaps = gst_pad_get_caps(sinkPad);
2192 #if (GST_VERSION_MAJOR == 0) && ((GST_VERSION_MINOR < 10) || (GST_VERSION_MICRO < 33))
2193 if (!factory_can_src_any_caps(factory, sinkCaps))
2194 @@ -1659,14 +1725,19 @@ void QGstreamerPlayerSession::handleElementAdded(GstBin *bin, GstElement *elemen
2195 // Disable on-disk buffering.
2196 g_object_set(G_OBJECT(element), "temp-template", NULL, NULL);
2197 } else if (g_str_has_prefix(elementName, "uridecodebin") ||
2198 - g_str_has_prefix(elementName, "decodebin2")) {
2200 +#if GST_CHECK_VERSION(1,0,0)
2201 + g_str_has_prefix(elementName, "decodebin")) {
2203 + g_str_has_prefix(elementName, "decodebin2")) {
2205 if (g_str_has_prefix(elementName, "uridecodebin")) {
2206 // Add video/x-surface (VAAPI) to default raw formats
2207 g_object_set(G_OBJECT(element), "caps", gst_static_caps_get(&static_RawCaps), NULL);
2208 // listen for uridecodebin autoplug-select to skip VAAPI usage when the current
2209 // video sink doesn't support it
2210 +#if !(GST_CHECK_VERSION(1,0,0))
2211 g_signal_connect(element, "autoplug-select", G_CALLBACK(handleAutoplugSelect), session);
2215 //listen for queue2 element added to uridecodebin/decodebin2 as well.
2216 @@ -1734,7 +1805,27 @@ void QGstreamerPlayerSession::removeProbe(QGstreamerVideoProbeControl* probe)
2217 // Assume user releases any outstanding references to video frames.
2220 -gboolean QGstreamerPlayerSession::padVideoBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data)
2221 +#if GST_CHECK_VERSION(1,0,0)
2222 +GstPadProbeReturn QGstreamerPlayerSession::padVideoBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data)
2225 + GstBuffer* buffer = GST_PAD_PROBE_INFO_BUFFER(info);
2227 + QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession*>(user_data);
2228 + QMutexLocker locker(&session->m_videoProbeMutex);
2230 + if (session->m_videoProbes.isEmpty())
2231 + return GST_PAD_PROBE_OK;
2233 + foreach (QGstreamerVideoProbeControl* probe, session->m_videoProbes)
2234 + probe->bufferProbed(buffer, gst_pad_get_current_caps(pad));
2236 + return GST_PAD_PROBE_OK;
2241 +static gboolean QGstreamerPlayerSession::padVideoBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data)
2245 @@ -1749,6 +1840,7 @@ gboolean QGstreamerPlayerSession::padVideoBufferProbe(GstPad *pad, GstBuffer *bu
2251 void QGstreamerPlayerSession::addProbe(QGstreamerAudioProbeControl* probe)
2253 @@ -1766,6 +1858,24 @@ void QGstreamerPlayerSession::removeProbe(QGstreamerAudioProbeControl* probe)
2254 m_audioProbes.removeOne(probe);
2257 +#if GST_CHECK_VERSION(1,0,0)
2258 +GstPadProbeReturn QGstreamerPlayerSession::padAudioBufferProbe(GstPad *pad, GstPadProbeInfo* info, gpointer user_data)
2261 + GstBuffer* buffer = GST_PAD_PROBE_INFO_BUFFER(info);
2263 + QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession*>(user_data);
2264 + QMutexLocker locker(&session->m_audioProbeMutex);
2266 + if (session->m_audioProbes.isEmpty())
2267 + return GST_PAD_PROBE_OK;
2269 + foreach (QGstreamerAudioProbeControl* probe, session->m_audioProbes)
2270 + probe->bufferProbed(buffer, gst_pad_get_current_caps(pad));
2272 + return GST_PAD_PROBE_OK;
2275 gboolean QGstreamerPlayerSession::padAudioBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data)
2278 @@ -1781,7 +1891,7 @@ gboolean QGstreamerPlayerSession::padAudioBufferProbe(GstPad *pad, GstBuffer *bu
2284 // This function is similar to stop(),
2285 // but does not set m_everPlayed, m_lastPosition,
2286 // and setSeekable() values.
2287 @@ -1814,7 +1924,11 @@ void QGstreamerPlayerSession::removeVideoBufferProbe()
2289 GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
2291 +#if GST_CHECK_VERSION(1,0,0)
2292 + gst_pad_remove_probe(pad, m_videoBufferProbeId);
2294 gst_pad_remove_buffer_probe(pad, m_videoBufferProbeId);
2296 gst_object_unref(GST_OBJECT(pad));
2299 @@ -1829,7 +1943,11 @@ void QGstreamerPlayerSession::addVideoBufferProbe()
2301 GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink");
2303 +#if GST_CHECK_VERSION(1,0,0)
2304 + m_videoBufferProbeId = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, padVideoBufferProbe, this, NULL);
2306 m_videoBufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padVideoBufferProbe), this);
2308 gst_object_unref(GST_OBJECT(pad));
2311 @@ -1846,7 +1964,11 @@ void QGstreamerPlayerSession::removeAudioBufferProbe()
2313 GstPad *pad = gst_element_get_static_pad(m_audioSink, "sink");
2315 +#if GST_CHECK_VERSION(1,0,0)
2316 + gst_pad_remove_probe(pad, m_audioBufferProbeId);
2318 gst_pad_remove_buffer_probe(pad, m_audioBufferProbeId);
2320 gst_object_unref(GST_OBJECT(pad));
2323 @@ -1861,7 +1983,11 @@ void QGstreamerPlayerSession::addAudioBufferProbe()
2325 GstPad *pad = gst_element_get_static_pad(m_audioSink, "sink");
2327 +#if GST_CHECK_VERSION(1,0,0)
2328 + m_audioBufferProbeId = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, padAudioBufferProbe, this, NULL);
2330 m_audioBufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padAudioBufferProbe), this);
2332 gst_object_unref(GST_OBJECT(pad));
2335 @@ -1894,7 +2020,7 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint
2336 length = qMin(length, guint64(1024));
2338 while (length > 0) {
2339 - guint8 *data = gst_type_find_peek(find, 0, length);
2340 + const guint8 *data = gst_type_find_peek(find, 0, length);
2342 session->m_isPlaylist = (QPlaylistFileParser::findPlaylistType(QString::fromUtf8(uri), 0, data, length) != QPlaylistFileParser::UNKNOWN);
2344 diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
2345 index 23e7031..707779b 100644
2346 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
2347 +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
2348 @@ -127,11 +127,19 @@ public:
2350 void addProbe(QGstreamerVideoProbeControl* probe);
2351 void removeProbe(QGstreamerVideoProbeControl* probe);
2352 +#if GST_CHECK_VERSION(1,0,0)
2353 + static GstPadProbeReturn padVideoBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data);
2355 static gboolean padVideoBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
2358 void addProbe(QGstreamerAudioProbeControl* probe);
2359 void removeProbe(QGstreamerAudioProbeControl* probe);
2360 +#if GST_CHECK_VERSION(1,0,0)
2361 + static GstPadProbeReturn padAudioBufferProbe(GstPad *pad, GstPadProbeInfo* info, gpointer user_data);
2363 static gboolean padAudioBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
2366 void endOfMediaReset();
2368 @@ -260,6 +268,7 @@ private:
2369 bool m_isLiveSource;
2372 + gulong pad_probe_id;