gst/asfdemux/gstasfdemux.c: Use static pad templates with ANY caps for the source...
authorTim-Philipp Müller <tim@centricular.net>
Tue, 22 Aug 2006 15:52:16 +0000 (15:52 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Tue, 22 Aug 2006 15:52:16 +0000 (15:52 +0000)
Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_add_audio_stream), (gst_asf_demux_add_video_stream):
Use static pad templates with ANY caps for the source pads for
simplicity and to avoid warnings when creating pads for unhandled
codec IDs (#351795).

ChangeLog
gst/asfdemux/gstasfdemux.c

index 48c5107..23ff06b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-08-22  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
+       (gst_asf_demux_add_audio_stream), (gst_asf_demux_add_video_stream):
+         Use static pad templates with ANY caps for the source pads for
+         simplicity and to avoid warnings when creating pads for unhandled
+         codec IDs (#351795).
+
 2006-08-16  Wim Taymans  <wim@fluendo.com>
 
        Patch by: Michal Benes <michal dot benes at itonis dot tv>
index 3617666..5ea25a7 100644 (file)
@@ -38,6 +38,18 @@ GST_STATIC_PAD_TEMPLATE ("sink",
     GST_STATIC_CAPS ("video/x-ms-asf")
     );
 
+static GstStaticPadTemplate audio_src_template =
+GST_STATIC_PAD_TEMPLATE ("audio_%02d",
+    GST_PAD_SRC,
+    GST_PAD_SOMETIMES,
+    GST_STATIC_CAPS_ANY);
+
+static GstStaticPadTemplate video_src_template =
+GST_STATIC_PAD_TEMPLATE ("video_%02d",
+    GST_PAD_SRC,
+    GST_PAD_SOMETIMES,
+    GST_STATIC_CAPS_ANY);
+
 
 /* abuse this GstFlowReturn enum for internal usage */
 #define ASF_FLOW_NEED_MORE_DATA  99
@@ -65,9 +77,6 @@ static GstFlowReturn gst_asf_demux_process_object (GstASFDemux * demux,
 
 GST_BOILERPLATE (GstASFDemux, gst_asf_demux, GstElement, GST_TYPE_ELEMENT);
 
-static GstPadTemplate *videosrctempl;
-static GstPadTemplate *audiosrctempl;
-
 static void
 gst_asf_demux_base_init (gpointer g_class)
 {
@@ -78,16 +87,11 @@ gst_asf_demux_base_init (gpointer g_class)
     "Demultiplexes ASF Streams",
     "Owen Fraser-Green <owen@discobabe.net>"
   };
-  GstCaps *audcaps = gst_riff_create_audio_template_caps (),
-      *vidcaps = gst_riff_create_video_template_caps ();
 
-  audiosrctempl = gst_pad_template_new ("audio_%02d",
-      GST_PAD_SRC, GST_PAD_SOMETIMES, audcaps);
-  videosrctempl = gst_pad_template_new ("video_%02d",
-      GST_PAD_SRC, GST_PAD_SOMETIMES, vidcaps);
-
-  gst_element_class_add_pad_template (element_class, audiosrctempl);
-  gst_element_class_add_pad_template (element_class, videosrctempl);
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&audio_src_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&video_src_template));
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&gst_asf_demux_sink_template));
 
@@ -886,7 +890,7 @@ gst_asf_demux_add_audio_stream (GstASFDemux * demux,
   /* Create the audio pad */
   name = g_strdup_printf ("audio_%02d", demux->num_audio_streams);
 
-  src_pad = gst_pad_new_from_template (audiosrctempl, name);
+  src_pad = gst_pad_new_from_static_template (&audio_src_template, name);
   g_free (name);
 
   /* Swallow up any left over data and set up the 
@@ -951,7 +955,7 @@ gst_asf_demux_add_video_stream (GstASFDemux * demux,
 
   /* Create the video pad */
   name = g_strdup_printf ("video_%02d", demux->num_video_streams);
-  src_pad = gst_pad_new_from_template (videosrctempl, name);
+  src_pad = gst_pad_new_from_static_template (&video_src_template, name);
   g_free (name);
 
   /* Now try some gstreamer formatted MIME types (from gst_avi_demux_strf_vids) */