mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
ogg: Add support for group-id in the stream-start event
This commit is contained in:
parent
2465895266
commit
fc79a688f5
3 changed files with 25 additions and 2 deletions
|
@ -2596,6 +2596,7 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain,
|
||||||
/* first add the pads */
|
/* first add the pads */
|
||||||
for (i = 0; i < chain->streams->len; i++) {
|
for (i = 0; i < chain->streams->len; i++) {
|
||||||
GstOggPad *pad;
|
GstOggPad *pad;
|
||||||
|
GstEvent *ss_event;
|
||||||
gchar *stream_id;
|
gchar *stream_id;
|
||||||
|
|
||||||
pad = g_array_index (chain->streams, GstOggPad *, i);
|
pad = g_array_index (chain->streams, GstOggPad *, i);
|
||||||
|
@ -2621,7 +2622,23 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain,
|
||||||
stream_id =
|
stream_id =
|
||||||
gst_pad_create_stream_id_printf (GST_PAD (pad), GST_ELEMENT_CAST (ogg),
|
gst_pad_create_stream_id_printf (GST_PAD (pad), GST_ELEMENT_CAST (ogg),
|
||||||
"%08x", pad->map.serialno);
|
"%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);
|
g_free (stream_id);
|
||||||
|
|
||||||
/* Set headers on caps */
|
/* 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_length = GST_CLOCK_TIME_NONE;
|
||||||
ogg->push_time_offset = GST_CLOCK_TIME_NONE;
|
ogg->push_time_offset = GST_CLOCK_TIME_NONE;
|
||||||
ogg->push_state = PUSH_PLAYING;
|
ogg->push_state = PUSH_PLAYING;
|
||||||
|
ogg->have_group_id = FALSE;
|
||||||
|
ogg->group_id = G_MAXUINT;
|
||||||
|
|
||||||
ogg->push_disable_seeking = FALSE;
|
ogg->push_disable_seeking = FALSE;
|
||||||
if (!ogg->pullmode) {
|
if (!ogg->pullmode) {
|
||||||
|
|
|
@ -134,6 +134,9 @@ struct _GstOggDemux
|
||||||
gboolean pullmode;
|
gboolean pullmode;
|
||||||
gboolean running;
|
gboolean running;
|
||||||
|
|
||||||
|
gboolean have_group_id;
|
||||||
|
guint group_id;
|
||||||
|
|
||||||
gboolean need_chains;
|
gboolean need_chains;
|
||||||
gboolean resync;
|
gboolean resync;
|
||||||
|
|
||||||
|
|
|
@ -1942,7 +1942,8 @@ gst_ogg_mux_send_start_events (GstOggMux * ogg_mux, GstCollectPads * pads)
|
||||||
{
|
{
|
||||||
gchar s_id[32];
|
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 ());
|
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));
|
gst_pad_push_event (ogg_mux->srcpad, gst_event_new_stream_start (s_id));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue