gst: Add stream-id to stream-start events
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 5 Aug 2012 16:30:52 +0000 (18:30 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Mon, 6 Aug 2012 12:04:05 +0000 (14:04 +0200)
ext/sidplay/gstsiddec.cc
gst/asfdemux/gstasfdemux.c
gst/realmedia/rademux.c
gst/realmedia/rmdemux.c

index 92bbd26..667f209 100644 (file)
@@ -290,6 +290,7 @@ siddec_negotiate (GstSidDec * siddec)
   GstCaps *caps;
   const gchar *str;
   GstAudioFormat format;
+  gchar *stream_id;
 
   allowed = gst_pad_get_allowed_caps (siddec->srcpad);
   if (!allowed)
@@ -332,12 +333,15 @@ siddec_negotiate (GstSidDec * siddec)
   gst_structure_get_int (structure, "channels", &channels);
   siddec->config->channels = channels;
 
+  stream_id = gst_pad_create_stream_id (siddec->srcpad, GST_ELEMENT_CAST (siddec), NULL);
+  gst_pad_push_event (siddec->srcpad, gst_event_new_stream_start (stream_id));
+  g_free (stream_id);
+
   caps = gst_caps_new_simple ("audio/x-raw",
       "format", G_TYPE_STRING, gst_audio_format_to_string (format),
       "layout", G_TYPE_STRING, "interleaved",
       "rate", G_TYPE_INT, siddec->config->frequency,
       "channels", G_TYPE_INT, siddec->config->channels, NULL);
-  gst_pad_push_event (siddec->srcpad, gst_event_new_stream_start ());
   gst_pad_set_caps (siddec->srcpad, caps);
   gst_caps_unref (caps);
 
index a06ed34..eb41a50 100644 (file)
@@ -2367,12 +2367,20 @@ static void
 gst_asf_demux_activate_stream (GstASFDemux * demux, AsfStream * stream)
 {
   if (!stream->active) {
+    gchar *stream_id;
+
     GST_INFO_OBJECT (demux, "Activating stream %2u, pad %s, caps %"
         GST_PTR_FORMAT, stream->id, GST_PAD_NAME (stream->pad), stream->caps);
     gst_pad_set_active (stream->pad, TRUE);
+
+    stream_id =
+        gst_pad_create_stream_id_printf (stream->pad, GST_ELEMENT_CAST (demux),
+        "%u", stream->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_element_add_pad (GST_ELEMENT_CAST (demux), stream->pad);
-    gst_pad_push_event (stream->pad, gst_event_new_stream_start ());
     stream->active = TRUE;
   }
 }
index 232d44f..91fbc08 100644 (file)
@@ -319,6 +319,7 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
   const guint8 *data;
   gchar *codec_name = NULL;
   GstCaps *caps = NULL;
+  gchar *stream_id;
   guint avail;
 
   g_assert (demux->ra_version == 4 || demux->ra_version == 3);
@@ -443,10 +444,16 @@ gst_real_audio_demux_parse_header (GstRealAudioDemux * demux)
       GST_DEBUG_FUNCPTR (gst_real_audio_demux_src_query));
   gst_pad_set_active (demux->srcpad, TRUE);
   gst_pad_use_fixed_caps (demux->srcpad);
-  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, caps);
   codec_name = gst_pb_utils_get_codec_description (caps);
   gst_caps_unref (caps);
+
   gst_element_add_pad (GST_ELEMENT (demux), demux->srcpad);
 
   if (demux->byterate_num > 0 && demux->byterate_denom > 0) {
index 6fef310..8ce9f09 100644 (file)
@@ -1281,6 +1281,7 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
   GstCaps *stream_caps = NULL;
   const gchar *codec_tag = NULL;
   gchar *codec_name = NULL;
+  gchar *stream_id;
   int version = 0;
 
   if (stream->subtype == GST_RMDEMUX_STREAM_VIDEO) {
@@ -1487,9 +1488,14 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
     GST_DEBUG_OBJECT (rmdemux, "adding pad %s with caps %" GST_PTR_FORMAT
         ", stream_id=%d", GST_PAD_NAME (stream->pad), stream_caps, stream->id);
     gst_pad_set_active (stream->pad, TRUE);
+
+    stream_id =
+        gst_pad_create_stream_id_printf (stream->pad,
+        GST_ELEMENT_CAST (rmdemux), "%u", stream->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_element_add_pad (GST_ELEMENT_CAST (rmdemux), stream->pad);
-    gst_pad_push_event (stream->pad, gst_event_new_stream_start ());
 
     codec_name = gst_pb_utils_get_codec_description (stream_caps);
 
@@ -1501,6 +1507,7 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
           codec_tag, codec_name, NULL);
       g_free (codec_name);
     }
+    gst_element_add_pad (GST_ELEMENT_CAST (rmdemux), stream->pad);
   }
 
 beach: