ext/mad/gstmad.c: Make mad the second element to support the highly useful
authorLutz Müller <lutz@topfrose.de>
Thu, 4 May 2006 08:24:52 +0000 (08:24 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Thu, 4 May 2006 08:24:52 +0000 (08:24 +0000)
Original commit message from CVS:
Patch by: Lutz Müller <lutz at topfrose de>
* ext/mad/gstmad.c: (gst_mad_init), (gst_mad_src_query):
Make mad the second element to support the highly useful
FORMATS query (#340594)

ChangeLog
ext/mad/gstmad.c

index 80a9f1a..bed780a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-04  Tim-Philipp Müller  <tim at centricular dot net>
+
+       Patch by: Lutz Müller <lutz at topfrose de>
+
+       * ext/mad/gstmad.c: (gst_mad_init), (gst_mad_src_query):
+         Make mad the second element to support the highly useful
+         FORMATS query (#340594)
+
 2006-05-02  Edward Hervey  <edward@fluendo.com>
 
        * ext/mpeg2dec/gstmpeg2dec.c: (gst_mpeg2dec_sink_convert),
index 3c0b2f2..2252711 100644 (file)
@@ -159,10 +159,6 @@ static void gst_mad_get_property (GObject * object, guint prop_id,
 
 static gboolean gst_mad_src_event (GstPad * pad, GstEvent * event);
 
-#if 0
-static const GstFormat *gst_mad_get_formats (GstPad * pad);
-#endif
-
 static const GstQueryType *gst_mad_get_query_types (GstPad * pad);
 
 static gboolean gst_mad_src_query (GstPad * pad, GstQuery * query);
@@ -334,12 +330,6 @@ gst_mad_init (GstMad * mad)
   gst_pad_set_chain_function (mad->sinkpad, GST_DEBUG_FUNCPTR (gst_mad_chain));
   gst_pad_set_event_function (mad->sinkpad,
       GST_DEBUG_FUNCPTR (gst_mad_sink_event));
-#if 0
-  gst_pad_set_convert_function (mad->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_mad_convert_sink));
-  gst_pad_set_formats_function (mad->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_mad_get_formats));
-#endif
   template = gst_static_pad_template_get (&mad_src_template_factory);
   mad->srcpad = gst_pad_new_from_template (template, "src");
   gst_object_unref (template);
@@ -351,12 +341,6 @@ gst_mad_init (GstMad * mad)
   gst_pad_set_query_type_function (mad->srcpad,
       GST_DEBUG_FUNCPTR (gst_mad_get_query_types));
   gst_pad_use_fixed_caps (mad->srcpad);
-#if 0
-  gst_pad_set_convert_function (mad->srcpad,
-      GST_DEBUG_FUNCPTR (gst_mad_convert_src));
-  gst_pad_set_formats_function (mad->srcpad,
-      GST_DEBUG_FUNCPTR (gst_mad_get_formats));
-#endif
   mad->tempbuffer = g_malloc (MAD_BUFFER_MDLEN * 3);
   mad->tempsize = 0;
   mad->base_byte_offset = 0;
@@ -410,26 +394,6 @@ gst_mad_get_index (GstElement * element)
   return mad->index;
 }
 
-#if 0
-static const GstFormat *
-gst_mad_get_formats (GstPad * pad)
-{
-  static const GstFormat src_formats[] = {
-    GST_FORMAT_BYTES,
-    GST_FORMAT_DEFAULT,
-    GST_FORMAT_TIME,
-    0
-  };
-  static const GstFormat sink_formats[] = {
-    GST_FORMAT_BYTES,
-    GST_FORMAT_TIME,
-    0
-  };
-
-  return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats);
-}
-#endif
-
 static gboolean
 gst_mad_convert_sink (GstPad * pad, GstFormat src_format, gint64 src_value,
     GstFormat * dest_format, gint64 * dest_value)
@@ -575,6 +539,10 @@ gst_mad_src_query (GstPad * pad, GstQuery * query)
   peer = gst_pad_get_peer (mad->sinkpad);
 
   switch (GST_QUERY_TYPE (query)) {
+    case GST_QUERY_FORMATS:
+      gst_query_set_formats (query, 3, GST_FORMAT_DEFAULT, GST_FORMAT_TIME,
+          GST_FORMAT_BYTES);
+      break;
     case GST_QUERY_POSITION:
     {
       GstFormat format;