From 493ee3383a0aee98e92d1578020b4a90176591cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 23 Jul 2013 10:04:42 +0200 Subject: [PATCH] dash: Add support for group-id in the stream-start event --- ext/dash/gstdashdemux.c | 27 ++++++++++++++++++++++----- ext/dash/gstdashdemux.h | 3 +++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index 01781cea3d..f30de900b3 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -692,6 +692,7 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux) GstDashDemuxStream *stream; GstActiveStream *active_stream; GstCaps *caps; + GstEvent *event; gchar *stream_id; active_stream = gst_mpdparser_get_active_stream_by_index (demux->client, i); @@ -719,7 +720,24 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux) stream_id = gst_pad_create_stream_id_printf (stream->pad, GST_ELEMENT_CAST (demux), "%d", i); - gst_pad_push_event (stream->pad, gst_event_new_stream_start (stream_id)); + + event = + gst_pad_get_sticky_event (demux->sinkpad, GST_EVENT_STREAM_START, 0); + if (event) { + if (gst_event_parse_group_id (event, &demux->group_id)) + demux->have_group_id = TRUE; + else + demux->have_group_id = FALSE; + gst_event_unref (event); + } else if (!demux->have_group_id) { + demux->have_group_id = TRUE; + demux->group_id = gst_util_group_id_next (); + } + event = gst_event_new_stream_start (stream_id); + if (demux->have_group_id) + gst_event_set_group_id (event, demux->group_id); + + gst_pad_push_event (stream->pad, event); g_free (stream_id); gst_dash_demux_stream_push_event (stream, gst_event_new_caps (caps)); @@ -875,7 +893,7 @@ gst_dash_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) gst_dash_demux_resume_download_task (demux); gst_dash_demux_resume_stream_task (demux); -seek_quit: + seek_quit: gst_event_unref (event); return ret; } @@ -1526,7 +1544,7 @@ gst_dash_demux_refresh_mpd (GstDashDemux * demux) if (!new_stream) { GST_DEBUG_OBJECT (demux, - "Stream of index %d is missing from manifest update", + "Stream of index %d is missing from manifest update", demux_stream->index); return GST_FLOW_EOS; } @@ -1684,8 +1702,7 @@ gst_dash_demux_download_loop (GstDashDemux * demux) } else if (pos > 0) { /* we're ahead, wait a little */ - GST_DEBUG_OBJECT (demux, - "Waiting for next segment to be created"); + GST_DEBUG_OBJECT (demux, "Waiting for next segment to be created"); gst_mpd_client_set_segment_index (fragment_stream, fragment_stream->segment_idx - 1); gst_dash_demux_download_wait (demux, time_diff); diff --git a/ext/dash/gstdashdemux.h b/ext/dash/gstdashdemux.h index e5496ff755..44ad3465f5 100644 --- a/ext/dash/gstdashdemux.h +++ b/ext/dash/gstdashdemux.h @@ -106,6 +106,9 @@ struct _GstDashDemux GstElement parent; GstPad *sinkpad; + gboolean have_group_id; + guint group_id; + GSList *streams; GSList *next_periods; GMutex streams_lock;