summaryrefslogtreecommitdiff
path: root/gst/mpegdemux
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-07-23 10:15:58 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-07-23 10:33:31 +0200
commit4ec7baa61aaf30cc8ec813eace0c84d820c1d427 (patch)
treee88f967984d2c84990746efe2a59d41ba93bed1b /gst/mpegdemux
parenta68733ea915d9d9472b27e718f485b66dd40247c (diff)
downloadgstreamer-plugins-bad-4ec7baa61aaf30cc8ec813eace0c84d820c1d427.tar.gz
mpegdemux: Add support for group-id in the stream-start event
Diffstat (limited to 'gst/mpegdemux')
-rw-r--r--gst/mpegdemux/gstmpegdemux.c21
-rw-r--r--gst/mpegdemux/gstmpegdemux.h3
2 files changed, 23 insertions, 1 deletions
diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c
index 4e1a37dfd..4a4c4e8a3 100644
--- a/gst/mpegdemux/gstmpegdemux.c
+++ b/gst/mpegdemux/gstmpegdemux.c
@@ -338,6 +338,8 @@ gst_flups_demux_reset (GstFluPSDemux * demux)
gst_segment_init (&demux->sink_segment, GST_FORMAT_UNDEFINED);
gst_segment_init (&demux->src_segment, GST_FORMAT_TIME);
gst_flups_demux_flush (demux);
+ demux->have_group_id = FALSE;
+ demux->group_id = G_MAXUINT;
}
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);
GstCaps *caps;
GstClockTime threshold = SEGMENT_THRESHOLD;
+ GstEvent *event;
gchar *stream_id;
name = NULL;
@@ -472,7 +475,23 @@ gst_flups_demux_create_stream (GstFluPSDemux * demux, gint id, gint stream_type)
stream_id =
gst_pad_create_stream_id_printf (stream->pad, GST_ELEMENT_CAST (demux),
"%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);
gst_pad_set_caps (stream->pad, caps);
diff --git a/gst/mpegdemux/gstmpegdemux.h b/gst/mpegdemux/gstmpegdemux.h
index dee8388ac..acca25427 100644
--- a/gst/mpegdemux/gstmpegdemux.h
+++ b/gst/mpegdemux/gstmpegdemux.h
@@ -107,6 +107,9 @@ struct _GstFluPSDemux
gboolean random_access; /* If we operate in pull mode */
gboolean flushing;
+ gboolean have_group_id;
+ guint group_id;
+
GstAdapter *adapter;
GstAdapter *rev_adapter;
guint64 adapter_offset;