diff options
| author | Martin Jansa <Martin.Jansa@gmail.com> | 2014-07-05 09:11:41 +0200 |
|---|---|---|
| committer | Martin Jansa <Martin.Jansa@gmail.com> | 2014-07-06 19:45:45 +0200 |
| commit | 9f802b01e54709773e0a070beefb78d8f9d5c01f (patch) | |
| tree | 905c1adcead57bffe1e08630322151bcf54257e8 | |
| parent | 26b7fee65a3c23a9c2447d549668f373bfa76bae (diff) | |
| download | meta-qt5-9f802b01e54709773e0a070beefb78d8f9d5c01f.tar.gz | |
qtmultimedia: Add gstremer-1.0 support
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
3 files changed, 2434 insertions, 7 deletions
diff --git a/recipes-qt/qt5/qtmultimedia.inc b/recipes-qt/qt5/qtmultimedia.inc index 119d61ac..5c075fad 100644 --- a/recipes-qt/qt5/qtmultimedia.inc +++ b/recipes-qt/qt5/qtmultimedia.inc | |||
| @@ -6,16 +6,14 @@ PACKAGECONFIG ??= "" | |||
| 6 | PACKAGECONFIG[openal] = ",,openal-soft" | 6 | PACKAGECONFIG[openal] = ",,openal-soft" |
| 7 | PACKAGECONFIG[gstreamer010] = ",,gstreamer gst-plugins-base" | 7 | PACKAGECONFIG[gstreamer010] = ",,gstreamer gst-plugins-base" |
| 8 | 8 | ||
| 9 | do_configure_prepend() { | ||
| 10 | # disable openal test if it isn't enabled by PACKAGECONFIG | ||
| 11 | sed -i 's/^qtCompileTest(openal)/OE_OPENAL_ENABLED:qtCompileTest(openal)/g' ${S}/qtmultimedia.pro | ||
| 12 | # disable gstreamer-0.10 test if it isn't enabled by PACKAGECONFIG | ||
| 13 | sed -i 's/^\( *\)qtCompileTest(gstreamer) {/\1OE_GSTREAMER010_ENABLED:qtCompileTest(gstreamer) {/g' ${S}/qtmultimedia.pro | ||
| 14 | } | ||
| 15 | |||
| 16 | EXTRA_QMAKEVARS_PRE += "${@base_contains('PACKAGECONFIG', 'openal', 'CONFIG+=OE_OPENAL_ENABLED', '', d)}" | 9 | EXTRA_QMAKEVARS_PRE += "${@base_contains('PACKAGECONFIG', 'openal', 'CONFIG+=OE_OPENAL_ENABLED', '', d)}" |
| 17 | EXTRA_QMAKEVARS_PRE += "${@base_contains('PACKAGECONFIG', 'gstreamer010', 'CONFIG+=OE_GSTREAMER010_ENABLED', '', d)}" | 10 | EXTRA_QMAKEVARS_PRE += "${@base_contains('PACKAGECONFIG', 'gstreamer010', 'CONFIG+=OE_GSTREAMER010_ENABLED', '', d)}" |
| 18 | 11 | ||
| 12 | SRC_URI += "\ | ||
| 13 | file://0001-Initial-porting-effort-to-GStreamer-1.0.patch \ | ||
| 14 | file://0002-qtmultimedia.pro-Respect-OE_GSTREAMER_ENABLED-OE_GST.patch \ | ||
| 15 | " | ||
| 16 | |||
| 19 | # older copyright year than what e.g. qtbase is using now | 17 | # older copyright year than what e.g. qtbase is using now |
| 20 | LIC_FILES_CHKSUM = "file://LICENSE.LGPL;md5=4193e7f1d47a858f6b7c0f1ee66161de \ | 18 | LIC_FILES_CHKSUM = "file://LICENSE.LGPL;md5=4193e7f1d47a858f6b7c0f1ee66161de \ |
| 21 | file://LICENSE.GPL;md5=d32239bcb673463ab874e80d47fae504 \ | 19 | file://LICENSE.GPL;md5=d32239bcb673463ab874e80d47fae504 \ |
diff --git a/recipes-qt/qt5/qtmultimedia/0001-Initial-porting-effort-to-GStreamer-1.0.patch b/recipes-qt/qt5/qtmultimedia/0001-Initial-porting-effort-to-GStreamer-1.0.patch new file mode 100644 index 00000000..98a77b9f --- /dev/null +++ b/recipes-qt/qt5/qtmultimedia/0001-Initial-porting-effort-to-GStreamer-1.0.patch | |||
| @@ -0,0 +1,2378 @@ | |||
| 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. | ||
| 5 | |||
| 6 | Imported from git@github.com:jhodapp/qtmultimedia.git | ||
| 7 | |||
| 8 | Contributions from: | ||
| 9 | Ilya Smelykh <ilya@videoexpertsgroup.com> | ||
| 10 | Jim Hodapp <jim.hodapp@canonical.com> | ||
| 11 | Sergio Schvezov <sergio.schvezov@canonical.com> | ||
| 12 | |||
| 13 | Change-Id: I10fa5e5078efa4564ce833befd417008e26a90a9 | ||
| 14 | Reviewed-by: Yoann Lopes <yoann.lopes@digia.com> | ||
| 15 | (cherry picked from commit d91dac090d92fdbc3a3425e8d969c62e5c79eff9) | ||
| 16 | |||
| 17 | Conflicts: | ||
| 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 | ||
| 24 | --- | ||
| 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(-) | ||
| 62 | |||
| 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 | ||
| 69 | |||
| 70 | PKGCONFIG += \ | ||
| 71 | - gstreamer-0.10 \ | ||
| 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 | ||
| 82 | |||
| 83 | |||
| 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 | ||
| 90 | |||
| 91 | PKGCONFIG += \ | ||
| 92 | - gstreamer-0.10 \ | ||
| 93 | - gstreamer-base-0.10 \ | ||
| 94 | - gstreamer-interfaces-0.10 \ | ||
| 95 | - gstreamer-audio-0.10 \ | ||
| 96 | - gstreamer-video-0.10 \ | ||
| 97 | - gstreamer-app-0.10 | ||
| 98 | - | ||
| 99 | - | ||
| 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 | ||
| 110 | |||
| 111 | CONFIG += link_pkgconfig | ||
| 112 | |||
| 113 | -PKGCONFIG += \ | ||
| 114 | - gstreamer-0.10 \ | ||
| 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 | ||
| 120 | |||
| 121 | +PKGCONFIG += \ | ||
| 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 | ||
| 133 | |||
| 134 | PKGCONFIG += \ | ||
| 135 | - gstreamer-0.10 \ | ||
| 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 | ||
| 141 | - | ||
| 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 | ||
| 148 | + | ||
| 149 | +LIBS += -lgstphotography-$$GST_VERSION | ||
| 150 | |||
| 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 { | ||
| 156 | } else { | ||
| 157 | qtCompileTest(alsa) | ||
| 158 | qtCompileTest(pulseaudio) | ||
| 159 | - qtCompileTest(gstreamer) { | ||
| 160 | - qtCompileTest(gstreamer_photography) | ||
| 161 | - qtCompileTest(gstreamer_encodingprofiles) | ||
| 162 | - qtCompileTest(gstreamer_appsrc) | ||
| 163 | + !done_config_gstreamer { | ||
| 164 | + gstver=1.0 | ||
| 165 | + cache(GST_VERSION, set, gstver); | ||
| 166 | + qtCompileTest(gstreamer) { | ||
| 167 | + qtCompileTest(gstreamer_photography) | ||
| 168 | + qtCompileTest(gstreamer_encodingprofiles) | ||
| 169 | + qtCompileTest(gstreamer_appsrc) | ||
| 170 | + } else { | ||
| 171 | + gstver=0.10 | ||
| 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) | ||
| 179 | + } | ||
| 180 | + } | ||
| 181 | } | ||
| 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 | ||
| 189 | |||
| 190 | TARGET = qgsttools_p | ||
| 191 | QPRO_PWD = $$PWD | ||
| 192 | -QT = core-private multimedia-private gui-private | ||
| 193 | +QT = core-private multimedia-private gui-private opengl | ||
| 194 | |||
| 195 | !static:DEFINES += QT_MAKEDLL | ||
| 196 | DEFINES += GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 | ||
| 197 | @@ -15,13 +15,14 @@ LIBS_PRIVATE += \ | ||
| 198 | |||
| 199 | CONFIG += link_pkgconfig | ||
| 200 | |||
| 201 | -PKGCONFIG_PRIVATE += \ | ||
| 202 | - gstreamer-0.10 \ | ||
| 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 | ||
| 208 | +PKGCONFIG += \ | ||
| 209 | + gstreamer-$$GST_VERSION \ | ||
| 210 | + gstreamer-base-$$GST_VERSION \ | ||
| 211 | + gstreamer-audio-$$GST_VERSION \ | ||
| 212 | + gstreamer-video-$$GST_VERSION \ | ||
| 213 | + gstreamer-pbutils-$$GST_VERSION | ||
| 214 | + | ||
| 215 | +equals(GST_VERSION,"0.10"): PKGCONFIG_PRIVATE += gstreamer-interfaces-$$GST_VERSION | ||
| 216 | |||
| 217 | maemo*: PKGCONFIG_PRIVATE +=gstreamer-plugins-bad-0.10 | ||
| 218 | |||
| 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/ | ||
| 225 | |||
| 226 | PRIVATE_HEADERS += \ | ||
| 227 | @@ -91,13 +93,13 @@ maemo6 { | ||
| 228 | } | ||
| 229 | |||
| 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 | ||
| 235 | |||
| 236 | DEFINES += HAVE_GST_APPSRC | ||
| 237 | |||
| 238 | - LIBS_PRIVATE += -lgstapp-0.10 | ||
| 239 | + LIBS_PRIVATE += -lgstapp-$$GST_VERSION | ||
| 240 | } | ||
| 241 | |||
| 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", | ||
| 248 | GST_PAD_ALWAYS, | ||
| 249 | GST_STATIC_CAPS_ANY); | ||
| 250 | |||
| 251 | + | ||
| 252 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 253 | + | ||
| 254 | +G_DEFINE_TYPE(GstVideoConnector, gst_video_connector, GST_TYPE_ELEMENT); | ||
| 255 | +#else | ||
| 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"); | ||
| 259 | |||
| 260 | GST_BOILERPLATE_FULL (GstVideoConnector, gst_video_connector, GstElement, | ||
| 261 | GST_TYPE_ELEMENT, _do_init); | ||
| 262 | +#endif | ||
| 263 | |||
| 264 | static void gst_video_connector_dispose (GObject * object); | ||
| 265 | + | ||
| 266 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 267 | +static GstFlowReturn gst_video_connector_chain (GstPad * pad, GstObject* parent, GstBuffer * buf); | ||
| 268 | +#else | ||
| 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); | ||
| 272 | +#endif | ||
| 273 | + | ||
| 274 | static GstStateChangeReturn gst_video_connector_change_state (GstElement * | ||
| 275 | element, GstStateChange transition); | ||
| 276 | + | ||
| 277 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 278 | +static gboolean gst_video_connector_handle_sink_event (GstPad * pad, GstObject* parent, | ||
| 279 | + GstEvent * event); | ||
| 280 | +#else | ||
| 281 | static gboolean gst_video_connector_handle_sink_event (GstPad * pad, | ||
| 282 | GstEvent * event); | ||
| 283 | +#endif | ||
| 284 | + | ||
| 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); | ||
| 289 | +#else | ||
| 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); | ||
| 295 | +#endif | ||
| 296 | + | ||
| 297 | +static void gst_video_connector_resend_new_segment(GstElement * element, gboolean emitFailedSignal); | ||
| 298 | + | ||
| 299 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 300 | +static void | ||
| 301 | +gst_video_connector_class_init (GstVideoConnectorClass * klass) | ||
| 302 | +{ | ||
| 303 | + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); | ||
| 304 | + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); | ||
| 305 | + | ||
| 306 | + gst_element_class_set_details_simple (gstelement_class, "Video Connector", | ||
| 307 | + "Generic", | ||
| 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)); | ||
| 314 | + | ||
| 315 | + gst_video_connector_parent_class = g_type_class_peek_parent (klass); | ||
| 316 | + | ||
| 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; | ||
| 320 | + | ||
| 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); | ||
| 326 | + | ||
| 327 | + gst_video_connector_signals[SIGNAL_CONNECTION_FAILED] = | ||
| 328 | + g_signal_new ("connection-failed", G_TYPE_FROM_CLASS (klass), | ||
| 329 | + G_SIGNAL_RUN_LAST, | ||
| 330 | + 0, NULL, NULL, | ||
| 331 | + g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); | ||
| 332 | + | ||
| 333 | + GST_DEBUG_CATEGORY_INIT(video_connector_debug, "video-connector", 0, | ||
| 334 | + "An identity like element for reconnecting video stream"); | ||
| 335 | + | ||
| 336 | +} | ||
| 337 | + | ||
| 338 | +#else | ||
| 339 | |||
| 340 | static void | ||
| 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); | ||
| 344 | } | ||
| 345 | |||
| 346 | +#endif | ||
| 347 | + | ||
| 348 | static void | ||
| 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) | ||
| 353 | +#else | ||
| 354 | + ,GstVideoConnectorClass *g_class | ||
| 355 | +#endif | ||
| 356 | + ) | ||
| 357 | { | ||
| 358 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 359 | +#else | ||
| 360 | (void) g_class; | ||
| 361 | +#endif | ||
| 362 | element->sinkpad = | ||
| 363 | gst_pad_new_from_static_template (&gst_video_connector_sink_factory, | ||
| 364 | "sink"); | ||
| 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); | ||
| 371 | +#else | ||
| 372 | gst_pad_set_event_function(element->sinkpad, | ||
| 373 | GST_DEBUG_FUNCPTR (gst_video_connector_handle_sink_event)); | ||
| 374 | + | ||
| 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)); | ||
| 382 | - | ||
| 383 | +#endif | ||
| 384 | gst_element_add_pad (GST_ELEMENT (element), element->sinkpad); | ||
| 385 | |||
| 386 | element->srcpad = | ||
| 387 | gst_pad_new_from_static_template (&gst_video_connector_src_factory, | ||
| 388 | "src"); | ||
| 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); | ||
| 396 | +#else | ||
| 397 | gst_pad_add_buffer_probe(element->srcpad, | ||
| 398 | G_CALLBACK(gst_video_connector_new_buffer_probe), element); | ||
| 399 | +#endif | ||
| 400 | gst_element_add_pad (GST_ELEMENT (element), element->srcpad); | ||
| 401 | |||
| 402 | element->relinked = FALSE; | ||
| 403 | @@ -183,9 +274,16 @@ gst_video_connector_dispose (GObject * object) | ||
| 404 | |||
| 405 | gst_video_connector_reset (element); | ||
| 406 | |||
| 407 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 408 | + G_OBJECT_CLASS (gst_video_connector_parent_class)->dispose (object); | ||
| 409 | +#else | ||
| 410 | G_OBJECT_CLASS (parent_class)->dispose (object); | ||
| 411 | +#endif | ||
| 412 | } | ||
| 413 | |||
| 414 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 415 | +/* For gstreamer 1.x we handle it in ALLOCATION Query */ | ||
| 416 | +#else | ||
| 417 | // "When this function returns anything else than GST_FLOW_OK, | ||
| 418 | // the buffer allocation failed and buf does not contain valid data." | ||
| 419 | static GstFlowReturn | ||
| 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 | ||
| 424 | + | ||
| 425 | return GST_FLOW_UNEXPECTED; | ||
| 426 | } | ||
| 427 | } | ||
| 428 | @@ -301,6 +400,7 @@ static GstCaps *gst_video_connector_getcaps (GstPad * pad) | ||
| 429 | return caps; | ||
| 430 | } | ||
| 431 | |||
| 432 | + | ||
| 433 | static gboolean gst_video_connector_acceptcaps (GstPad * pad, GstCaps * caps) | ||
| 434 | { | ||
| 435 | GstVideoConnector *element; | ||
| 436 | @@ -308,6 +408,7 @@ static gboolean gst_video_connector_acceptcaps (GstPad * pad, GstCaps * caps) | ||
| 437 | |||
| 438 | return gst_pad_peer_accept_caps(element->srcpad, caps); | ||
| 439 | } | ||
| 440 | +#endif | ||
| 441 | |||
| 442 | static void | ||
| 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; | ||
| 446 | } | ||
| 447 | |||
| 448 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 449 | +static GstPadProbeReturn gst_video_connector_new_event_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object) | ||
| 450 | +{ | ||
| 451 | + GstVideoConnector *connector = GST_VIDEO_CONNECTOR (object); | ||
| 452 | + GstEvent *event = gst_pad_probe_info_get_event(info); | ||
| 453 | + | ||
| 454 | + GST_DEBUG_OBJECT(connector, "Event %"GST_PTR_FORMAT" received\n", event); | ||
| 455 | + | ||
| 456 | + return GST_PAD_PROBE_OK; | ||
| 457 | +} | ||
| 458 | + | ||
| 459 | +static GstPadProbeReturn gst_video_connector_new_query_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object) | ||
| 460 | +{ | ||
| 461 | + GstVideoConnector *connector = GST_VIDEO_CONNECTOR (object); | ||
| 462 | + GstQuery *query = gst_pad_probe_info_get_query(info); | ||
| 463 | + | ||
| 464 | + GST_DEBUG_OBJECT(connector, "Query %"GST_PTR_FORMAT" received\n", query); | ||
| 465 | + | ||
| 466 | + return GST_PAD_PROBE_OK; | ||
| 467 | +} | ||
| 468 | +#endif | ||
| 469 | |||
| 470 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 471 | +static GstPadProbeReturn gst_video_connector_new_buffer_probe(GstPad *pad, GstPadProbeInfo *info, gpointer object) | ||
| 472 | +{ | ||
| 473 | + (void) info; | ||
| 474 | +#else | ||
| 475 | static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *buffer, guint * object) | ||
| 476 | { | ||
| 477 | - (void) pad; | ||
| 478 | (void) buffer; | ||
| 479 | +#endif | ||
| 480 | + (void) pad; | ||
| 481 | + | ||
| 482 | |||
| 483 | GstVideoConnector *element = GST_VIDEO_CONNECTOR (object); | ||
| 484 | |||
| 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"); | ||
| 488 | |||
| 489 | - return !element->relinked; | ||
| 490 | + return element->relinked ? GST_PAD_PROBE_DROP : GST_PAD_PROBE_OK; | ||
| 491 | } | ||
| 492 | |||
| 493 | - | ||
| 494 | static GstFlowReturn | ||
| 495 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 496 | +gst_video_connector_chain (GstPad * pad, GstObject* parent, GstBuffer * buf) | ||
| 497 | +#else | ||
| 498 | gst_video_connector_chain (GstPad * pad, GstBuffer * buf) | ||
| 499 | +#endif | ||
| 500 | { | ||
| 501 | GstFlowReturn res; | ||
| 502 | GstVideoConnector *element; | ||
| 503 | |||
| 504 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 505 | + (void)parent; | ||
| 506 | +#endif | ||
| 507 | + | ||
| 508 | element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad)); | ||
| 509 | |||
| 510 | do { | ||
| 511 | @@ -356,20 +492,29 @@ gst_video_connector_chain (GstPad * pad, GstBuffer * buf) | ||
| 512 | */ | ||
| 513 | while (element->relinked) { | ||
| 514 | element->relinked = FALSE; | ||
| 515 | - | ||
| 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); | ||
| 519 | + } | ||
| 520 | +#else | ||
| 521 | gint64 pos = element->segment.last_stop; | ||
| 522 | - | ||
| 523 | if (element->latest_buffer && GST_BUFFER_TIMESTAMP_IS_VALID(element->latest_buffer)) { | ||
| 524 | pos = GST_BUFFER_TIMESTAMP (element->latest_buffer); | ||
| 525 | } | ||
| 526 | +#endif | ||
| 527 | |||
| 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); | ||
| 531 | + | ||
| 532 | +#else | ||
| 533 | GstEvent *ev = gst_event_new_new_segment (TRUE, | ||
| 534 | element->segment.rate, | ||
| 535 | element->segment.format, | ||
| 536 | pos, //start | ||
| 537 | element->segment.stop, | ||
| 538 | pos); | ||
| 539 | +#endif | ||
| 540 | |||
| 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; | ||
| 545 | |||
| 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); | ||
| 549 | +#else | ||
| 550 | result = GST_ELEMENT_CLASS (parent_class)->change_state(element, transition); | ||
| 551 | - | ||
| 552 | +#endif | ||
| 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, | ||
| 557 | return result; | ||
| 558 | } | ||
| 559 | |||
| 560 | -static gboolean | ||
| 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, | ||
| 564 | + GstEvent * event) | ||
| 565 | +{ | ||
| 566 | + GstVideoConnector *element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad)); | ||
| 567 | + | ||
| 568 | + switch (GST_EVENT_TYPE (event)) { | ||
| 569 | + case GST_EVENT_SEGMENT: | ||
| 570 | + break; | ||
| 571 | + case GST_EVENT_CAPS: | ||
| 572 | + break; | ||
| 573 | + default: | ||
| 574 | + break; | ||
| 575 | + } | ||
| 576 | + | ||
| 577 | + gst_object_unref (element); | ||
| 578 | + return gst_pad_event_default (pad, parent, event); | ||
| 579 | +} | ||
| 580 | + | ||
| 581 | +#else | ||
| 582 | + | ||
| 583 | +static gboolean gst_video_connector_handle_sink_event (GstPad * pad, | ||
| 584 | + GstEvent * event) | ||
| 585 | { | ||
| 586 | + (void)parent; | ||
| 587 | + | ||
| 588 | if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) { | ||
| 589 | GstVideoConnector *element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad)); | ||
| 590 | |||
| 591 | @@ -461,7 +632,6 @@ gst_video_connector_handle_sink_event (GstPad * pad, GstEvent * event) | ||
| 592 | |||
| 593 | gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format, | ||
| 594 | &start, &stop, &time); | ||
| 595 | - | ||
| 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) | ||
| 600 | |||
| 601 | gst_segment_set_newsegment_full (&element->segment, update, | ||
| 602 | rate, arate, format, start, stop, time); | ||
| 603 | - | ||
| 604 | gst_object_unref (element); | ||
| 605 | } | ||
| 606 | |||
| 607 | return gst_pad_event_default (pad, event); | ||
| 608 | } | ||
| 609 | + | ||
| 610 | +#endif | ||
| 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); | ||
| 617 | |||
| 618 | if (size) { | ||
| 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); | ||
| 622 | + | ||
| 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; | ||
| 627 | +#else | ||
| 628 | + void* bufferData = GST_BUFFER_DATA(buffer); | ||
| 629 | +#endif | ||
| 630 | + | ||
| 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; | ||
| 635 | |||
| 636 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 637 | + gst_buffer_unmap(buffer, &mapInfo); | ||
| 638 | +#endif | ||
| 639 | + | ||
| 640 | if (bytesRead > 0) { | ||
| 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"; | ||
| 649 | + } | ||
| 650 | +#else | ||
| 651 | } else if (ret == GST_FLOW_WRONG_STATE) { | ||
| 652 | qWarning()<<"appsrc: push buffer wrong state"; | ||
| 653 | - } else if (ret == GST_FLOW_RESEND) { | ||
| 654 | + } | ||
| 655 | +#endif | ||
| 656 | +#if GST_VERSION_MAJOR < 1 | ||
| 657 | + else if (ret == GST_FLOW_RESEND) { | ||
| 658 | qWarning()<<"appsrc: push buffer resend"; | ||
| 659 | } | ||
| 660 | +#endif | ||
| 661 | } | ||
| 662 | } else { | ||
| 663 | sendEOS(); | ||
| 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() | ||
| 669 | |||
| 670 | } | ||
| 671 | |||
| 672 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 673 | +void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer, GstCaps* caps) | ||
| 674 | +{ | ||
| 675 | +#else | ||
| 676 | void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer) | ||
| 677 | { | ||
| 678 | - GstCaps* caps = gst_buffer_get_caps(buffer); | ||
| 679 | + gst_buffer_get_caps(buffer); | ||
| 680 | +#endif | ||
| 681 | if (!caps) | ||
| 682 | return; | ||
| 683 | |||
| 684 | @@ -64,8 +69,20 @@ void QGstreamerAudioProbeControl::bufferProbed(GstBuffer* buffer) | ||
| 685 | if (!format.isValid()) | ||
| 686 | return; | ||
| 687 | |||
| 688 | + #if GST_CHECK_VERSION(1,0,0) | ||
| 689 | + | ||
| 690 | + GstMapInfo info; | ||
| 691 | + | ||
| 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); | ||
| 695 | + | ||
| 696 | + #else | ||
| 697 | + | ||
| 698 | QAudioBuffer audioBuffer = QAudioBuffer(QByteArray((const char*)buffer->data, buffer->size), format); | ||
| 699 | |||
| 700 | + #endif | ||
| 701 | + | ||
| 702 | { | ||
| 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): | ||
| 710 | QObject(parent) | ||
| 711 | { | ||
| 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); | ||
| 715 | +#else | ||
| 716 | gst_bus_set_sync_handler(bus, (GstBusSyncHandler)syncGstBusFilter, d); | ||
| 717 | +#endif | ||
| 718 | gst_object_ref(GST_OBJECT(bus)); | ||
| 719 | } | ||
| 720 | |||
| 721 | QGstreamerBusHelper::~QGstreamerBusHelper() | ||
| 722 | { | ||
| 723 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 724 | + gst_bus_set_sync_handler(d->bus(), 0, 0, 0); | ||
| 725 | +#else | ||
| 726 | gst_bus_set_sync_handler(d->bus(),0,0); | ||
| 727 | +#endif | ||
| 728 | gst_object_unref(GST_OBJECT(d->bus())); | ||
| 729 | } | ||
| 730 | |||
| 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() | ||
| 736 | m_flushing = false; | ||
| 737 | } | ||
| 738 | |||
| 739 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 740 | +void QGstreamerVideoProbeControl::bufferProbed(GstBuffer* buffer, GstCaps* caps) | ||
| 741 | +#else | ||
| 742 | void QGstreamerVideoProbeControl::bufferProbed(GstBuffer* buffer) | ||
| 743 | +#endif | ||
| 744 | { | ||
| 745 | if (m_flushing) | ||
| 746 | return; | ||
| 747 | |||
| 748 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 749 | + // FIXME: | ||
| 750 | + // GstCaps* caps = NULL;//gst_buffer_get_caps(buffer); | ||
| 751 | +#else | ||
| 752 | GstCaps* caps = gst_buffer_get_caps(buffer); | ||
| 753 | +#endif | ||
| 754 | if (!caps) | ||
| 755 | return; | ||
| 756 | |||
| 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 | ||
| 761 | @@ -43,8 +43,7 @@ | ||
| 762 | #include <private/qvideosurfacegstsink_p.h> | ||
| 763 | #include <private/qgstutils_p.h> | ||
| 764 | #include <qabstractvideosurface.h> | ||
| 765 | - | ||
| 766 | -#include <QDebug> | ||
| 767 | +#include <QtCore/qdebug.h> | ||
| 768 | |||
| 769 | #include <gst/gst.h> | ||
| 770 | |||
| 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 | ||
| 775 | @@ -48,8 +48,13 @@ | ||
| 776 | #include <QtGui/qpainter.h> | ||
| 777 | |||
| 778 | #include <gst/gst.h> | ||
| 779 | + | ||
| 780 | +#if !GST_CHECK_VERSION(1,0,0) | ||
| 781 | #include <gst/interfaces/xoverlay.h> | ||
| 782 | #include <gst/interfaces/propertyprobe.h> | ||
| 783 | +#else | ||
| 784 | +#include <gst/video/videooverlay.h> | ||
| 785 | +#endif | ||
| 786 | |||
| 787 | QT_BEGIN_NAMESPACE | ||
| 788 | |||
| 789 | @@ -177,9 +182,13 @@ bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &m | ||
| 790 | { | ||
| 791 | GstMessage* gm = message.rawMessage(); | ||
| 792 | |||
| 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")) { | ||
| 796 | - | ||
| 797 | +#else | ||
| 798 | + if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) && | ||
| 799 | + gst_structure_has_name(gst_message_get_structure(gm), "prepare-window-handle")) { | ||
| 800 | +#endif | ||
| 801 | setOverlay(); | ||
| 802 | QMetaObject::invokeMethod(this, "updateNativeVideoSize", Qt::QueuedConnection); | ||
| 803 | return true; | ||
| 804 | @@ -207,18 +216,29 @@ bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &me | ||
| 805 | |||
| 806 | void QGstreamerVideoWidgetControl::setOverlay() | ||
| 807 | { | ||
| 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); | ||
| 811 | } | ||
| 812 | +#else | ||
| 813 | + if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) { | ||
| 814 | + gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId); | ||
| 815 | + } | ||
| 816 | +#endif | ||
| 817 | } | ||
| 818 | |||
| 819 | void QGstreamerVideoWidgetControl::updateNativeVideoSize() | ||
| 820 | { | ||
| 821 | if (m_videoSink) { | ||
| 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)); | ||
| 828 | +#else | ||
| 829 | + GstCaps *caps = gst_pad_get_current_caps(pad); | ||
| 830 | + gst_object_unref(GST_OBJECT(pad)); | ||
| 831 | +#endif | ||
| 832 | |||
| 833 | if (caps) { | ||
| 834 | m_widget->setNativeSize(QGstUtils::capsCorrectedResolution(caps)); | ||
| 835 | @@ -233,8 +253,13 @@ void QGstreamerVideoWidgetControl::updateNativeVideoSize() | ||
| 836 | |||
| 837 | void QGstreamerVideoWidgetControl::windowExposed() | ||
| 838 | { | ||
| 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)); | ||
| 842 | +#else | ||
| 843 | + if (m_videoSink && GST_IS_VIDEO_OVERLAY(m_videoSink)) | ||
| 844 | + gst_video_overlay_expose(GST_VIDEO_OVERLAY(m_videoSink)); | ||
| 845 | +#endif | ||
| 846 | } | ||
| 847 | |||
| 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 | ||
| 853 | @@ -45,8 +45,12 @@ | ||
| 854 | #include <QtCore/qdebug.h> | ||
| 855 | |||
| 856 | #include <gst/gst.h> | ||
| 857 | +#include <gst/video/videooverlay.h> | ||
| 858 | + | ||
| 859 | +#if !GST_CHECK_VERSION(1,0,0) | ||
| 860 | #include <gst/interfaces/xoverlay.h> | ||
| 861 | #include <gst/interfaces/propertyprobe.h> | ||
| 862 | +#endif | ||
| 863 | |||
| 864 | |||
| 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) | ||
| 869 | { | ||
| 870 | - if (elementName) | ||
| 871 | + if (elementName) { | ||
| 872 | m_videoSink = gst_element_factory_make(elementName, NULL); | ||
| 873 | - else | ||
| 874 | + } else { | ||
| 875 | m_videoSink = gst_element_factory_make("xvimagesink", NULL); | ||
| 876 | + } | ||
| 877 | |||
| 878 | if (m_videoSink) { | ||
| 879 | qt_gst_object_ref_sink(GST_OBJECT(m_videoSink)); //Take ownership | ||
| 880 | |||
| 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); | ||
| 884 | +#else | ||
| 885 | m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this); | ||
| 886 | +#endif | ||
| 887 | gst_object_unref(GST_OBJECT(pad)); | ||
| 888 | } | ||
| 889 | + else | ||
| 890 | + qDebug() << "No m_videoSink available!"; | ||
| 891 | } | ||
| 892 | |||
| 893 | QGstreamerVideoWindow::~QGstreamerVideoWindow() | ||
| 894 | @@ -90,11 +101,15 @@ void QGstreamerVideoWindow::setWinId(WId id) | ||
| 895 | WId oldId = m_windowId; | ||
| 896 | |||
| 897 | m_windowId = id; | ||
| 898 | - | ||
| 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); | ||
| 902 | + } | ||
| 903 | +#else | ||
| 904 | if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) { | ||
| 905 | gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId); | ||
| 906 | } | ||
| 907 | - | ||
| 908 | +#endif | ||
| 909 | if (!oldId) | ||
| 910 | emit readyChanged(true); | ||
| 911 | |||
| 912 | @@ -105,7 +120,20 @@ void QGstreamerVideoWindow::setWinId(WId id) | ||
| 913 | bool QGstreamerVideoWindow::processSyncMessage(const QGstreamerMessage &message) | ||
| 914 | { | ||
| 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)) { | ||
| 921 | + | ||
| 922 | + gst_video_overlay_set_window_handle(GST_VIDEO_OVERLAY(m_videoSink), m_windowId); | ||
| 923 | |||
| 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); | ||
| 926 | + | ||
| 927 | + return true; | ||
| 928 | + } | ||
| 929 | +#else | ||
| 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) | ||
| 934 | |||
| 935 | return true; | ||
| 936 | } | ||
| 937 | - | ||
| 938 | +#endif | ||
| 939 | return false; | ||
| 940 | } | ||
| 941 | |||
| 942 | @@ -130,7 +158,19 @@ QRect QGstreamerVideoWindow::displayRect() const | ||
| 943 | void QGstreamerVideoWindow::setDisplayRect(const QRect &rect) | ||
| 944 | { | ||
| 945 | m_displayRect = rect; | ||
| 946 | - | ||
| 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); | ||
| 951 | + else | ||
| 952 | + gst_video_overlay_set_render_rectangle(GST_VIDEO_OVERLAY(m_videoSink), | ||
| 953 | + m_displayRect.x(), | ||
| 954 | + m_displayRect.y(), | ||
| 955 | + m_displayRect.width(), | ||
| 956 | + m_displayRect.height()); | ||
| 957 | + repaint(); | ||
| 958 | + } | ||
| 959 | +#else | ||
| 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) | ||
| 964 | repaint(); | ||
| 965 | #endif | ||
| 966 | } | ||
| 967 | +#endif | ||
| 968 | } | ||
| 969 | |||
| 970 | Qt::AspectRatioMode QGstreamerVideoWindow::aspectRatioMode() const | ||
| 971 | @@ -165,6 +206,16 @@ void QGstreamerVideoWindow::setAspectRatioMode(Qt::AspectRatioMode mode) | ||
| 972 | |||
| 973 | void QGstreamerVideoWindow::repaint() | ||
| 974 | { | ||
| 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)); | ||
| 982 | + } | ||
| 983 | + } | ||
| 984 | +#else | ||
| 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)); | ||
| 990 | } | ||
| 991 | } | ||
| 992 | +#endif | ||
| 993 | } | ||
| 994 | |||
| 995 | QColor QGstreamerVideoWindow::colorKey() const | ||
| 996 | @@ -304,11 +356,22 @@ QSize QGstreamerVideoWindow::nativeSize() const | ||
| 997 | return m_nativeSize; | ||
| 998 | } | ||
| 999 | |||
| 1000 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1001 | +GstPadProbeReturn QGstreamerVideoWindow::padBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) | ||
| 1002 | +#else | ||
| 1003 | void QGstreamerVideoWindow::padBufferProbe(GstPad *pad, GstBuffer * /* buffer */, gpointer user_data) | ||
| 1004 | +#endif | ||
| 1005 | { | ||
| 1006 | QGstreamerVideoWindow *control = reinterpret_cast<QGstreamerVideoWindow*>(user_data); | ||
| 1007 | QMetaObject::invokeMethod(control, "updateNativeVideoSize", Qt::QueuedConnection); | ||
| 1008 | + | ||
| 1009 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1010 | + Q_UNUSED(pad); | ||
| 1011 | + Q_UNUSED(info); | ||
| 1012 | + return GST_PAD_PROBE_REMOVE; | ||
| 1013 | +#else | ||
| 1014 | gst_pad_remove_buffer_probe(pad, control->m_bufferProbeId); | ||
| 1015 | +#endif | ||
| 1016 | } | ||
| 1017 | |||
| 1018 | void QGstreamerVideoWindow::updateNativeVideoSize() | ||
| 1019 | @@ -319,7 +382,11 @@ void QGstreamerVideoWindow::updateNativeVideoSize() | ||
| 1020 | if (m_videoSink) { | ||
| 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); | ||
| 1025 | +#else | ||
| 1026 | GstCaps *caps = gst_pad_get_negotiated_caps(pad); | ||
| 1027 | +#endif | ||
| 1028 | gst_object_unref(GST_OBJECT(pad)); | ||
| 1029 | |||
| 1030 | if (caps) { | ||
| 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, | ||
| 1036 | break; | ||
| 1037 | default: | ||
| 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); | ||
| 1042 | +#else | ||
| 1043 | if (G_VALUE_TYPE(&val) == GST_TYPE_DATE) { | ||
| 1044 | const GDate *date = gst_value_get_date(&val); | ||
| 1045 | +#endif | ||
| 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) | ||
| 1050 | } | ||
| 1051 | |||
| 1052 | |||
| 1053 | + | ||
| 1054 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1055 | +/*! | ||
| 1056 | + Returns audio format for a buffer. | ||
| 1057 | + If the buffer doesn't have a valid audio format, an empty QAudioFormat is returned. | ||
| 1058 | +*/ | ||
| 1059 | + | ||
| 1060 | +QAudioFormat QGstUtils::audioFormatForSample(GstSample *sample) | ||
| 1061 | +{ | ||
| 1062 | + GstCaps* caps = gst_sample_get_caps(sample); | ||
| 1063 | + if (!caps) | ||
| 1064 | + return QAudioFormat(); | ||
| 1065 | + | ||
| 1066 | + QAudioFormat format = QGstUtils::audioFormatForCaps(caps); | ||
| 1067 | + gst_caps_unref(caps); | ||
| 1068 | + return format; | ||
| 1069 | +} | ||
| 1070 | +#else | ||
| 1071 | /*! | ||
| 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); | ||
| 1076 | return format; | ||
| 1077 | } | ||
| 1078 | - | ||
| 1079 | +#endif | ||
| 1080 | |||
| 1081 | /*! | ||
| 1082 | Builds GstCaps for an audio format. | ||
| 1083 | @@ -403,7 +426,7 @@ QMultimedia::SupportEstimate QGstUtils::hasSupport(const QString &mimeType, | ||
| 1084 | |||
| 1085 | void qt_gst_object_ref_sink(gpointer object) | ||
| 1086 | { | ||
| 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); | ||
| 1090 | #else | ||
| 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) | ||
| 1098 | { | ||
| 1099 | if (mode != NotMapped && m_mode == NotMapped) { | ||
| 1100 | - if (numBytes) | ||
| 1101 | - *numBytes = m_buffer->size; | ||
| 1102 | + m_mode = mode; | ||
| 1103 | |||
| 1104 | if (bytesPerLine) | ||
| 1105 | *bytesPerLine = m_bytesPerLine; | ||
| 1106 | |||
| 1107 | - m_mode = mode; | ||
| 1108 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1109 | + gst_buffer_map(m_buffer, &m_mapInfo, GST_MAP_READ); | ||
| 1110 | + if (numBytes) | ||
| 1111 | + *numBytes = m_mapInfo.size; | ||
| 1112 | + | ||
| 1113 | + return m_mapInfo.data; | ||
| 1114 | +#else | ||
| 1115 | + if (numBytes) | ||
| 1116 | + *numBytes = m_buffer->size; | ||
| 1117 | |||
| 1118 | return m_buffer->data; | ||
| 1119 | +#endif | ||
| 1120 | } else { | ||
| 1121 | return 0; | ||
| 1122 | } | ||
| 1123 | } | ||
| 1124 | void QGstVideoBuffer::unmap() | ||
| 1125 | { | ||
| 1126 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1127 | + if (m_mode != NotMapped) | ||
| 1128 | + gst_buffer_unmap(m_buffer, &m_mapInfo); | ||
| 1129 | +#endif | ||
| 1130 | m_mode = NotMapped; | ||
| 1131 | } | ||
| 1132 | |||
| 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 | ||
| 1137 | @@ -51,7 +51,11 @@ | ||
| 1138 | |||
| 1139 | #include "qvideosurfacegstsink_p.h" | ||
| 1140 | |||
| 1141 | -//#define DEBUG_VIDEO_SURFACE_SINK | ||
| 1142 | +#if GST_VERSION_MAJOR >=1 | ||
| 1143 | +#include <gst/video/video.h> | ||
| 1144 | +#endif | ||
| 1145 | + | ||
| 1146 | +#define DEBUG_VIDEO_SURFACE_SINK | ||
| 1147 | |||
| 1148 | QT_BEGIN_NAMESPACE | ||
| 1149 | |||
| 1150 | @@ -71,10 +75,12 @@ QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate( | ||
| 1151 | if (m_surface) { | ||
| 1152 | foreach (QObject *instance, bufferPoolLoader()->instances(QGstBufferPoolPluginKey)) { | ||
| 1153 | QGstBufferPoolInterface* plugin = qobject_cast<QGstBufferPoolInterface*>(instance); | ||
| 1154 | + | ||
| 1155 | if (plugin) { | ||
| 1156 | m_pools.append(plugin); | ||
| 1157 | } | ||
| 1158 | } | ||
| 1159 | + | ||
| 1160 | updateSupportedFormats(); | ||
| 1161 | connect(m_surface, SIGNAL(supportedFormatsChanged()), this, SLOT(updateSupportedFormats())); | ||
| 1162 | } | ||
| 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); | ||
| 1167 | + else | ||
| 1168 | + qWarning() << "m_surface.isNull()."; | ||
| 1169 | } else { | ||
| 1170 | QMetaObject::invokeMethod(this, "queuedRender", Qt::QueuedConnection); | ||
| 1171 | m_renderCondition.wait(&m_mutex, 300); | ||
| 1172 | @@ -310,6 +318,27 @@ void QVideoSurfaceGstDelegate::updateSupportedFormats() | ||
| 1173 | } | ||
| 1174 | } | ||
| 1175 | |||
| 1176 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1177 | +struct YuvFormat | ||
| 1178 | +{ | ||
| 1179 | + QVideoFrame::PixelFormat pixelFormat; | ||
| 1180 | + GstVideoFormat vfmt; | ||
| 1181 | + guint32 fourcc; | ||
| 1182 | + int bitsPerPixel; | ||
| 1183 | +}; | ||
| 1184 | + | ||
| 1185 | +static const YuvFormat qt_yuvColorLookup[] = | ||
| 1186 | +{ | ||
| 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 }, | ||
| 1194 | +}; | ||
| 1195 | + | ||
| 1196 | +#else | ||
| 1197 | struct YuvFormat | ||
| 1198 | { | ||
| 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 } | ||
| 1203 | }; | ||
| 1204 | +#endif | ||
| 1205 | |||
| 1206 | static int indexOfYuvColor(QVideoFrame::PixelFormat format) | ||
| 1207 | { | ||
| 1208 | @@ -339,12 +369,20 @@ static int indexOfYuvColor(QVideoFrame::PixelFormat format) | ||
| 1209 | return -1; | ||
| 1210 | } | ||
| 1211 | |||
| 1212 | +#if GST_VERSION_MAJOR >=1 | ||
| 1213 | +static int indexOfYuvColor(GstVideoFormat vfmt) | ||
| 1214 | +#else | ||
| 1215 | static int indexOfYuvColor(guint32 fourcc) | ||
| 1216 | +#endif | ||
| 1217 | { | ||
| 1218 | const int count = sizeof(qt_yuvColorLookup) / sizeof(YuvFormat); | ||
| 1219 | |||
| 1220 | for (int i = 0; i < count; ++i) | ||
| 1221 | +#if GST_VERSION_MAJOR >=1 | ||
| 1222 | + if (qt_yuvColorLookup[i].vfmt == vfmt) | ||
| 1223 | +#else | ||
| 1224 | if (qt_yuvColorLookup[i].fourcc == fourcc) | ||
| 1225 | +#endif | ||
| 1226 | return i; | ||
| 1227 | |||
| 1228 | return -1; | ||
| 1229 | @@ -417,13 +455,13 @@ GType QVideoSurfaceGstSink::get_type() | ||
| 1230 | if (type == 0) { | ||
| 1231 | static const GTypeInfo info = | ||
| 1232 | { | ||
| 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 | ||
| 1239 | NULL, // class_data | ||
| 1240 | - sizeof(QVideoSurfaceGstSink), // instance_size | ||
| 1241 | + sizeof(QVideoSurfaceGstSink), // instance_size | ||
| 1242 | 0, // n_preallocs | ||
| 1243 | instance_init, // instance_init | ||
| 1244 | 0 // value_table | ||
| 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; | ||
| 1249 | +// FIXME: | ||
| 1250 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1251 | +#else | ||
| 1252 | base_sink_class->buffer_alloc = QVideoSurfaceGstSink::buffer_alloc; | ||
| 1253 | +#endif | ||
| 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) | ||
| 1258 | { | ||
| 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) | ||
| 1262 | + "video/x-raw, " | ||
| 1263 | + "format = (string) RGBA," | ||
| 1264 | + "framerate = (fraction) [ 0, MAX ], " | ||
| 1265 | + "width = (int) [ 1, MAX ], " | ||
| 1266 | + "height = (int) [ 1, MAX ]; " | ||
| 1267 | + "video/x-raw, " | ||
| 1268 | + "format = (string) I420," | ||
| 1269 | + "framerate = (fraction) [ 0, MAX ], " | ||
| 1270 | + "width = (int) [ 1, MAX ], " | ||
| 1271 | + "height = (int) [ 1, MAX ]")); | ||
| 1272 | +#else | ||
| 1273 | "video/x-raw-rgb, " | ||
| 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 ]")); | ||
| 1280 | +#endif | ||
| 1281 | |||
| 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); | ||
| 1286 | } | ||
| 1287 | |||
| 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*/ | ||
| 1292 | +#endif | ||
| 1293 | +) | ||
| 1294 | { | ||
| 1295 | VO_SINK(base); | ||
| 1296 | |||
| 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(); | ||
| 1301 | + | ||
| 1302 | if (pool) | ||
| 1303 | poolHandleFormats = sink->delegate->supportedPixelFormats(pool->handleType()); | ||
| 1304 | sink->delegate->poolMutex()->unlock(); | ||
| 1305 | @@ -548,11 +608,19 @@ GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base) | ||
| 1306 | |||
| 1307 | if (index != -1) { | ||
| 1308 | gst_caps_append_structure(caps, gst_structure_new( | ||
| 1309 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1310 | + "video/x-raw", | ||
| 1311 | +#else | ||
| 1312 | "video/x-raw-yuv", | ||
| 1313 | +#endif | ||
| 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), | ||
| 1320 | +#else | ||
| 1321 | + "format" , G_TYPE_STRING, qt_yuvColorLookup[index].fourcc, | ||
| 1322 | +#endif | ||
| 1323 | NULL)); | ||
| 1324 | continue; | ||
| 1325 | } | ||
| 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) | ||
| 1331 | + "video/x-raw", | ||
| 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)), | ||
| 1339 | +#else | ||
| 1340 | "video/x-raw-rgb", | ||
| 1341 | +#endif | ||
| 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) | ||
| 1346 | } | ||
| 1347 | } | ||
| 1348 | |||
| 1349 | +// printf("get Caps %"GST_PTR_FORMAT"\n", caps); | ||
| 1350 | return caps; | ||
| 1351 | } | ||
| 1352 | |||
| 1353 | @@ -622,7 +702,7 @@ gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps) | ||
| 1354 | sink->lastRequestedCaps = 0; | ||
| 1355 | |||
| 1356 | #ifdef DEBUG_VIDEO_SURFACE_SINK | ||
| 1357 | - qDebug() << "Staring video surface, format:"; | ||
| 1358 | + qDebug() << "Starting video surface, format:"; | ||
| 1359 | qDebug() << format; | ||
| 1360 | qDebug() << "bytesPerLine:" << bytesPerLine; | ||
| 1361 | #endif | ||
| 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()); | ||
| 1365 | |||
| 1366 | +#if GST_CHECK_VERSION(1, 0, 0) | ||
| 1367 | + GstVideoInfo info; | ||
| 1368 | + gst_video_info_from_caps(&info, caps); | ||
| 1369 | + | ||
| 1370 | + if (info.finfo->format == GST_VIDEO_FORMAT_I420) { | ||
| 1371 | + int index = indexOfYuvColor(GST_VIDEO_FORMAT_I420); | ||
| 1372 | + | ||
| 1373 | + if (index != -1) { | ||
| 1374 | + pixelFormat = qt_yuvColorLookup[index].pixelFormat; | ||
| 1375 | + bitsPerPixel = qt_yuvColorLookup[index].bitsPerPixel; | ||
| 1376 | + } | ||
| 1377 | + } else if (info.finfo->format == GST_VIDEO_FORMAT_RGBx) { | ||
| 1378 | + int depth = 0; | ||
| 1379 | + int endianness = 0; | ||
| 1380 | + int red = 0; | ||
| 1381 | + int green = 0; | ||
| 1382 | + int blue = 0; | ||
| 1383 | + int alpha = 0; | ||
| 1384 | + | ||
| 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); | ||
| 1392 | + | ||
| 1393 | + int index = indexOfRgbColor(bitsPerPixel, depth, endianness, red, green, blue, alpha); | ||
| 1394 | + printf("INDEX %x\n", index); | ||
| 1395 | + if (index != -1) | ||
| 1396 | + pixelFormat = qt_rgbColorLookup[index].pixelFormat; | ||
| 1397 | + } | ||
| 1398 | +#else | ||
| 1399 | + | ||
| 1400 | if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-yuv") == 0) { | ||
| 1401 | guint32 fourcc = 0; | ||
| 1402 | +#if GST_CHECK_VERSION(1, 0, 0) | ||
| 1403 | + int index = indexOfYuvColor(gst_video_format_from_string(gst_structure_get_string(structure, "format"))); | ||
| 1404 | +#else | ||
| 1405 | gst_structure_get_fourcc(structure, "format", &fourcc); | ||
| 1406 | |||
| 1407 | int index = indexOfYuvColor(fourcc); | ||
| 1408 | +#endif | ||
| 1409 | if (index != -1) { | ||
| 1410 | pixelFormat = qt_yuvColorLookup[index].pixelFormat; | ||
| 1411 | bitsPerPixel = qt_yuvColorLookup[index].bitsPerPixel; | ||
| 1412 | @@ -677,6 +795,7 @@ QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *byte | ||
| 1413 | if (index != -1) | ||
| 1414 | pixelFormat = qt_rgbColorLookup[index].pixelFormat; | ||
| 1415 | } | ||
| 1416 | +#endif | ||
| 1417 | |||
| 1418 | if (pixelFormat != QVideoFrame::Format_Invalid) { | ||
| 1419 | QVideoSurfaceFormat format(size, pixelFormat, handleType); | ||
| 1420 | @@ -773,7 +892,11 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc( | ||
| 1421 | |||
| 1422 | poolLock.unlock(); | ||
| 1423 | |||
| 1424 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1425 | + GstCaps *intersection = gst_caps_intersect(get_caps(GST_BASE_SINK(sink), NULL), caps); | ||
| 1426 | +#else | ||
| 1427 | GstCaps *intersection = gst_caps_intersect(get_caps(GST_BASE_SINK(sink)), caps); | ||
| 1428 | +#endif | ||
| 1429 | |||
| 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(); | ||
| 1434 | |||
| 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"; | ||
| 1438 | return GST_FLOW_OK; | ||
| 1439 | } | ||
| 1440 | |||
| 1441 | @@ -838,7 +961,6 @@ GstFlowReturn QVideoSurfaceGstSink::buffer_alloc( | ||
| 1442 | gboolean QVideoSurfaceGstSink::start(GstBaseSink *base) | ||
| 1443 | { | ||
| 1444 | Q_UNUSED(base); | ||
| 1445 | - | ||
| 1446 | return TRUE; | ||
| 1447 | } | ||
| 1448 | |||
| 1449 | @@ -864,8 +986,9 @@ gboolean QVideoSurfaceGstSink::event(GstBaseSink *base, GstEvent *event) | ||
| 1450 | VO_SINK(base); | ||
| 1451 | sink->delegate->setLastPrerolledBuffer(0); | ||
| 1452 | } | ||
| 1453 | - | ||
| 1454 | - return TRUE; | ||
| 1455 | +#if GST_CHECK_VERSION(1, 0, 0) | ||
| 1456 | + return GST_BASE_SINK_CLASS (sink_parent_class)->event (base, event); | ||
| 1457 | +#endif | ||
| 1458 | } | ||
| 1459 | |||
| 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 | ||
| 1465 | @@ -47,7 +47,10 @@ | ||
| 1466 | |||
| 1467 | #include <gst/gst.h> | ||
| 1468 | #include <gst/app/gstappsrc.h> | ||
| 1469 | + | ||
| 1470 | +#if GST_VERSION_MAJOR < 1 | ||
| 1471 | #include <gst/app/gstappbuffer.h> | ||
| 1472 | +#endif | ||
| 1473 | |||
| 1474 | QT_BEGIN_NAMESPACE | ||
| 1475 | |||
| 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 | ||
| 1481 | public: | ||
| 1482 | explicit QGstreamerAudioProbeControl(QObject *parent); | ||
| 1483 | virtual ~QGstreamerAudioProbeControl(); | ||
| 1484 | - | ||
| 1485 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1486 | + void bufferProbed(GstBuffer* buffer, GstCaps* caps); | ||
| 1487 | +#else | ||
| 1488 | void bufferProbed(GstBuffer* buffer); | ||
| 1489 | +#endif | ||
| 1490 | |||
| 1491 | private slots: | ||
| 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(); | ||
| 1500 | |||
| 1501 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1502 | + void bufferProbed(GstBuffer* buffer, GstCaps*); | ||
| 1503 | +#else | ||
| 1504 | void bufferProbed(GstBuffer* buffer); | ||
| 1505 | +#endif | ||
| 1506 | void startFlushing(); | ||
| 1507 | void stopFlushing(); | ||
| 1508 | |||
| 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(); | ||
| 1515 | |||
| 1516 | private: | ||
| 1517 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1518 | + static GstPadProbeReturn padBufferProbe(GstPad *pad, GstPadProbeInfo *info, gpointer user_data); | ||
| 1519 | +#else | ||
| 1520 | static void padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); | ||
| 1521 | +#endif | ||
| 1522 | |||
| 1523 | GstElement *m_videoSink; | ||
| 1524 | WId m_windowId; | ||
| 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); | ||
| 1535 | +#else | ||
| 1536 | QAudioFormat audioFormatForBuffer(GstBuffer *buffer); | ||
| 1537 | +#endif | ||
| 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: | ||
| 1546 | int m_bytesPerLine; | ||
| 1547 | MapMode m_mode; | ||
| 1548 | QVariant m_handle; | ||
| 1549 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1550 | + GstMapInfo m_mapInfo; | ||
| 1551 | +#endif | ||
| 1552 | }; | ||
| 1553 | |||
| 1554 | QT_END_NAMESPACE | ||
| 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: | ||
| 1560 | |||
| 1561 | static GstStateChangeReturn change_state(GstElement *element, GstStateChange transition); | ||
| 1562 | |||
| 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*/ | ||
| 1567 | +#endif | ||
| 1568 | + ); | ||
| 1569 | static gboolean set_caps(GstBaseSink *sink, GstCaps *caps); | ||
| 1570 | |||
| 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); | ||
| 1578 | |||
| 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()); | ||
| 1582 | +#else | ||
| 1583 | orig_plugins = plugins = gst_default_registry_get_plugin_list (); | ||
| 1584 | - | ||
| 1585 | +#endif | ||
| 1586 | while (plugins) { | ||
| 1587 | GList *features, *orig_features; | ||
| 1588 | |||
| 1589 | GstPlugin *plugin = (GstPlugin *) (plugins->data); | ||
| 1590 | plugins = g_list_next (plugins); | ||
| 1591 | |||
| 1592 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1593 | + if (GST_OBJECT_FLAG_IS_SET(plugin, GST_PLUGIN_FLAG_BLACKLISTED)) | ||
| 1594 | + continue; | ||
| 1595 | +#else | ||
| 1596 | if (plugin->flags & (1<<1)) //GST_PLUGIN_FLAG_BLACKLISTED | ||
| 1597 | continue; | ||
| 1598 | - | ||
| 1599 | - orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get_default (), | ||
| 1600 | - plugin->desc.name); | ||
| 1601 | +#endif | ||
| 1602 | + orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get (), | ||
| 1603 | + gst_plugin_get_name(plugin)); | ||
| 1604 | while (features) { | ||
| 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)); | ||
| 1609 | if (factory | ||
| 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 ) | ||
| 1615 | +#else | ||
| 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 ) | ||
| 1620 | +#endif | ||
| 1621 | + ) { | ||
| 1622 | + const GList *pads = gst_element_factory_get_static_pad_templates(factory); | ||
| 1623 | while (pads) { | ||
| 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); | ||
| 1633 | |||
| 1634 | + const char* bufferData = 0; | ||
| 1635 | + int bufferSize = 0; | ||
| 1636 | + | ||
| 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); | ||
| 1645 | +#else | ||
| 1646 | GstBuffer *buffer = gst_app_sink_pull_buffer(m_appSink); | ||
| 1647 | - | ||
| 1648 | + bufferData = (const char*)buffer->data; | ||
| 1649 | + bufferSize = buffer->size; | ||
| 1650 | QAudioFormat format = QGstUtils::audioFormatForBuffer(buffer); | ||
| 1651 | +#endif | ||
| 1652 | + | ||
| 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); | ||
| 1663 | } | ||
| 1664 | } | ||
| 1665 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1666 | + gst_sample_unref(sample); | ||
| 1667 | +#else | ||
| 1668 | gst_buffer_unref(buffer); | ||
| 1669 | +#endif | ||
| 1670 | } | ||
| 1671 | |||
| 1672 | return audioBuffer; | ||
| 1673 | @@ -539,7 +558,12 @@ void QGstreamerAudioDecoderSession::addAppSink() | ||
| 1674 | |||
| 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; | ||
| 1680 | +#else | ||
| 1681 | callbacks.new_buffer = &new_buffer; | ||
| 1682 | +#endif | ||
| 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; | ||
| 1688 | int duration = -1; | ||
| 1689 | |||
| 1690 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1691 | + if (m_playbin && gst_element_query_duration(m_playbin, format, &gstDuration)) | ||
| 1692 | + duration = gstDuration / 1000000; | ||
| 1693 | +#else | ||
| 1694 | if (m_playbin && gst_element_query_duration(m_playbin, &format, &gstDuration)) | ||
| 1695 | duration = gstDuration / 1000000; | ||
| 1696 | +#endif | ||
| 1697 | |||
| 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; | ||
| 1707 | |||
| 1708 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1709 | + if ( m_camerabin && gst_element_query_duration(m_camerabin, format, &duration)) | ||
| 1710 | +#else | ||
| 1711 | if ( m_camerabin && gst_element_query_position(m_camerabin, &format, &duration)) | ||
| 1712 | +#endif | ||
| 1713 | return duration / 1000000; | ||
| 1714 | else | ||
| 1715 | return 0; | ||
| 1716 | @@ -759,8 +763,13 @@ void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data) | ||
| 1717 | |||
| 1718 | if (m_camerabin) { | ||
| 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) { | ||
| 1723 | +#else | ||
| 1724 | GstElement *element = 0; | ||
| 1725 | while (gst_iterator_next(elements, (void**)&element) == GST_ITERATOR_OK) { | ||
| 1726 | +#endif | ||
| 1727 | gst_tag_setter_reset_tags(GST_TAG_SETTER(element)); | ||
| 1728 | |||
| 1729 | QMapIterator<QByteArray, QVariant> it(data); | ||
| 1730 | @@ -821,7 +830,11 @@ bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message) | ||
| 1731 | |||
| 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")) { | ||
| 1736 | +#else | ||
| 1737 | gst_structure_has_name(gm->structure, "preview-image")) { | ||
| 1738 | +#endif | ||
| 1739 | st = gst_message_get_structure(gm); | ||
| 1740 | |||
| 1741 | if (gst_structure_has_field_typed(st, "buffer", GST_TYPE_BUFFER)) { | ||
| 1742 | @@ -831,7 +844,11 @@ bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message) | ||
| 1743 | |||
| 1744 | QImage img; | ||
| 1745 | |||
| 1746 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1747 | GstCaps *caps = gst_buffer_get_caps(buffer); | ||
| 1748 | +#else | ||
| 1749 | + GstCaps *caps = gst_buffer_get_caps(buffer); | ||
| 1750 | +#endif | ||
| 1751 | if (caps) { | ||
| 1752 | GstStructure *structure = gst_caps_get_structure(caps, 0); | ||
| 1753 | gint width = 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); | ||
| 1757 | } | ||
| 1758 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1759 | + caps = gst_caps_simplify(caps); | ||
| 1760 | +#else | ||
| 1761 | gst_caps_do_simplify(caps); | ||
| 1762 | +#endif | ||
| 1763 | |||
| 1764 | |||
| 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); | ||
| 1769 | } | ||
| 1770 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1771 | + caps = gst_caps_simplify(caps); | ||
| 1772 | +#else | ||
| 1773 | gst_caps_do_simplify(caps); | ||
| 1774 | +#endif | ||
| 1775 | |||
| 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 | ||
| 1784 | |||
| 1785 | PKGCONFIG += \ | ||
| 1786 | - gstreamer-0.10 \ | ||
| 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 | ||
| 1797 | |||
| 1798 | -maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10 | ||
| 1799 | +maemo*:PKGCONFIG +=gstreamer-plugins-bad-$$GST_VERSION | ||
| 1800 | + | ||
| 1801 | +mir: { | ||
| 1802 | + DEFINES += HAVE_MIR | ||
| 1803 | +} | ||
| 1804 | |||
| 1805 | config_resourcepolicy { | ||
| 1806 | DEFINES += HAVE_RESOURCE_POLICY | ||
| 1807 | @@ -27,8 +30,8 @@ config_resourcepolicy { | ||
| 1808 | } | ||
| 1809 | |||
| 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 | ||
| 1816 | } | ||
| 1817 | |||
| 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 | ||
| 1823 | |||
| 1824 | SUBDIRS += \ | ||
| 1825 | audiodecoder \ | ||
| 1826 | - mediacapture \ | ||
| 1827 | mediaplayer | ||
| 1828 | |||
| 1829 | config_gstreamer_encodingprofiles { | ||
| 1830 | - SUBDIRS += camerabin | ||
| 1831 | +# SUBDIRS += camerabin | ||
| 1832 | } | ||
| 1833 | |||
| 1834 | OTHER_FILES += \ | ||
| 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)); | ||
| 1842 | |||
| 1843 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1844 | + gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, passImageFilter, this); | ||
| 1845 | +#else | ||
| 1846 | + gst_pad_add_buffer_probe(pad, G_CALLBACK(passImageFilter), this); | ||
| 1847 | +#endif | ||
| 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 += \ | ||
| 1856 | |||
| 1857 | OTHER_FILES += \ | ||
| 1858 | mediaplayer.json | ||
| 1859 | - | ||
| 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 | ||
| 1866 | } | ||
| 1867 | |||
| 1868 | + qWarning() << "Processing EOS!"; | ||
| 1869 | + | ||
| 1870 | popAndNotifyState(); | ||
| 1871 | } | ||
| 1872 | |||
| 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 | ||
| 1877 | @@ -59,7 +59,11 @@ | ||
| 1878 | #include <private/qgstreamervideorenderer_p.h> | ||
| 1879 | |||
| 1880 | #if defined(Q_WS_MAEMO_6) && defined(__arm__) | ||
| 1881 | -#include "qgstreamergltexturerenderer.h" | ||
| 1882 | +#include "private/qgstreamergltexturerenderer.h" | ||
| 1883 | +#endif | ||
| 1884 | + | ||
| 1885 | +#if defined(HAVE_MIR) && defined (__arm__) | ||
| 1886 | +#include "private/qgstreamermirtexturerenderer_p.h" | ||
| 1887 | #endif | ||
| 1888 | |||
| 1889 | #include "qgstreamerstreamscontrol.h" | ||
| 1890 | @@ -90,6 +94,9 @@ QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent): | ||
| 1891 | |||
| 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); | ||
| 1897 | #else | ||
| 1898 | m_videoRenderer = new QGstreamerVideoRenderer(this); | ||
| 1899 | #endif | ||
| 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); | ||
| 1906 | |||
| 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()); | ||
| 1910 | +#else | ||
| 1911 | orig_plugins = plugins = gst_default_registry_get_plugin_list (); | ||
| 1912 | +#endif | ||
| 1913 | |||
| 1914 | while (plugins) { | ||
| 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); | ||
| 1919 | |||
| 1920 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1921 | + if (GST_OBJECT_FLAG_IS_SET(plugin, GST_PLUGIN_FLAG_BLACKLISTED)) | ||
| 1922 | + continue; | ||
| 1923 | +#else | ||
| 1924 | if (plugin->flags & (1<<1)) //GST_PLUGIN_FLAG_BLACKLISTED | ||
| 1925 | continue; | ||
| 1926 | +#endif | ||
| 1927 | |||
| 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)); | ||
| 1932 | while (features) { | ||
| 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)); | ||
| 1937 | if (factory | ||
| 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 ) | ||
| 1944 | +#else | ||
| 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 ) | ||
| 1950 | +#endif | ||
| 1951 | + ) { | ||
| 1952 | + const GList *pads = gst_element_factory_get_static_pad_templates(factory); | ||
| 1953 | while (pads) { | ||
| 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 | ||
| 1962 | } GstPlayFlags; | ||
| 1963 | |||
| 1964 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1965 | +#define DEFAULT_RAW_CAPS \ | ||
| 1966 | + "video/x-surface; " \ | ||
| 1967 | + "text/plain; " \ | ||
| 1968 | + "text/x-pango-markup; " \ | ||
| 1969 | + "video/x-dvd-subpicture; " \ | ||
| 1970 | + "subpicture/x-pgs" \ | ||
| 1971 | + "video/x-raw" \ | ||
| 1972 | + "audio/x-raw" | ||
| 1973 | +#else | ||
| 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; " \ | ||
| 1980 | "subpicture/x-pgs" | ||
| 1981 | +#endif | ||
| 1982 | + | ||
| 1983 | static GstStaticCaps static_RawCaps = GST_STATIC_CAPS(DEFAULT_RAW_CAPS); | ||
| 1984 | |||
| 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); | ||
| 1989 | Q_UNUSED(result); | ||
| 1990 | - | ||
| 1991 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 1992 | + m_playbin = gst_element_factory_make("playbin", NULL); | ||
| 1993 | +#else | ||
| 1994 | m_playbin = gst_element_factory_make("playbin2", NULL); | ||
| 1995 | +#endif | ||
| 1996 | |||
| 1997 | if (m_playbin) { | ||
| 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); | ||
| 2002 | |||
| 2003 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2004 | + m_colorSpace = gst_element_factory_make("videoconvert", "ffmpegcolorspace-vo"); | ||
| 2005 | +#else | ||
| 2006 | m_colorSpace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-vo"); | ||
| 2007 | +#endif | ||
| 2008 | // might not get a parent, take ownership to avoid leak | ||
| 2009 | qt_gst_object_ref_sink(GST_OBJECT(m_colorSpace)); | ||
| 2010 | |||
| 2011 | @@ -214,7 +233,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent) | ||
| 2012 | |||
| 2013 | // add ghostpads | ||
| 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)); | ||
| 2018 | |||
| 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); | ||
| 2022 | |||
| 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); | ||
| 2026 | |||
| 2027 | if (usePlaybinVolume()) { | ||
| 2028 | updateVolume(); | ||
| 2029 | @@ -350,9 +369,13 @@ qint64 QGstreamerPlayerSession::position() const | ||
| 2030 | GstFormat format = GST_FORMAT_TIME; | ||
| 2031 | gint64 position = 0; | ||
| 2032 | |||
| 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; | ||
| 2036 | +#else | ||
| 2037 | if ( m_playbin && gst_element_query_position(m_playbin, &format, &position)) | ||
| 2038 | m_lastPosition = position / 1000000; | ||
| 2039 | - | ||
| 2040 | +#endif | ||
| 2041 | return m_lastPosition; | ||
| 2042 | } | ||
| 2043 | |||
| 2044 | @@ -482,9 +505,18 @@ bool QGstreamerPlayerSession::isAudioAvailable() const | ||
| 2045 | return m_audioAvailable; | ||
| 2046 | } | ||
| 2047 | |||
| 2048 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2049 | +static GstPadProbeReturn block_pad_cb(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) | ||
| 2050 | +#else | ||
| 2051 | static void block_pad_cb(GstPad *pad, gboolean blocked, gpointer user_data) | ||
| 2052 | +#endif | ||
| 2053 | { | ||
| 2054 | Q_UNUSED(pad); | ||
| 2055 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2056 | + Q_UNUSED(info); | ||
| 2057 | + Q_UNUSED(user_data); | ||
| 2058 | + return GST_PAD_PROBE_OK; | ||
| 2059 | +#else | ||
| 2060 | #ifdef DEBUG_PLAYBIN | ||
| 2061 | qDebug() << "block_pad_cb, blocked:" << blocked; | ||
| 2062 | #endif | ||
| 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); | ||
| 2066 | } | ||
| 2067 | +#endif | ||
| 2068 | } | ||
| 2069 | |||
| 2070 | void QGstreamerPlayerSession::updateVideoRenderer() | ||
| 2071 | @@ -537,7 +570,7 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) | ||
| 2072 | m_renderer = renderer; | ||
| 2073 | |||
| 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*/), | ||
| 2078 | "playbin_set"); | ||
| 2079 | #endif | ||
| 2080 | @@ -641,7 +674,11 @@ void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput) | ||
| 2081 | |||
| 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); | ||
| 2086 | +#else | ||
| 2087 | gst_pad_set_blocked_async(srcPad, true, &block_pad_cb, this); | ||
| 2088 | +#endif | ||
| 2089 | gst_object_unref(GST_OBJECT(srcPad)); | ||
| 2090 | |||
| 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); | ||
| 2098 | +#else | ||
| 2099 | gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0); | ||
| 2100 | +#endif | ||
| 2101 | |||
| 2102 | m_pendingVideoSink = 0; | ||
| 2103 | gst_object_unref(GST_OBJECT(srcPad)); | ||
| 2104 | @@ -768,12 +809,17 @@ void QGstreamerPlayerSession::finishVideoOutputChange() | ||
| 2105 | |||
| 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); | ||
| 2111 | +#else | ||
| 2112 | + gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0); | ||
| 2113 | +#endif | ||
| 2114 | + | ||
| 2115 | gst_object_unref(GST_OBJECT(srcPad)); | ||
| 2116 | |||
| 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 */), | ||
| 2122 | "playbin_finish"); | ||
| 2123 | #endif | ||
| 2124 | } | ||
| 2125 | @@ -838,6 +884,7 @@ bool QGstreamerPlayerSession::play() | ||
| 2126 | #ifdef DEBUG_PLAYBIN | ||
| 2127 | qDebug() << Q_FUNC_INFO; | ||
| 2128 | #endif | ||
| 2129 | + | ||
| 2130 | m_everPlayed = false; | ||
| 2131 | if (m_playbin) { | ||
| 2132 | m_pendingState = QMediaPlayer::PlayingState; | ||
| 2133 | @@ -1335,8 +1382,11 @@ void QGstreamerPlayerSession::getStreamsInfo() | ||
| 2134 | default: | ||
| 2135 | break; | ||
| 2136 | } | ||
| 2137 | - | ||
| 2138 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2139 | + if (tags && GST_IS_TAG_LIST(tags)) { | ||
| 2140 | +#else | ||
| 2141 | if (tags && gst_is_tag_list(tags)) { | ||
| 2142 | +#endif | ||
| 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() | ||
| 2147 | QSize aspectRatio; | ||
| 2148 | |||
| 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); | ||
| 2152 | +#else | ||
| 2153 | GstCaps *caps = gst_pad_get_negotiated_caps(pad); | ||
| 2154 | +#endif | ||
| 2155 | |||
| 2156 | if (caps) { | ||
| 2157 | const GstStructure *structure = gst_caps_get_structure(caps, 0); | ||
| 2158 | @@ -1419,7 +1473,11 @@ void QGstreamerPlayerSession::updateDuration() | ||
| 2159 | gint64 gstDuration = 0; | ||
| 2160 | int duration = -1; | ||
| 2161 | |||
| 2162 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2163 | + if (m_playbin && gst_element_query_duration(m_playbin, format, &gstDuration)) | ||
| 2164 | +#else | ||
| 2165 | if (m_playbin && gst_element_query_duration(m_playbin, &format, &gstDuration)) | ||
| 2166 | +#endif | ||
| 2167 | duration = gstDuration / 1000000; | ||
| 2168 | |||
| 2169 | if (m_duration != duration) { | ||
| 2170 | @@ -1475,7 +1533,11 @@ void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpo | ||
| 2171 | |||
| 2172 | // The rest | ||
| 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"); | ||
| 2176 | +#else | ||
| 2177 | GstStructure *extras = gst_structure_empty_new("extras"); | ||
| 2178 | +#endif | ||
| 2179 | |||
| 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); | ||
| 2188 | +#else | ||
| 2189 | GstCaps *sinkCaps = gst_pad_get_caps(sinkPad); | ||
| 2190 | +#endif | ||
| 2191 | |||
| 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")) { | ||
| 2199 | - | ||
| 2200 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2201 | + g_str_has_prefix(elementName, "decodebin")) { | ||
| 2202 | +#else | ||
| 2203 | + g_str_has_prefix(elementName, "decodebin2")) { | ||
| 2204 | +#endif | ||
| 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); | ||
| 2212 | +#endif | ||
| 2213 | } | ||
| 2214 | |||
| 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. | ||
| 2218 | } | ||
| 2219 | |||
| 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) | ||
| 2223 | +{ | ||
| 2224 | + Q_UNUSED(pad); | ||
| 2225 | + GstBuffer* buffer = GST_PAD_PROBE_INFO_BUFFER(info); | ||
| 2226 | + | ||
| 2227 | + QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession*>(user_data); | ||
| 2228 | + QMutexLocker locker(&session->m_videoProbeMutex); | ||
| 2229 | + | ||
| 2230 | + if (session->m_videoProbes.isEmpty()) | ||
| 2231 | + return GST_PAD_PROBE_OK; | ||
| 2232 | + | ||
| 2233 | + foreach (QGstreamerVideoProbeControl* probe, session->m_videoProbes) | ||
| 2234 | + probe->bufferProbed(buffer, gst_pad_get_current_caps(pad)); | ||
| 2235 | + | ||
| 2236 | + return GST_PAD_PROBE_OK; | ||
| 2237 | +} | ||
| 2238 | + | ||
| 2239 | +#else | ||
| 2240 | + | ||
| 2241 | +static gboolean QGstreamerPlayerSession::padVideoBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data) | ||
| 2242 | { | ||
| 2243 | Q_UNUSED(pad); | ||
| 2244 | |||
| 2245 | @@ -1749,6 +1840,7 @@ gboolean QGstreamerPlayerSession::padVideoBufferProbe(GstPad *pad, GstBuffer *bu | ||
| 2246 | |||
| 2247 | return TRUE; | ||
| 2248 | } | ||
| 2249 | +#endif | ||
| 2250 | |||
| 2251 | void QGstreamerPlayerSession::addProbe(QGstreamerAudioProbeControl* probe) | ||
| 2252 | { | ||
| 2253 | @@ -1766,6 +1858,24 @@ void QGstreamerPlayerSession::removeProbe(QGstreamerAudioProbeControl* probe) | ||
| 2254 | m_audioProbes.removeOne(probe); | ||
| 2255 | } | ||
| 2256 | |||
| 2257 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2258 | +GstPadProbeReturn QGstreamerPlayerSession::padAudioBufferProbe(GstPad *pad, GstPadProbeInfo* info, gpointer user_data) | ||
| 2259 | +{ | ||
| 2260 | + Q_UNUSED(pad); | ||
| 2261 | + GstBuffer* buffer = GST_PAD_PROBE_INFO_BUFFER(info); | ||
| 2262 | + | ||
| 2263 | + QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession*>(user_data); | ||
| 2264 | + QMutexLocker locker(&session->m_audioProbeMutex); | ||
| 2265 | + | ||
| 2266 | + if (session->m_audioProbes.isEmpty()) | ||
| 2267 | + return GST_PAD_PROBE_OK; | ||
| 2268 | + | ||
| 2269 | + foreach (QGstreamerAudioProbeControl* probe, session->m_audioProbes) | ||
| 2270 | + probe->bufferProbed(buffer, gst_pad_get_current_caps(pad)); | ||
| 2271 | + | ||
| 2272 | + return GST_PAD_PROBE_OK; | ||
| 2273 | +} | ||
| 2274 | +#else | ||
| 2275 | gboolean QGstreamerPlayerSession::padAudioBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data) | ||
| 2276 | { | ||
| 2277 | Q_UNUSED(pad); | ||
| 2278 | @@ -1781,7 +1891,7 @@ gboolean QGstreamerPlayerSession::padAudioBufferProbe(GstPad *pad, GstBuffer *bu | ||
| 2279 | |||
| 2280 | return TRUE; | ||
| 2281 | } | ||
| 2282 | - | ||
| 2283 | +#endif | ||
| 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() | ||
| 2288 | |||
| 2289 | GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); | ||
| 2290 | if (pad) { | ||
| 2291 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2292 | + gst_pad_remove_probe(pad, m_videoBufferProbeId); | ||
| 2293 | +#else | ||
| 2294 | gst_pad_remove_buffer_probe(pad, m_videoBufferProbeId); | ||
| 2295 | +#endif | ||
| 2296 | gst_object_unref(GST_OBJECT(pad)); | ||
| 2297 | } | ||
| 2298 | |||
| 2299 | @@ -1829,7 +1943,11 @@ void QGstreamerPlayerSession::addVideoBufferProbe() | ||
| 2300 | |||
| 2301 | GstPad *pad = gst_element_get_static_pad(m_videoSink, "sink"); | ||
| 2302 | if (pad) { | ||
| 2303 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2304 | + m_videoBufferProbeId = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, padVideoBufferProbe, this, NULL); | ||
| 2305 | +#else | ||
| 2306 | m_videoBufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padVideoBufferProbe), this); | ||
| 2307 | +#endif | ||
| 2308 | gst_object_unref(GST_OBJECT(pad)); | ||
| 2309 | } | ||
| 2310 | } | ||
| 2311 | @@ -1846,7 +1964,11 @@ void QGstreamerPlayerSession::removeAudioBufferProbe() | ||
| 2312 | |||
| 2313 | GstPad *pad = gst_element_get_static_pad(m_audioSink, "sink"); | ||
| 2314 | if (pad) { | ||
| 2315 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2316 | + gst_pad_remove_probe(pad, m_audioBufferProbeId); | ||
| 2317 | +#else | ||
| 2318 | gst_pad_remove_buffer_probe(pad, m_audioBufferProbeId); | ||
| 2319 | +#endif | ||
| 2320 | gst_object_unref(GST_OBJECT(pad)); | ||
| 2321 | } | ||
| 2322 | |||
| 2323 | @@ -1861,7 +1983,11 @@ void QGstreamerPlayerSession::addAudioBufferProbe() | ||
| 2324 | |||
| 2325 | GstPad *pad = gst_element_get_static_pad(m_audioSink, "sink"); | ||
| 2326 | if (pad) { | ||
| 2327 | +#if GST_CHECK_VERSION(1,0,0) | ||
| 2328 | + m_audioBufferProbeId = gst_pad_add_probe(pad, GST_PAD_PROBE_TYPE_BUFFER, padAudioBufferProbe, this, NULL); | ||
| 2329 | +#else | ||
| 2330 | m_audioBufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padAudioBufferProbe), this); | ||
| 2331 | +#endif | ||
| 2332 | gst_object_unref(GST_OBJECT(pad)); | ||
| 2333 | } | ||
| 2334 | } | ||
| 2335 | @@ -1894,7 +2020,7 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint | ||
| 2336 | length = qMin(length, guint64(1024)); | ||
| 2337 | |||
| 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); | ||
| 2341 | if (data) { | ||
| 2342 | session->m_isPlaylist = (QPlaylistFileParser::findPlaylistType(QString::fromUtf8(uri), 0, data, length) != QPlaylistFileParser::UNKNOWN); | ||
| 2343 | return; | ||
| 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: | ||
| 2349 | |||
| 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); | ||
| 2354 | +#else | ||
| 2355 | static gboolean padVideoBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); | ||
| 2356 | +#endif | ||
| 2357 | |||
| 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); | ||
| 2362 | +#else | ||
| 2363 | static gboolean padAudioBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data); | ||
| 2364 | +#endif | ||
| 2365 | |||
| 2366 | void endOfMediaReset(); | ||
| 2367 | |||
| 2368 | @@ -260,6 +268,7 @@ private: | ||
| 2369 | bool m_isLiveSource; | ||
| 2370 | |||
| 2371 | bool m_isPlaylist; | ||
| 2372 | + gulong pad_probe_id; | ||
| 2373 | }; | ||
| 2374 | |||
| 2375 | QT_END_NAMESPACE | ||
| 2376 | -- | ||
| 2377 | 2.0.0 | ||
| 2378 | |||
diff --git a/recipes-qt/qt5/qtmultimedia/0002-qtmultimedia.pro-Respect-OE_GSTREAMER_ENABLED-OE_GST.patch b/recipes-qt/qt5/qtmultimedia/0002-qtmultimedia.pro-Respect-OE_GSTREAMER_ENABLED-OE_GST.patch new file mode 100644 index 00000000..f0a9611c --- /dev/null +++ b/recipes-qt/qt5/qtmultimedia/0002-qtmultimedia.pro-Respect-OE_GSTREAMER_ENABLED-OE_GST.patch | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | From 8d0358d4d586daece0e683ba002fbab16fd53cd1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 3 | Date: Sat, 5 Jul 2014 09:10:02 +0200 | ||
| 4 | Subject: [PATCH 2/2] qtmultimedia.pro: Respect | ||
| 5 | OE_GSTREAMER_ENABLED,OE_GSTREAMER010_ENABLED and OE_OPENAL_ENABLED | ||
| 6 | |||
| 7 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 8 | --- | ||
| 9 | qtmultimedia.pro | 19 +++++++++++-------- | ||
| 10 | 1 file changed, 11 insertions(+), 8 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/qtmultimedia.pro b/qtmultimedia.pro | ||
| 13 | index 37f42a0..5a2a533 100644 | ||
| 14 | --- a/qtmultimedia.pro | ||
| 15 | +++ b/qtmultimedia.pro | ||
| 16 | @@ -1,7 +1,7 @@ | ||
| 17 | requires(qtHaveModule(gui)) | ||
| 18 | |||
| 19 | load(configure) | ||
| 20 | -qtCompileTest(openal) | ||
| 21 | +OE_OPENAL_ENABLED:qtCompileTest(openal) | ||
| 22 | win32 { | ||
| 23 | qtCompileTest(directshow) { | ||
| 24 | qtCompileTest(wshellitem) | ||
| 25 | @@ -22,13 +22,16 @@ win32 { | ||
| 26 | qtCompileTest(alsa) | ||
| 27 | qtCompileTest(pulseaudio) | ||
| 28 | !done_config_gstreamer { | ||
| 29 | - gstver=1.0 | ||
| 30 | - cache(GST_VERSION, set, gstver); | ||
| 31 | - qtCompileTest(gstreamer) { | ||
| 32 | - qtCompileTest(gstreamer_photography) | ||
| 33 | - qtCompileTest(gstreamer_encodingprofiles) | ||
| 34 | - qtCompileTest(gstreamer_appsrc) | ||
| 35 | - } else { | ||
| 36 | + OE_GSTREAMER_ENABLED { | ||
| 37 | + gstver=1.0 | ||
| 38 | + cache(GST_VERSION, set, gstver); | ||
| 39 | + qtCompileTest(gstreamer) { | ||
| 40 | + qtCompileTest(gstreamer_photography) | ||
| 41 | + qtCompileTest(gstreamer_encodingprofiles) | ||
| 42 | + qtCompileTest(gstreamer_appsrc) | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + !OE_GSTREAMER_ENABLED:OE_GSTREAMER010_ENABLED { | ||
| 46 | gstver=0.10 | ||
| 47 | cache(GST_VERSION, set, gstver); | ||
| 48 | # Force a re-run of the test | ||
| 49 | -- | ||
| 50 | 2.0.0 | ||
| 51 | |||
