mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
realmedia: Add support for group-id in the stream-start event
This commit is contained in:
parent
bde41413f6
commit
a8a32d1317
4 changed files with 53 additions and 2 deletions
|
@ -153,6 +153,9 @@ gst_real_audio_demux_reset (GstRealAudioDemux * demux)
|
|||
|
||||
demux->offset = 0;
|
||||
|
||||
demux->have_group_id = FALSE;
|
||||
demux->group_id = G_MAXUINT;
|
||||
|
||||
gst_adapter_clear (demux->adapter);
|
||||
}
|
||||
|
||||
|
@ -320,6 +323,7 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
|||
const guint8 *data;
|
||||
gchar *codec_name = NULL;
|
||||
GstCaps *caps = NULL;
|
||||
GstEvent *event;
|
||||
gchar *stream_id;
|
||||
guint avail;
|
||||
|
||||
|
@ -449,7 +453,24 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
|
|||
|
||||
stream_id =
|
||||
gst_pad_create_stream_id (demux->srcpad, GST_ELEMENT_CAST (demux), NULL);
|
||||
gst_pad_push_event (demux->srcpad, 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 (demux->srcpad, event);
|
||||
g_free (stream_id);
|
||||
|
||||
gst_pad_set_caps (demux->srcpad, caps);
|
||||
|
|
|
@ -51,6 +51,9 @@ struct _GstRealAudioDemux {
|
|||
|
||||
GstPad *sinkpad;
|
||||
GstPad *srcpad;
|
||||
|
||||
gboolean have_group_id;
|
||||
guint group_id;
|
||||
|
||||
GstAdapter *adapter;
|
||||
GstRealAudioDemuxState state;
|
||||
|
|
|
@ -262,6 +262,8 @@ gst_rmdemux_init (GstRMDemux * rmdemux)
|
|||
rmdemux->first_ts = GST_CLOCK_TIME_NONE;
|
||||
rmdemux->base_ts = GST_CLOCK_TIME_NONE;
|
||||
rmdemux->need_newsegment = TRUE;
|
||||
rmdemux->have_group_id = FALSE;
|
||||
rmdemux->group_id = G_MAXUINT;
|
||||
|
||||
gst_rm_utils_run_tests ();
|
||||
}
|
||||
|
@ -693,6 +695,9 @@ gst_rmdemux_reset (GstRMDemux * rmdemux)
|
|||
rmdemux->first_ts = GST_CLOCK_TIME_NONE;
|
||||
rmdemux->base_ts = GST_CLOCK_TIME_NONE;
|
||||
rmdemux->need_newsegment = TRUE;
|
||||
|
||||
rmdemux->have_group_id = FALSE;
|
||||
rmdemux->group_id = G_MAXUINT;
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
@ -1467,6 +1472,7 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
|||
stream_caps);
|
||||
|
||||
if (stream->pad && stream_caps) {
|
||||
GstEvent *event;
|
||||
|
||||
GST_LOG_OBJECT (rmdemux, "%d bytes of extra data for stream %s",
|
||||
stream->extra_data_size, GST_PAD_NAME (stream->pad));
|
||||
|
@ -1498,7 +1504,25 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
|
|||
stream_id =
|
||||
gst_pad_create_stream_id_printf (stream->pad,
|
||||
GST_ELEMENT_CAST (rmdemux), "%03u", stream->id);
|
||||
gst_pad_push_event (stream->pad, gst_event_new_stream_start (stream_id));
|
||||
|
||||
event =
|
||||
gst_pad_get_sticky_event (rmdemux->sinkpad, GST_EVENT_STREAM_START, 0);
|
||||
if (event) {
|
||||
if (gst_event_parse_group_id (event, &rmdemux->group_id))
|
||||
rmdemux->have_group_id = TRUE;
|
||||
else
|
||||
rmdemux->have_group_id = FALSE;
|
||||
gst_event_unref (event);
|
||||
} else if (!rmdemux->have_group_id) {
|
||||
rmdemux->have_group_id = TRUE;
|
||||
rmdemux->group_id = gst_util_group_id_next ();
|
||||
}
|
||||
|
||||
event = gst_event_new_stream_start (stream_id);
|
||||
if (rmdemux->have_group_id)
|
||||
gst_event_set_group_id (event, rmdemux->group_id);
|
||||
|
||||
gst_pad_push_event (stream->pad, event);
|
||||
g_free (stream_id);
|
||||
|
||||
gst_pad_set_caps (stream->pad, stream_caps);
|
||||
|
|
|
@ -82,6 +82,9 @@ struct _GstRMDemux {
|
|||
/* pads */
|
||||
GstPad *sinkpad;
|
||||
|
||||
gboolean have_group_id;
|
||||
guint group_id;
|
||||
|
||||
GSList *streams;
|
||||
guint n_video_streams;
|
||||
guint n_audio_streams;
|
||||
|
|
Loading…
Reference in a new issue