From b5f7a621bbbe6d5f5152083e71e77518c0991b4a Mon Sep 17 00:00:00 2001 From: Brendan Long Date: Thu, 13 Jun 2013 11:08:20 -0600 Subject: [PATCH] playbin: Emit {audio,text,video}-changed signals when pads are removed https://bugzilla.gnome.org/show_bug.cgi?id=702195 --- gst/playback/gstplaybin2.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c index 016c11ba90..99f8ce5b9c 100644 --- a/gst/playback/gstplaybin2.c +++ b/gst/playback/gstplaybin2.c @@ -3182,6 +3182,7 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) GstPad *peer; GstElement *combiner; GstSourceCombine *combine; + int signal = -1; playbin = group->playbin; @@ -3218,6 +3219,23 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) g_ptr_array_remove (combine->channels, peer); GST_DEBUG_OBJECT (playbin, "pad %p removed from array", peer); + /* get the correct type-changed signal */ + switch (combine->type) { + case GST_PLAY_SINK_TYPE_VIDEO: + case GST_PLAY_SINK_TYPE_VIDEO_RAW: + signal = SIGNAL_VIDEO_CHANGED; + break; + case GST_PLAY_SINK_TYPE_AUDIO: + case GST_PLAY_SINK_TYPE_AUDIO_RAW: + signal = SIGNAL_AUDIO_CHANGED; + break; + case GST_PLAY_SINK_TYPE_TEXT: + signal = SIGNAL_TEXT_CHANGED; + break; + default: + signal = -1; + } + if (!combine->channels->len && combine->combiner) { GST_DEBUG_OBJECT (playbin, "all combiner sinkpads removed"); GST_DEBUG_OBJECT (playbin, "removing combiner %p", combine->combiner); @@ -3249,20 +3267,21 @@ pad_removed_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) exit: GST_SOURCE_GROUP_UNLOCK (group); + if (signal >= 0) + g_signal_emit (G_OBJECT (playbin), gst_play_bin_signals[signal], 0, NULL); + return; /* ERRORS */ not_linked: { GST_DEBUG_OBJECT (playbin, "pad not linked"); - GST_SOURCE_GROUP_UNLOCK (group); - return; + goto exit; } no_combiner: { GST_DEBUG_OBJECT (playbin, "combiner not found"); - GST_SOURCE_GROUP_UNLOCK (group); - return; + goto exit; } }