}
break;
case GST_EVENT_EOS:
- /* FIXME : Make sure this makes sense ... */
- if (TRUE) {
+ input->saw_eos = TRUE;
+ if (all_inputs_are_eos (input->dbin)) {
GST_DEBUG_OBJECT (pad, "real input pad, marking as EOS");
- input->saw_eos = TRUE;
check_all_streams_for_eos (input->dbin);
- ret = GST_PAD_PROBE_DROP;
} else {
- MultiQueueSlot *slot;
+ GstPad *peer = gst_pad_get_peer (input->srcpad);
+ if (peer) {
+ /* Send custom-eos event to multiqueue slot */
+ GstStructure *s;
+ GstEvent *event;
- g_mutex_lock (&input->dbin->selection_lock);
- slot = get_slot_for_input (input->dbin, input);
- g_mutex_unlock (&input->dbin->selection_lock);
-
- slot->drain_eos = input->drain_eos;
-
- if (input->drain_eos) {
GST_DEBUG_OBJECT (pad,
- "Got EOS at end of input stream (drain_eos:%d) Dropping.",
- input->drain_eos);
- ret = GST_PAD_PROBE_DROP;
+ "Got EOS end of input stream, post custom-eos");
+ s = gst_structure_new_empty ("decodebin3-custom-eos");
+ event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s);
+ gst_pad_send_event (peer, event);
+ gst_object_unref (peer);
} else {
- GST_DEBUG_OBJECT (pad,
- "Got EOS at end of input stream (drain_eos:%d) Passing.",
- input->drain_eos);
+ GST_FIXME_OBJECT (pad, "No peer, what should we do ?");
}
}
+ ret = GST_PAD_PROBE_DROP;
break;
case GST_EVENT_FLUSH_STOP:
GST_DEBUG_OBJECT (pad, "Clear saw_eos flag");
gboolean drain_eos;
+ gboolean is_drained;
+
DecodebinOutputStream *output;
} MultiQueueSlot;
"Got a STREAM_START event without a GstStream");
break;
}
+ slot->is_drained = FALSE;
stream_id = gst_stream_get_stream_id (stream);
GST_DEBUG_OBJECT (pad, "Stream Start '%s'", stream_id);
if (slot->active_stream == NULL) {
/* FIXME : Figure out */
GST_FIXME_OBJECT (pad, "EOS on multiqueue source pad. input:%p",
slot->input);
+ slot->is_drained = TRUE;
if (slot->input == NULL) {
GstPad *peer;
GST_DEBUG_OBJECT (pad,
ret = GST_PAD_PROBE_HANDLED;
}
break;
+ case GST_EVENT_CUSTOM_DOWNSTREAM:
+ if (gst_event_has_name (ev, "decodebin3-custom-eos")) {
+ slot->is_drained = TRUE;
+ SELECTION_LOCK (dbin);
+ if (slot->input == NULL) {
+ GST_DEBUG_OBJECT (pad,
+ "Got custom-eos from null input stream, remove output stream");
+ /* Remove the output */
+ if (slot->output) {
+ DecodebinOutputStream *output = slot->output;
+ dbin->output_streams =
+ g_list_remove (dbin->output_streams, output);
+ free_output_stream (dbin, output);
+ }
+ }
+ SELECTION_UNLOCK (dbin);
+ ret = GST_PAD_PROBE_DROP;
+ }
+ break;
default:
break;
}