diff --git a/ext/ogg/gstoggdemux.c b/ext/ogg/gstoggdemux.c index 64ca2ec7bf..eb466189b8 100644 --- a/ext/ogg/gstoggdemux.c +++ b/ext/ogg/gstoggdemux.c @@ -2596,6 +2596,7 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain, /* first add the pads */ for (i = 0; i < chain->streams->len; i++) { GstOggPad *pad; + GstEvent *ss_event; gchar *stream_id; pad = g_array_index (chain->streams, GstOggPad *, i); @@ -2621,7 +2622,23 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain, stream_id = gst_pad_create_stream_id_printf (GST_PAD (pad), GST_ELEMENT_CAST (ogg), "%08x", pad->map.serialno); - gst_pad_push_event (GST_PAD (pad), gst_event_new_stream_start (stream_id)); + ss_event = + gst_pad_get_sticky_event (ogg->sinkpad, GST_EVENT_STREAM_START, 0); + if (ss_event) { + if (gst_event_parse_group_id (ss_event, &ogg->group_id)) + ogg->have_group_id = TRUE; + else + ogg->have_group_id = FALSE; + gst_event_unref (ss_event); + } else if (!ogg->have_group_id) { + ogg->have_group_id = TRUE; + ogg->group_id = gst_util_group_id_next (); + } + ss_event = gst_event_new_stream_start (stream_id); + if (ogg->have_group_id) + gst_event_set_group_id (ss_event, ogg->group_id); + + gst_pad_push_event (GST_PAD (pad), ss_event); g_free (stream_id); /* Set headers on caps */ @@ -4635,6 +4652,8 @@ gst_ogg_demux_change_state (GstElement * element, GstStateChange transition) ogg->push_time_length = GST_CLOCK_TIME_NONE; ogg->push_time_offset = GST_CLOCK_TIME_NONE; ogg->push_state = PUSH_PLAYING; + ogg->have_group_id = FALSE; + ogg->group_id = G_MAXUINT; ogg->push_disable_seeking = FALSE; if (!ogg->pullmode) { diff --git a/ext/ogg/gstoggdemux.h b/ext/ogg/gstoggdemux.h index 307128f868..1d6f8bf0e1 100644 --- a/ext/ogg/gstoggdemux.h +++ b/ext/ogg/gstoggdemux.h @@ -134,6 +134,9 @@ struct _GstOggDemux gboolean pullmode; gboolean running; + gboolean have_group_id; + guint group_id; + gboolean need_chains; gboolean resync; diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index f1952e91f1..53da5a044c 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -1942,7 +1942,8 @@ gst_ogg_mux_send_start_events (GstOggMux * ogg_mux, GstCollectPads * pads) { gchar s_id[32]; - /* stream-start (FIXME: create id based on input ids) */ + /* stream-start (FIXME: create id based on input ids) and + * also do something with the group id */ g_snprintf (s_id, sizeof (s_id), "oggmux-%08x", g_random_int ()); gst_pad_push_event (ogg_mux->srcpad, gst_event_new_stream_start (s_id));