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

This commit is contained in:
Sebastian Dröge 2013-07-22 15:22:55 +02:00
parent 1a0278ed64
commit 57dd1189d5
2 changed files with 22 additions and 0 deletions

View file

@ -397,6 +397,9 @@ gst_matroska_demux_reset (GstElement * element)
demux->num_t_streams = 0; demux->num_t_streams = 0;
demux->num_v_streams = 0; demux->num_v_streams = 0;
demux->have_group_id = FALSE;
demux->group_id = G_MAXUINT;
/* reset media info */ /* reset media info */
g_free (demux->common.writing_app); g_free (demux->common.writing_app);
demux->common.writing_app = NULL; demux->common.writing_app = NULL;
@ -1373,8 +1376,24 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml)
stream_id = stream_id =
gst_pad_create_stream_id_printf (context->pad, GST_ELEMENT_CAST (demux), gst_pad_create_stream_id_printf (context->pad, GST_ELEMENT_CAST (demux),
"%03u", context->uid); "%03u", context->uid);
stream_start =
gst_pad_get_sticky_event (demux->common.sinkpad, GST_EVENT_STREAM_START,
0);
if (stream_start) {
if (gst_event_parse_group_id (stream_start, &demux->group_id))
demux->have_group_id = TRUE;
else
demux->have_group_id = FALSE;
gst_event_unref (stream_start);
} else if (!demux->have_group_id) {
demux->have_group_id = TRUE;
demux->group_id = gst_util_group_id_next ();
}
stream_start = gst_event_new_stream_start (stream_id); stream_start = gst_event_new_stream_start (stream_id);
g_free (stream_id); g_free (stream_id);
if (demux->have_group_id)
gst_event_set_group_id (stream_start, demux->group_id);
stream_flags = GST_STREAM_FLAG_NONE; stream_flags = GST_STREAM_FLAG_NONE;
if (context->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE) if (context->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)
stream_flags |= GST_STREAM_FLAG_SPARSE; stream_flags |= GST_STREAM_FLAG_SPARSE;

View file

@ -55,6 +55,9 @@ typedef struct _GstMatroskaDemux {
guint num_a_streams; guint num_a_streams;
guint num_t_streams; guint num_t_streams;
guint group_id;
gboolean have_group_id;
/* state */ /* state */
gboolean streaming; gboolean streaming;
guint level_up; guint level_up;