ext/faad/gstfaad.c: Improve the header checking to look for what faad2 looks for too. Fixes playback of same apple tr...

Original commit message from CVS:
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* ext/faad/gstfaad.c: (looks_like_valid_header):
Improve the header checking to look for what faad2 looks
for too. Fixes playback of same apple trailers.
Fixes bug #469979.
This commit is contained in:
Sjoerd Simons 2008-03-08 04:27:03 +00:00 committed by Sebastian Dröge
parent e82812b2dc
commit e92772a7e9
3 changed files with 19 additions and 13 deletions

View file

@ -1,3 +1,12 @@
2008-03-08 Sebastian Dröge <slomo@circular-chaos.org>
Patch by: Sjoerd Simons <sjoerd at luon dot net>
* ext/faad/gstfaad.c: (looks_like_valid_header):
Improve the header checking to look for what faad2 looks
for too. Fixes playback of same apple trailers.
Fixes bug #469979.
2008-03-07 Sebastian Dröge <slomo@circular-chaos.org>
* configure.ac:

2
common

@ -1 +1 @@
Subproject commit e02bd43fe6b9e45536eccbf5b7a5f9eae62030fd
Subproject commit 170f8e91adc7157f6e708ffa58ca22d10e4e45da

View file

@ -1141,22 +1141,19 @@ gst_faad_sync (GstBuffer * buf, guint * off)
static gboolean
looks_like_valid_header (guint8 * input_data, guint input_size)
{
guint32 rate;
guint32 channels;
if (input_size < 2)
if (input_size < 4)
return FALSE;
rate = ((input_data[0] & 0x7) << 1) | ((input_data[1] & 0x80) >> 7);
channels = (input_data[1] & 0x78) >> 3;
if (input_data[0] == 'A'
&& input_data[1] == 'D' && input_data[2] == 'I' && input_data[3] == 'F')
/* ADIF type header */
return TRUE;
if (rate == 0xd || rate == 0xe) /* Reserved values */
return FALSE;
if (input_data[0] == 0xff && (input_data[1] >> 4) == 0xf)
/* ADTS type header */
return TRUE;
if (channels == 0) /* Extended specifier: never seen one of these */
return FALSE;
return TRUE;
return FALSE;
}
static GstFlowReturn