summaryrefslogtreecommitdiffstats
path: root/ext/faad
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@luon.net>2008-03-08 04:27:03 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-03-08 04:27:03 +0000
commite92772a7e9561a39775229d79fcded9845b26ea8 (patch)
tree30a017f6608573b142ba8c65c741ebbfe548bdfb /ext/faad
parente82812b2dc6bb8066e1c850e68e72c021b5edb33 (diff)
downloadgst-plugins-bad-e92772a7e9561a39775229d79fcded9845b26ea8.tar.gz
gst-plugins-bad-e92772a7e9561a39775229d79fcded9845b26ea8.tar.bz2
gst-plugins-bad-e92772a7e9561a39775229d79fcded9845b26ea8.zip
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.
Diffstat (limited to 'ext/faad')
-rw-r--r--ext/faad/gstfaad.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/ext/faad/gstfaad.c b/ext/faad/gstfaad.c
index b20304f2..1ddaf28f 100644
--- a/ext/faad/gstfaad.c
+++ b/ext/faad/gstfaad.c
@@ -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 (rate == 0xd || rate == 0xe) /* Reserved values */
- return FALSE;
+ if (input_data[0] == 'A'
+ && input_data[1] == 'D' && input_data[2] == 'I' && input_data[3] == 'F')
+ /* ADIF type header */
+ return TRUE;
- if (channels == 0) /* Extended specifier: never seen one of these */
- return FALSE;
+ if (input_data[0] == 0xff && (input_data[1] >> 4) == 0xf)
+ /* ADTS type header */
+ return TRUE;
- return TRUE;
+ return FALSE;
}
static GstFlowReturn