From 4f845c50ceefb592d7f5eebcec5705712314ac13 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 25 May 2004 20:14:10 +0000 Subject: [PATCH] gst/audioconvert/gstaudioconvert.c: make sure we don't allow depth > width 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 | 10 ++++++++++ gst/audioconvert/gstaudioconvert.c | 24 +++++++++++++++++++++++- gst/audioscale/gstaudioscale.c | 14 ++++++++++++-- 3 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40e589f503..6c774791dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-05-25 Benjamin Otte + + * 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 * gst/ffmpegcolorspace/mem.c: malloc() is in stdlib.h, not malloc.h diff --git a/gst/audioconvert/gstaudioconvert.c b/gst/audioconvert/gstaudioconvert.c index 6d24bd9bf4..970dd784aa 100644 --- a/gst/audioconvert/gstaudioconvert.c +++ b/gst/audioconvert/gstaudioconvert.c @@ -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 (©, "depth", ac_caps.is_int ? ac_caps.depth : 16)) return copy; + if (_fixate_caps_to_int (©, "endianness", + ac_caps.is_int ? ac_caps.endianness : G_BYTE_ORDER)) + return copy; + gst_caps_free (copy); return NULL; diff --git a/gst/audioscale/gstaudioscale.c b/gst/audioscale/gstaudioscale.c index c2e7c1f23d..6220ac29e7 100644 --- a/gst/audioscale/gstaudioscale.c +++ b/gst/audioscale/gstaudioscale.c @@ -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())