servicemp3: fix match_sinktype for GStreamer 1.0
authorAthanasios Oikonomou <athoik@gmail.com>
Sun, 12 Oct 2014 07:51:13 +0000 (10:51 +0300)
committerErik Slagter <erik@openpli.org>
Sun, 12 Oct 2014 13:30:19 +0000 (15:30 +0200)
In getPlayPosition the match_sinktype was wrong, because now it accepts GValue.
Sink find needs a custom search method because the sink name changes every time.
So match_sinktype was upgraded to work with GStreamer 1.0.

Signed-off-by: Erik Slagter <erik@openpli.org>

lib/service/servicemp3.cpp
lib/service/servicemp3.h

index 0841afc..51db7fc 100644 (file)
@@ -896,10 +896,18 @@ RESULT eServiceMP3::seekRelative(int direction, pts_t to)
        return seekTo(ppos);
 }
 
+#if GST_VERSION_MAJOR < 1
 gint eServiceMP3::match_sinktype(GstElement *element, gpointer type)
 {
        return strcmp(g_type_name(G_OBJECT_TYPE(element)), (const char*)type);
 }
+#else
+gint eServiceMP3::match_sinktype(const GValue *velement, const gchar *type)
+{
+       GstElement *element = GST_ELEMENT_CAST(g_value_get_object(velement));
+       return strcmp(g_type_name(G_OBJECT_TYPE(element)), type);
+}
+#endif
 
 RESULT eServiceMP3::getPlayPosition(pts_t &pts)
 {
@@ -1545,7 +1553,7 @@ void eServiceMP3::gstBusCall(GstMessage *msg)
 #else
                                        if (gst_iterator_find_custom(children, (GCompareFunc)match_sinktype, &element, (gpointer)"GstDVBAudioSink"))
                                        {
-                                               audioSink = g_value_dup_object(&element);
+                                               audioSink = GST_ELEMENT_CAST(g_value_get_object(&element));
                                                g_value_unset(&element);
                                        }
 #endif
@@ -1556,7 +1564,7 @@ void eServiceMP3::gstBusCall(GstMessage *msg)
 #else
                                        if (gst_iterator_find_custom(children, (GCompareFunc)match_sinktype, &element, (gpointer)"GstDVBVideoSink"))
                                        {
-                                               videoSink = g_value_dup_object(&element);
+                                               videoSink = GST_ELEMENT_CAST(g_value_get_object(&element));
                                                g_value_unset(&element);
                                        }
 #endif
index 37bfb1b..5e2e966 100644 (file)
@@ -298,7 +298,11 @@ private:
        GstPad* gstCreateSubtitleSink(eServiceMP3* _this, subtype_t type);
        void gstPoll(ePtr<GstMessageContainer> const &);
        static void playbinNotifySource(GObject *object, GParamSpec *unused, gpointer user_data);
+#if GST_VERSION_MAJOR < 1
        static gint match_sinktype(GstElement *element, gpointer type);
+#else
+       static gint match_sinktype(const GValue *velement, const gchar *type);
+#endif
        static void handleElementAdded(GstBin *bin, GstElement *element, gpointer user_data);
 
        struct subtitle_page_t