gst: Add stream-id to stream-start events

This commit is contained in:
Sebastian Dröge 2012-08-04 12:47:44 +02:00
parent 46255d6ada
commit 7b5925b5a4
6 changed files with 49 additions and 8 deletions

2
common

@ -1 +1 @@
Subproject commit 668acee6b7f0967e841523f78f31152b3cb91302 Subproject commit 94ccf4cadba30549c22a13a5b9c95cc7548060ed

View file

@ -1177,6 +1177,14 @@ gst_dvdemux_demux_audio (GstDVDemux * dvdemux, GstBuffer * buffer,
|| (channels != dvdemux->channels))) { || (channels != dvdemux->channels))) {
GstCaps *caps; GstCaps *caps;
GstAudioInfo info; GstAudioInfo info;
gchar *stream_id;
stream_id =
gst_pad_create_stream_id (dvdemux->audiosrcpad,
GST_ELEMENT_CAST (dvdemux), "audio");
gst_pad_push_event (dvdemux->audiosrcpad,
gst_event_new_stream_start (stream_id));
g_free (stream_id);
dvdemux->frequency = frequency; dvdemux->frequency = frequency;
dvdemux->channels = channels; dvdemux->channels = channels;
@ -1185,7 +1193,6 @@ gst_dvdemux_demux_audio (GstDVDemux * dvdemux, GstBuffer * buffer,
gst_audio_info_set_format (&info, GST_AUDIO_FORMAT_S16LE, gst_audio_info_set_format (&info, GST_AUDIO_FORMAT_S16LE,
frequency, channels, NULL); frequency, channels, NULL);
caps = gst_audio_info_to_caps (&info); caps = gst_audio_info_to_caps (&info);
gst_pad_push_event (dvdemux->audiosrcpad, gst_event_new_stream_start ());
gst_pad_set_caps (dvdemux->audiosrcpad, caps); gst_pad_set_caps (dvdemux->audiosrcpad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
} }
@ -1246,6 +1253,14 @@ gst_dvdemux_demux_video (GstDVDemux * dvdemux, GstBuffer * buffer,
if (G_UNLIKELY ((dvdemux->height != height) || dvdemux->wide != wide)) { if (G_UNLIKELY ((dvdemux->height != height) || dvdemux->wide != wide)) {
GstCaps *caps; GstCaps *caps;
gint par_x, par_y; gint par_x, par_y;
gchar *stream_id;
stream_id =
gst_pad_create_stream_id (dvdemux->videosrcpad,
GST_ELEMENT_CAST (dvdemux), "video");
gst_pad_push_event (dvdemux->videosrcpad,
gst_event_new_stream_start (stream_id));
g_free (stream_id);
dvdemux->height = height; dvdemux->height = height;
dvdemux->wide = wide; dvdemux->wide = wide;
@ -1275,7 +1290,6 @@ gst_dvdemux_demux_video (GstDVDemux * dvdemux, GstBuffer * buffer,
"framerate", GST_TYPE_FRACTION, dvdemux->framerate_numerator, "framerate", GST_TYPE_FRACTION, dvdemux->framerate_numerator,
dvdemux->framerate_denominator, dvdemux->framerate_denominator,
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_x, par_y, NULL); "pixel-aspect-ratio", GST_TYPE_FRACTION, par_x, par_y, NULL);
gst_pad_push_event (dvdemux->videosrcpad, gst_event_new_stream_start ());
gst_pad_set_caps (dvdemux->videosrcpad, caps); gst_pad_set_caps (dvdemux->videosrcpad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);
} }

View file

@ -1924,6 +1924,7 @@ gst_avi_demux_parse_stream (GstAviDemux * avi, GstBuffer * buf)
GstElement *element; GstElement *element;
gboolean got_strh = FALSE, got_strf = FALSE, got_vprp = FALSE; gboolean got_strh = FALSE, got_strf = FALSE, got_vprp = FALSE;
gst_riff_vprp *vprp = NULL; gst_riff_vprp *vprp = NULL;
gchar *stream_id;
element = GST_ELEMENT_CAST (avi); element = GST_ELEMENT_CAST (avi);
@ -2299,7 +2300,11 @@ gst_avi_demux_parse_stream (GstAviDemux * avi, GstBuffer * buf)
avi->num_streams++; avi->num_streams++;
gst_pad_set_active (pad, TRUE); gst_pad_set_active (pad, TRUE);
gst_pad_push_event (pad, gst_event_new_stream_start ()); stream_id =
gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (avi), "%u",
avi->num_streams);
gst_pad_push_event (pad, gst_event_new_stream_start (stream_id));
g_free (stream_id);
gst_pad_set_caps (pad, caps); gst_pad_set_caps (pad, caps);
gst_caps_unref (caps); gst_caps_unref (caps);

View file

@ -642,6 +642,7 @@ gst_flv_demux_audio_negotiate (GstFlvDemux * demux, guint32 codec_tag,
gchar *codec_name = NULL; gchar *codec_name = NULL;
gboolean ret = FALSE; gboolean ret = FALSE;
guint adjusted_rate = rate; guint adjusted_rate = rate;
gchar *stream_id;
switch (codec_tag) { switch (codec_tag) {
case 1: case 1:
@ -732,7 +733,11 @@ gst_flv_demux_audio_negotiate (GstFlvDemux * demux, guint32 codec_tag,
demux->audio_codec_data, NULL); demux->audio_codec_data, NULL);
} }
gst_pad_push_event (demux->audio_pad, gst_event_new_stream_start ()); stream_id =
gst_pad_create_stream_id (demux->audio_pad, GST_ELEMENT_CAST (demux),
"audio");
gst_pad_push_event (demux->audio_pad, gst_event_new_stream_start (stream_id));
g_free (stream_id);
ret = gst_pad_set_caps (demux->audio_pad, caps); ret = gst_pad_set_caps (demux->audio_pad, caps);
if (G_LIKELY (ret)) { if (G_LIKELY (ret)) {
@ -1123,6 +1128,7 @@ gst_flv_demux_video_negotiate (GstFlvDemux * demux, guint32 codec_tag)
gboolean ret = FALSE; gboolean ret = FALSE;
GstCaps *caps = NULL; GstCaps *caps = NULL;
gchar *codec_name = NULL; gchar *codec_name = NULL;
gchar *stream_id;
/* Generate caps for that pad */ /* Generate caps for that pad */
switch (codec_tag) { switch (codec_tag) {
@ -1179,7 +1185,10 @@ gst_flv_demux_video_negotiate (GstFlvDemux * demux, guint32 codec_tag)
demux->video_codec_data, NULL); demux->video_codec_data, NULL);
} }
gst_pad_push_event (demux->video_pad, gst_event_new_stream_start ()); stream_id =
gst_pad_create_stream_id (demux->video_pad, GST_ELEMENT_CAST (demux),
"video");
gst_pad_push_event (demux->video_pad, gst_event_new_stream_start (stream_id));
ret = gst_pad_set_caps (demux->video_pad, caps); ret = gst_pad_set_caps (demux->video_pad, caps);
if (G_LIKELY (ret)) { if (G_LIKELY (ret)) {

View file

@ -5168,6 +5168,8 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
} }
if (stream->pad) { if (stream->pad) {
gchar *stream_id;
GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream; GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream;
gst_pad_use_fixed_caps (stream->pad); gst_pad_use_fixed_caps (stream->pad);
@ -5176,7 +5178,11 @@ gst_qtdemux_add_stream (GstQTDemux * qtdemux,
gst_pad_set_active (stream->pad, TRUE); gst_pad_set_active (stream->pad, TRUE);
GST_DEBUG_OBJECT (qtdemux, "setting caps %" GST_PTR_FORMAT, stream->caps); GST_DEBUG_OBJECT (qtdemux, "setting caps %" GST_PTR_FORMAT, stream->caps);
gst_pad_push_event (stream->pad, gst_event_new_stream_start ()); stream_id =
gst_pad_create_stream_id_printf (stream->pad,
GST_ELEMENT_CAST (qtdemux), "%u", stream->track_id);
gst_pad_push_event (stream->pad, gst_event_new_stream_start (stream_id));
g_free (stream_id);
gst_pad_set_caps (stream->pad, stream->caps); gst_pad_set_caps (stream->pad, stream->caps);
GST_DEBUG_OBJECT (qtdemux, "adding pad %s %p to qtdemux %p", GST_DEBUG_OBJECT (qtdemux, "adding pad %s %p to qtdemux %p",

View file

@ -535,6 +535,7 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml)
guint16 riff_audio_fmt = 0; guint16 riff_audio_fmt = 0;
GstTagList *list = NULL; GstTagList *list = NULL;
gchar *codec = NULL; gchar *codec = NULL;
gchar *stream_id;
DEBUG_ELEMENT_START (demux, ebml, "TrackEntry"); DEBUG_ELEMENT_START (demux, ebml, "TrackEntry");
@ -1335,8 +1336,14 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml)
gst_pad_use_fixed_caps (context->pad); gst_pad_use_fixed_caps (context->pad);
gst_pad_set_active (context->pad, TRUE); gst_pad_set_active (context->pad, TRUE);
gst_pad_push_event (context->pad, gst_event_new_stream_start ());
stream_id =
gst_pad_create_stream_id_printf (context->pad, GST_ELEMENT_CAST (demux),
"%u", context->uid);
gst_pad_push_event (context->pad, gst_event_new_stream_start (stream_id));
g_free (stream_id);
gst_pad_set_caps (context->pad, context->caps); gst_pad_set_caps (context->pad, context->caps);
gst_element_add_pad (GST_ELEMENT (demux), context->pad); gst_element_add_pad (GST_ELEMENT (demux), context->pad);
g_free (padname); g_free (padname);