diff options
author | Stefan Kost <ensonic@users.sourceforge.net> | 2007-04-10 12:01:33 +0000 |
---|---|---|
committer | Stefan Kost <ensonic@users.sourceforge.net> | 2007-04-10 12:01:33 +0000 |
commit | 497d589d56cf5e0ef758ca6c0443cdee7b3da91d (patch) | |
tree | 687d9005f3af547b569018038c6e90f54bcebece /gst/auparse | |
parent | 50f88db3adc166ac48020d61d9ee306a103d2e61 (diff) | |
download | gstreamer-plugins-good-497d589d56cf5e0ef758ca6c0443cdee7b3da91d.tar.gz |
gst/auparse/gstauparse.c: limit caps to the formats we announce in the template
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_parse_header):
limit caps to the formats we announce in the template
* gst/wavparse/gstwavparse.c: (uint64_ceiling_scale_int),
(gst_wavparse_perform_seek), (gst_wavparse_stream_headers),
(gst_wavparse_add_src_pad), (gst_wavparse_stream_data):
fix some crashers/asserts when dealing with broken files
Diffstat (limited to 'gst/auparse')
-rw-r--r-- | gst/auparse/gstauparse.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c index 4664984c8..d2658e40c 100644 --- a/gst/auparse/gstauparse.c +++ b/gst/auparse/gstauparse.c @@ -21,7 +21,7 @@ /** * SECTION:element-auparse * @short_description: .au file parser - * + * * <refsect2> * <para> * Parses .au files. @@ -269,6 +269,12 @@ gst_au_parse_parse_header (GstAuParse * auparse) auparse->samplerate = GST_READ_UINT32_BE (head + 16); auparse->channels = GST_READ_UINT32_BE (head + 20); + if (auparse->samplerate < 8000 || auparse->samplerate > 192000) + goto unsupported_sample_rate; + + if (auparse->channels < 1 || auparse->channels > 2) + goto unsupported_number_of_channels; + GST_DEBUG_OBJECT (auparse, "offset %" G_GINT64_FORMAT ", size %u, " "encoding %u, frequency %u, channels %u", auparse->offset, size, auparse->encoding, auparse->samplerate, auparse->channels); @@ -402,9 +408,22 @@ unknown_header: GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE, (NULL), (NULL)); return GST_FLOW_ERROR; } +unsupported_sample_rate: + { + GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), + ("Unsupported samplerate: %u", auparse->samplerate)); + return GST_FLOW_ERROR; + } +unsupported_number_of_channels: + { + GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), + ("Unsupported number of channels: %u", auparse->channels)); + return GST_FLOW_ERROR; + } unknown_format: { - GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), (NULL)); + GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), + ("Unsupported encoding: %u", auparse->encoding)); return GST_FLOW_ERROR; } add_pad_failed: |