mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 13:55:41 +00:00
avdemux: Add support for group-id in the stream-start event
This commit is contained in:
parent
b131dadd9c
commit
9b2577ea2b
1 changed files with 26 additions and 1 deletions
|
@ -61,6 +61,9 @@ struct _GstFFMpegDemux
|
||||||
/* We need to keep track of our pads, so we do so here. */
|
/* We need to keep track of our pads, so we do so here. */
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad;
|
||||||
|
|
||||||
|
gboolean have_group_id;
|
||||||
|
guint group_id;
|
||||||
|
|
||||||
AVFormatContext *context;
|
AVFormatContext *context;
|
||||||
gboolean opened;
|
gboolean opened;
|
||||||
|
|
||||||
|
@ -264,6 +267,9 @@ gst_ffmpegdemux_init (GstFFMpegDemux * demux)
|
||||||
g_rec_mutex_init (&demux->task_lock);
|
g_rec_mutex_init (&demux->task_lock);
|
||||||
gst_task_set_lock (demux->task, &demux->task_lock);
|
gst_task_set_lock (demux->task, &demux->task_lock);
|
||||||
|
|
||||||
|
demux->have_group_id = FALSE;
|
||||||
|
demux->group_id = G_MAXUINT;
|
||||||
|
|
||||||
demux->opened = FALSE;
|
demux->opened = FALSE;
|
||||||
demux->context = NULL;
|
demux->context = NULL;
|
||||||
|
|
||||||
|
@ -925,6 +931,7 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream)
|
||||||
const gchar *codec;
|
const gchar *codec;
|
||||||
AVCodecContext *ctx;
|
AVCodecContext *ctx;
|
||||||
GstFFStream *stream;
|
GstFFStream *stream;
|
||||||
|
GstEvent *event;
|
||||||
gchar *stream_id;
|
gchar *stream_id;
|
||||||
|
|
||||||
ctx = avstream->codec;
|
ctx = avstream->codec;
|
||||||
|
@ -1004,7 +1011,23 @@ gst_ffmpegdemux_get_stream (GstFFMpegDemux * demux, AVStream * avstream)
|
||||||
stream_id =
|
stream_id =
|
||||||
gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (demux), "%03u",
|
gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (demux), "%03u",
|
||||||
avstream->index);
|
avstream->index);
|
||||||
gst_pad_push_event (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 (pad, event);
|
||||||
g_free (stream_id);
|
g_free (stream_id);
|
||||||
|
|
||||||
GST_INFO_OBJECT (pad, "adding pad with caps %" GST_PTR_FORMAT, caps);
|
GST_INFO_OBJECT (pad, "adding pad with caps %" GST_PTR_FORMAT, caps);
|
||||||
|
@ -1854,6 +1877,8 @@ gst_ffmpegdemux_change_state (GstElement * element, GstStateChange transition)
|
||||||
NULL);
|
NULL);
|
||||||
g_list_free (demux->cached_events);
|
g_list_free (demux->cached_events);
|
||||||
demux->cached_events = NULL;
|
demux->cached_events = NULL;
|
||||||
|
demux->have_group_id = FALSE;
|
||||||
|
demux->group_id = G_MAXUINT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue