From: Wim Taymans Date: Fri, 22 Jan 2010 15:23:43 +0000 (+0100) Subject: uridecodebin: handle raw sources about-to-finish signals X-Git-Tag: 1.19.3~511^2~8834 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=12af63394225526e0d98267978007e726040dc2f;p=platform%2Fupstream%2Fgstreamer.git uridecodebin: handle raw sources about-to-finish signals When we are dealing with a source that produces raw audio/video, we don't use a decodebin2 to decode the data and we thus don't have the drained/about-to-finish signal emited. To fix this, we add a padprobe on the source pads and emit the drained signal ourselves. This then makes playbin2 emit the about-to-finish signal for raw sources such as cdda:// Fixes #607116 --- diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 28b9850..b45e4bf 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -781,6 +781,34 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last, gst_element_add_pad (GST_ELEMENT_CAST (decoder), newpad); } + +static gboolean +source_pad_event_probe (GstPad * pad, GstEvent * event, + GstURIDecodeBin * decoder) +{ + GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder); + + if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { + GST_DEBUG_OBJECT (pad, "we received EOS"); + + g_signal_emit (G_OBJECT (decoder), + gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL); + } + /* never drop events */ + return TRUE; +} + +/* called when we found a raw pad on the source element. We need to set up a + * padprobe to detect EOS before exposing the pad. */ +static void +expose_decoded_pad (GstElement * element, GstPad * pad, + GstURIDecodeBin * decoder) +{ + gst_pad_add_event_probe (pad, G_CALLBACK (source_pad_event_probe), decoder); + + new_decoded_pad_cb (element, pad, FALSE, decoder); +} + static void pad_removed_cb (GstElement * element, GstPad * pad, GstURIDecodeBin * decoder) { @@ -1093,7 +1121,7 @@ analyse_source (GstURIDecodeBin * decoder, gboolean * is_raw, } else { outelem = decoder->source; } - new_decoded_pad_cb (outelem, pad, FALSE, decoder); + expose_decoded_pad (outelem, pad, decoder); } gst_object_unref (pad); break; @@ -1547,7 +1575,7 @@ source_new_pad (GstElement * element, GstPad * pad, GstURIDecodeBin * bin) /* it's all raw, create output pads. */ GST_URI_DECODE_BIN_UNLOCK (bin); gst_caps_unref (rawcaps); - new_decoded_pad_cb (element, pad, FALSE, bin); + expose_decoded_pad (element, pad, bin); return; } gst_caps_unref (rawcaps);