mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
decodebin3: Store stream-start event on output pad before exposing it
It's required for users to be able to figure out associated GstStream object with a pad on pad-added callback. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/880>
This commit is contained in:
parent
825eea9545
commit
89c663616a
2 changed files with 26 additions and 0 deletions
|
@ -2262,6 +2262,20 @@ reconfigure_output_stream (DecodebinOutputStream * output,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (output->src_exposed == FALSE) {
|
if (output->src_exposed == FALSE) {
|
||||||
|
GstEvent *stream_start;
|
||||||
|
|
||||||
|
stream_start = gst_pad_get_sticky_event (slot->src_pad,
|
||||||
|
GST_EVENT_STREAM_START, 0);
|
||||||
|
|
||||||
|
/* Ensure GstStream is accesiable from pad-added callback */
|
||||||
|
if (stream_start) {
|
||||||
|
gst_pad_store_sticky_event (output->src_pad, stream_start);
|
||||||
|
gst_event_unref (stream_start);
|
||||||
|
} else {
|
||||||
|
GST_WARNING_OBJECT (slot->src_pad,
|
||||||
|
"Pad has no stored stream-start event");
|
||||||
|
}
|
||||||
|
|
||||||
output->src_exposed = TRUE;
|
output->src_exposed = TRUE;
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (dbin), output->src_pad);
|
gst_element_add_pad (GST_ELEMENT_CAST (dbin), output->src_pad);
|
||||||
}
|
}
|
||||||
|
|
|
@ -541,6 +541,7 @@ add_output_pad (GstURIDecodeBin3 * dec, GstPad * target_pad)
|
||||||
{
|
{
|
||||||
OutputPad *output;
|
OutputPad *output;
|
||||||
gchar *pad_name;
|
gchar *pad_name;
|
||||||
|
GstEvent *stream_start;
|
||||||
|
|
||||||
output = g_slice_new0 (OutputPad);
|
output = g_slice_new0 (OutputPad);
|
||||||
|
|
||||||
|
@ -554,6 +555,17 @@ add_output_pad (GstURIDecodeBin3 * dec, GstPad * target_pad)
|
||||||
g_free (pad_name);
|
g_free (pad_name);
|
||||||
|
|
||||||
gst_pad_set_active (output->ghost_pad, TRUE);
|
gst_pad_set_active (output->ghost_pad, TRUE);
|
||||||
|
|
||||||
|
stream_start = gst_pad_get_sticky_event (target_pad,
|
||||||
|
GST_EVENT_STREAM_START, 0);
|
||||||
|
if (stream_start) {
|
||||||
|
gst_pad_store_sticky_event (output->ghost_pad, stream_start);
|
||||||
|
gst_event_unref (stream_start);
|
||||||
|
} else {
|
||||||
|
GST_WARNING_OBJECT (target_pad,
|
||||||
|
"Exposing pad without stored stream-start event");
|
||||||
|
}
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (dec), output->ghost_pad);
|
gst_element_add_pad (GST_ELEMENT (dec), output->ghost_pad);
|
||||||
|
|
||||||
output->probe_id =
|
output->probe_id =
|
||||||
|
|
Loading…
Reference in a new issue