gesdemux: Create proper stream-ids

This commit is contained in:
Thibault Saunier 2019-07-03 12:09:23 -04:00
parent b3bac67f58
commit e9e24a23ba

View file

@ -163,6 +163,46 @@ error_loading_asset_cb (GESProject * project, GError * error, gchar * id,
g_main_loop_quit (data->ml); g_main_loop_quit (data->ml);
} }
static gboolean
ges_demux_src_probe (GstPad * pad, GstPadProbeInfo * info, GstElement * parent)
{
GstEvent *event = info->data;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_STREAM_START:
{
const gchar *stream_id;
gchar *new_stream_id;
guint stream_group;
gst_event_parse_stream_start (event, &stream_id);
gst_event_parse_group_id (event, &stream_group);
new_stream_id =
gst_pad_create_stream_id (pad, GST_ELEMENT (parent), stream_id);
gst_event_unref (event);
event = gst_event_new_stream_start (new_stream_id);
gst_event_set_group_id (event, stream_group);
g_free (new_stream_id);
break;
}
default:
break;
}
info->data = event;
return GST_PAD_PROBE_OK;
}
static gboolean
ges_demux_set_srcpad_probe (GstElement * element, GstPad * pad,
gpointer user_data)
{
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
(GstPadProbeCallback) ges_demux_src_probe, element, NULL);
return TRUE;
}
static gboolean static gboolean
ges_demux_create_timeline (GESDemux * self, gchar * uri, GError ** error) ges_demux_create_timeline (GESDemux * self, gchar * uri, GError ** error)
{ {
@ -203,6 +243,8 @@ done:
GST_INFO_OBJECT (self, "Timeline properly loaded: %" GST_PTR_FORMAT, GST_INFO_OBJECT (self, "Timeline properly loaded: %" GST_PTR_FORMAT,
data.timeline); data.timeline);
ges_base_bin_set_timeline (GES_BASE_BIN (self), data.timeline); ges_base_bin_set_timeline (GES_BASE_BIN (self), data.timeline);
gst_element_foreach_src_pad (GST_ELEMENT (self), ges_demux_set_srcpad_probe,
NULL);
g_main_context_pop_thread_default (ctx); g_main_context_pop_thread_default (ctx);