From 3d3d2a4967ba079a3e6df82cdc89f839865e6649 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 16 Oct 2015 14:15:23 +0200 Subject: GStreamer: fix compilation with version < 0.10.31. Qt 5.4 and earlier required GStreamer 0.10.24 as minimum version. Qt 5.5 added code that requires 0.10.31, this code is now ifdef'd and we now support again 0.10.24. Task-number: QTBUG-48353 Change-Id: Ie708a33c0515874b003ce26a3400475075d316ca Reviewed-by: Christian Stromme --- src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp | 5 +---- .../gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp | 7 +++++++ src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src/plugins/gstreamer/mediaplayer') diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp index ac0fe2a77..fdf43062f 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp @@ -76,13 +76,10 @@ static const QGstreamerMetaDataKeyLookup *qt_gstreamerMetaDataKeys() // Music metadataKeys->insert(GST_TAG_ALBUM, QMediaMetaData::AlbumTitle); -#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 25) +#if GST_CHECK_VERSION(0, 10, 25) metadataKeys->insert(GST_TAG_ALBUM_ARTIST, QMediaMetaData::AlbumArtist); #endif metadataKeys->insert(GST_TAG_ARTIST, QMediaMetaData::ContributingArtist); -#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 19) - metadataKeys->insert(GST_TAG_COMPOSER, QMediaMetaData::Composer); -#endif //metadataKeys->insert(0, QMediaMetaData::Conductor); //metadataKeys->insert(0, QMediaMetaData::Lyrics); //metadataKeys->insert(0, QMediaMetaData::Mood); diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp index 004d561ae..b895c4d86 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerserviceplugin.cpp @@ -83,8 +83,15 @@ QMultimedia::SupportEstimate QGstreamerPlayerServicePlugin::hasSupport(const QSt static bool isDecoderOrDemuxer(GstElementFactory *factory) { +#if GST_CHECK_VERSION(0, 10 ,31) return gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DEMUXER) || gst_element_factory_list_is_type(factory, GST_ELEMENT_FACTORY_TYPE_DECODER); +#else + return (factory + && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0 + || qstrcmp(factory->details.klass, "Codec/Decoder/Video") == 0 + || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )); +#endif } void QGstreamerPlayerServicePlugin::updateSupportedMimeTypes() const diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 4dce34113..c3d20e790 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -388,7 +388,7 @@ QMediaTimeRange QGstreamerPlayerSession::availablePlaybackRanges() const if (duration() <= 0) return ranges; -#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 31) +#if GST_CHECK_VERSION(0, 10, 31) //GST_FORMAT_TIME would be more appropriate, but unfortunately it's not supported. //with GST_FORMAT_PERCENT media is treated as encoded with constant bitrate. GstQuery* query = gst_query_new_buffering(GST_FORMAT_PERCENT); @@ -1637,7 +1637,7 @@ void QGstreamerPlayerSession::updateMuted() } } -#if (GST_VERSION_MAJOR == 0) && ((GST_VERSION_MINOR < 10) || (GST_VERSION_MICRO < 33)) +#if !GST_CHECK_VERSION(0, 10, 33) static gboolean factory_can_src_any_caps (GstElementFactory *factory, const GstCaps *caps) { GList *templates; @@ -1653,7 +1653,7 @@ static gboolean factory_can_src_any_caps (GstElementFactory *factory, const GstC if (templ->direction == GST_PAD_SRC) { GstCaps *templcaps = gst_static_caps_get(&templ->static_caps); - if (gst_caps_can_intersect(caps, templcaps)) { + if (qt_gst_caps_can_intersect(caps, templcaps)) { gst_caps_unref(templcaps); return TRUE; } @@ -1685,7 +1685,7 @@ GstAutoplugSelectResult QGstreamerPlayerSession::handleAutoplugSelect(GstBin *bi GstCaps *sinkCaps = gst_pad_get_caps(sinkPad); #endif -#if (GST_VERSION_MAJOR == 0) && ((GST_VERSION_MINOR < 10) || (GST_VERSION_MICRO < 33)) +#if !GST_CHECK_VERSION(0, 10, 33) if (!factory_can_src_any_caps(factory, sinkCaps)) #else if (!gst_element_factory_can_src_any_caps(factory, sinkCaps)) -- cgit v1.2.3