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

This commit is contained in:
Sebastian Dröge 2013-07-23 10:15:58 +02:00
parent a68733ea91
commit 4ec7baa61a
2 changed files with 23 additions and 1 deletions

View file

@ -338,6 +338,8 @@ gst_flups_demux_reset (GstFluPSDemux * demux)
gst_segment_init (&demux->sink_segment, GST_FORMAT_UNDEFINED); gst_segment_init (&demux->sink_segment, GST_FORMAT_UNDEFINED);
gst_segment_init (&demux->src_segment, GST_FORMAT_TIME); gst_segment_init (&demux->src_segment, GST_FORMAT_TIME);
gst_flups_demux_flush (demux); gst_flups_demux_flush (demux);
demux->have_group_id = FALSE;
demux->group_id = G_MAXUINT;
} }
static GstFluPSStream * static GstFluPSStream *
@ -349,6 +351,7 @@ gst_flups_demux_create_stream (GstFluPSDemux * demux, gint id, gint stream_type)
GstFluPSDemuxClass *klass = GST_FLUPS_DEMUX_GET_CLASS (demux); GstFluPSDemuxClass *klass = GST_FLUPS_DEMUX_GET_CLASS (demux);
GstCaps *caps; GstCaps *caps;
GstClockTime threshold = SEGMENT_THRESHOLD; GstClockTime threshold = SEGMENT_THRESHOLD;
GstEvent *event;
gchar *stream_id; gchar *stream_id;
name = NULL; name = NULL;
@ -472,7 +475,23 @@ gst_flups_demux_create_stream (GstFluPSDemux * demux, gint id, gint stream_type)
stream_id = stream_id =
gst_pad_create_stream_id_printf (stream->pad, GST_ELEMENT_CAST (demux), gst_pad_create_stream_id_printf (stream->pad, GST_ELEMENT_CAST (demux),
"%02x", id); "%02x", id);
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_pad_set_caps (stream->pad, caps); gst_pad_set_caps (stream->pad, caps);

View file

@ -107,6 +107,9 @@ struct _GstFluPSDemux
gboolean random_access; /* If we operate in pull mode */ gboolean random_access; /* If we operate in pull mode */
gboolean flushing; gboolean flushing;
gboolean have_group_id;
guint group_id;
GstAdapter *adapter; GstAdapter *adapter;
GstAdapter *rev_adapter; GstAdapter *rev_adapter;
guint64 adapter_offset; guint64 adapter_offset;