gst: Add stream-id to stream-start events

This commit is contained in:
Sebastian Dröge 2012-08-06 13:59:27 +02:00
parent 94337d05a5
commit bdc46898de
3 changed files with 21 additions and 3 deletions

View file

@ -602,6 +602,7 @@ static void
switch_pads (GstHLSDemux * demux, GstCaps * newcaps)
{
GstPad *oldpad = demux->srcpad;
gchar *stream_id;
GST_DEBUG ("Switching pads (oldpad:%p) with caps: %" GST_PTR_FORMAT, oldpad,
newcaps);
@ -614,8 +615,14 @@ switch_pads (GstHLSDemux * demux, GstCaps * newcaps)
GST_DEBUG_FUNCPTR (gst_hls_demux_src_query));
gst_pad_set_element_private (demux->srcpad, demux);
gst_pad_set_active (demux->srcpad, TRUE);
gst_pad_push_event (demux->srcpad, gst_event_new_stream_start ());
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));
g_free (stream_id);
gst_pad_set_caps (demux->srcpad, newcaps);
gst_element_add_pad (GST_ELEMENT (demux), demux->srcpad);
gst_element_no_more_pads (GST_ELEMENT (demux));

View file

@ -254,6 +254,7 @@ mpegts_parse_request_new_pad (GstElement * element, GstPadTemplate * template,
MpegTSParseProgram *parseprogram;
GstPad *pad;
gint program_num = -1;
gchar *stream_id;
g_return_val_if_fail (template != NULL, NULL);
g_return_val_if_fail (GST_IS_MPEGTS_PARSE (element), NULL);
@ -281,7 +282,11 @@ mpegts_parse_request_new_pad (GstElement * element, GstPadTemplate * template,
parse->srcpads = g_list_append (parse->srcpads, pad);
gst_pad_set_active (pad, TRUE);
gst_pad_push_event (pad, gst_event_new_stream_start ());
stream_id = gst_pad_create_stream_id (pad, element, padname + 8);
gst_pad_push_event (pad, gst_event_new_stream_start (stream_id));
g_free (stream_id);
gst_element_add_pad (element, pad);
return pad;

View file

@ -959,12 +959,18 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream,
break;
}
if (template && name && caps) {
gchar *stream_id;
GST_LOG ("stream:%p creating pad with name %s and caps %s", stream, name,
gst_caps_to_string (caps));
pad = gst_pad_new_from_template (template, name);
gst_pad_set_active (pad, TRUE);
gst_pad_use_fixed_caps (pad);
gst_pad_push_event (pad, gst_event_new_stream_start ());
stream_id =
gst_pad_create_stream_id_printf (pad, GST_ELEMENT_CAST (base), "%08x",
bstream->pid);
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_query_function (pad, gst_ts_demux_srcpad_query);
gst_pad_set_event_function (pad, gst_ts_demux_srcpad_event);