dash: Add support for group-id in the stream-start event

This commit is contained in:
Sebastian Dröge 2013-07-23 10:04:42 +02:00
parent 580a94d18b
commit 493ee3383a
2 changed files with 25 additions and 5 deletions

View file

@ -692,6 +692,7 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux)
GstDashDemuxStream *stream; GstDashDemuxStream *stream;
GstActiveStream *active_stream; GstActiveStream *active_stream;
GstCaps *caps; GstCaps *caps;
GstEvent *event;
gchar *stream_id; gchar *stream_id;
active_stream = gst_mpdparser_get_active_stream_by_index (demux->client, i); 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 = stream_id =
gst_pad_create_stream_id_printf (stream->pad, gst_pad_create_stream_id_printf (stream->pad,
GST_ELEMENT_CAST (demux), "%d", i); 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); g_free (stream_id);
gst_dash_demux_stream_push_event (stream, gst_event_new_caps (caps)); 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_download_task (demux);
gst_dash_demux_resume_stream_task (demux); gst_dash_demux_resume_stream_task (demux);
seek_quit: seek_quit:
gst_event_unref (event); gst_event_unref (event);
return ret; return ret;
} }
@ -1684,8 +1702,7 @@ gst_dash_demux_download_loop (GstDashDemux * demux)
} else if (pos > 0) { } else if (pos > 0) {
/* we're ahead, wait a little */ /* we're ahead, wait a little */
GST_DEBUG_OBJECT (demux, GST_DEBUG_OBJECT (demux, "Waiting for next segment to be created");
"Waiting for next segment to be created");
gst_mpd_client_set_segment_index (fragment_stream, gst_mpd_client_set_segment_index (fragment_stream,
fragment_stream->segment_idx - 1); fragment_stream->segment_idx - 1);
gst_dash_demux_download_wait (demux, time_diff); gst_dash_demux_download_wait (demux, time_diff);

View file

@ -106,6 +106,9 @@ struct _GstDashDemux
GstElement parent; GstElement parent;
GstPad *sinkpad; GstPad *sinkpad;
gboolean have_group_id;
guint group_id;
GSList *streams; GSList *streams;
GSList *next_periods; GSList *next_periods;
GMutex streams_lock; GMutex streams_lock;