Commit 12af6339 authored by Wim Taymans's avatar Wim Taymans
Browse files

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
parent 8ebb6be8
......@@ -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);
......@@ -1547,7 +1575,7 @@ source_new_pad (GstElement * element, GstPad * pad, GstURIDecodeBin * bin)
/* it's all raw, create output pads. */
gst_caps_unref (rawcaps);
new_decoded_pad_cb (element, pad, FALSE, bin);
expose_decoded_pad (element, pad, bin);
gst_caps_unref (rawcaps);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment