From cf7da52701458cf2386a989e67072f4366272dac Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 20 Jun 2008 09:19:59 +0000 Subject: [PATCH] gst/playback/gstplaybin2.c: Implement the source property, emit notify when it changes in the underlying uridecodebin. Original commit message from CVS: * gst/playback/gstplaybin2.c: (gst_play_bin_get_property), (notify_source), (activate_group): Implement the source property, emit notify when it changes in the underlying uridecodebin. --- ChangeLog | 7 +++++++ gst/playback/gstplaybin2.c | 31 ++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9d4a8e7216..17f8a70aad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-20 Wim Taymans + + * gst/playback/gstplaybin2.c: (gst_play_bin_get_property), + (notify_source), (activate_group): + Implement the source property, emit notify when it changes in the + underlying uridecodebin. + 2008-06-20 Wim Taymans * tests/examples/seek/seek.c: (stop_cb): diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index f39b4fa432..0abd1d8408 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -362,6 +362,9 @@ struct _GstPlayBin /* our play sink */ GstPlaySink *playsink; + /* the last activated source */ + GstElement *source; + GValueArray *elements; /* factories we can use for selecting elements */ }; @@ -1299,7 +1302,12 @@ gst_play_bin_get_property (GObject * object, guint prop_id, GValue * value, break; } case PROP_SOURCE: + { + GST_OBJECT_LOCK (playbin); + g_value_set_object (value, playbin->source); + GST_OBJECT_UNLOCK (playbin); break; + } case PROP_FLAGS: g_value_set_flags (value, gst_play_sink_get_flags (playbin->playsink)); break; @@ -1815,12 +1823,31 @@ autoplug_select_cb (GstElement * decodebin, GstPad * pad, return GST_AUTOPLUG_SELECT_EXPOSE; } +static void +notify_source (GstElement * uridecodebin, GParamSpec * pspec, + GstSourceGroup * group) +{ + GstPlayBin *playbin; + GstElement *source; + + playbin = group->playbin; + + GST_OBJECT_LOCK (playbin); + g_object_get (group->uridecodebin, "source", &source, NULL); + if (playbin->source) + gst_object_unref (playbin->source); + playbin->source = source; + GST_OBJECT_UNLOCK (playbin); + + g_object_notify (G_OBJECT (playbin), "source"); +} + /* must be called with PLAY_BIN_LOCK */ static gboolean activate_group (GstPlayBin * playbin, GstSourceGroup * group) { GstElement *uridecodebin; - GstElement *suburidecodebin; + GstElement *suburidecodebin = NULL; g_return_val_if_fail (group->valid, FALSE); g_return_val_if_fail (!group->active, FALSE); @@ -1851,6 +1878,8 @@ activate_group (GstPlayBin * playbin, GstSourceGroup * group) group); g_signal_connect (uridecodebin, "no-more-pads", G_CALLBACK (no_more_pads_cb), group); + g_signal_connect (uridecodebin, "notify::source", G_CALLBACK (notify_source), + group); /* we have 1 pending no-more-pads */ group->pending = 1;