gst/audioconvert/gstaudioconvert.c: make sure we don't allow depth > width
authorBenjamin Otte <otte@gnome.org>
Tue, 25 May 2004 20:14:10 +0000 (20:14 +0000)
committerBenjamin Otte <otte@gnome.org>
Tue, 25 May 2004 20:14:10 +0000 (20:14 +0000)
Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_parse_caps):
make sure we don't allow depth > width
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_fixate):
fixate endianness to G_BYTE_ORDER as default
* gst/audioscale/gstaudioscale.c:
we don't handle another endianness as host-endianness

ChangeLog
gst/audioconvert/gstaudioconvert.c
gst/audioscale/gstaudioscale.c

index 40e589f..6c77479 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-05-25  Benjamin Otte  <in7y118@public.uni-hamburg.de>
+
+       * gst/audioconvert/gstaudioconvert.c:
+       (gst_audio_convert_parse_caps):
+         make sure we don't allow depth > width
+       * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_fixate):
+         fixate endianness to G_BYTE_ORDER as default
+       * gst/audioscale/gstaudioscale.c:
+         we don't handle another endianness as host-endianness
+
 2004-05-25  David Schleef  <ds@schleef.org>
 
        * gst/ffmpegcolorspace/mem.c:  malloc() is in stdlib.h, not malloc.h
index 6d24bd9..970dd78 100644 (file)
@@ -149,7 +149,21 @@ GST_STATIC_CAPS ( \
     "rate = (int) [ 1, MAX ], " \
     "channels = (int) [ 1, 2 ], " \
     "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
-    "width = (int) { 8, 16, 32 }, " \
+    "width = (int) 8, " \
+    "depth = (int) [ 1, 8 ], " \
+    "signed = (boolean) { true, false }; " \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 2 ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 16, " \
+    "depth = (int) [ 1, 16 ], " \
+    "signed = (boolean) { true, false }; " \
+  "audio/x-raw-int, " \
+    "rate = (int) [ 1, MAX ], " \
+    "channels = (int) [ 1, 2 ], " \
+    "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \
+    "width = (int) 32, " \
     "depth = (int) [ 1, 32 ], " \
     "signed = (boolean) { true, false }; " \
   "audio/x-raw-float, " \
@@ -346,6 +360,10 @@ gst_audio_convert_parse_caps (const GstCaps * gst_caps,
     GST_DEBUG ("could not get some values from structure");
     return FALSE;
   }
+  if (caps->is_int && caps->depth > caps->width) {
+    GST_DEBUG ("width > depth, not allowed - make us advertise correct caps");
+    return FALSE;
+  }
   return TRUE;
 }
 
@@ -489,6 +507,10 @@ gst_audio_convert_fixate (GstPad * pad, const GstCaps * caps)
     return copy;
   if (_fixate_caps_to_int (&copy, "depth", ac_caps.is_int ? ac_caps.depth : 16))
     return copy;
+  if (_fixate_caps_to_int (&copy, "endianness",
+          ac_caps.is_int ? ac_caps.endianness : G_BYTE_ORDER))
+    return copy;
+
 
   gst_caps_free (copy);
   return NULL;
index c2e7c1f..6220ac2 100644 (file)
@@ -56,14 +56,24 @@ static GstStaticPadTemplate gst_audioscale_sink_template =
 GST_STATIC_PAD_TEMPLATE ("sink",
     GST_PAD_SINK,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+    GST_STATIC_CAPS ("audio/x-raw-int, "
+        "rate = (int) [ 1, MAX ], "
+        "channels = (int) [ 1, MAX ], "
+        "endianness = (int) BYTE_ORDER, "
+        "width = (int) { 8, 16, 24, 32 }, "
+        "depth = (int) [ 1, 32 ], " "signed = (boolean) { true, false }")
     );
 
 static GstStaticPadTemplate gst_audioscale_src_template =
 GST_STATIC_PAD_TEMPLATE ("src",
     GST_PAD_SRC,
     GST_PAD_ALWAYS,
-    GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
+    GST_STATIC_CAPS ("audio/x-raw-int, "
+        "rate = (int) [ 1, MAX ], "
+        "channels = (int) [ 1, MAX ], "
+        "endianness = (int) BYTE_ORDER, "
+        "width = (int) { 8, 16, 24, 32 }, "
+        "depth = (int) [ 1, 32 ], " "signed = (boolean) { true, false }")
     );
 
 #define GST_TYPE_AUDIOSCALE_METHOD (gst_audioscale_method_get_type())