diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-01-22 16:23:43 +0100 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2010-01-22 16:36:46 +0100 |
commit | 12af63394225526e0d98267978007e726040dc2f (patch) | |
tree | a577baf161e2bae8fbdc6e9d13ca6cb0ec1badac | |
parent | 8ebb6be80314bcc9d17ca4f7688c395fe10d7929 (diff) |
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
-rw-r--r-- | gst/playback/gsturidecodebin.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index 28b985023..b45e4bf0f 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); |