diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2013-07-25 11:56:07 +0100 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-08-29 10:43:19 +0200 |
commit | 2dd3f028c1e6dea799d7496639f53220818b20b1 (patch) | |
tree | 5f6c274f78005ec50b93d6bb6fb7de2db899e0b1 | |
parent | a2f6ec99999afdcacdff5279a6f7e033c99619cc (diff) |
typefinding: don't detect mp3 based on just a few bits1.0
Remove dodgy code that detects mp3 with as little as
a valid frame sync at the beginning. This was only used
in some unit tests in -good where there were only a few
bytes after the id3 tag. We now require at least two
frame headers.
Fixes mis-dection of text files with UTF-16 LE BOM as mp3.
https://bugzilla.gnome.org/show_bug.cgi?id=681368
-rw-r--r-- | gst/typefind/gsttypefindfunctions.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 82accf7bb..a1167015a 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -1401,14 +1401,14 @@ mp3_type_find (GstTypeFind * tf, gpointer unused) goto suggest; } - /* let's see if there's a valid header right at the start */ - data = gst_type_find_peek (tf, 0, 4); /* use min. frame size? */ - if (data && mp3_type_frame_length_from_header (GST_READ_UINT32_BE (data), - &layer, NULL, NULL, NULL, NULL, 0) != 0) { - if (prob == 0) - prob = GST_TYPE_FIND_POSSIBLE - 10; - else - prob = MAX (GST_TYPE_FIND_POSSIBLE - 10, prob + 10); + /* a valid header right at the start makes it more likely + * that this is actually plain mpeg-1 audio */ + if (prob > 0) { + data = gst_type_find_peek (tf, 0, 4); /* use min. frame size? */ + if (data && mp3_type_frame_length_from_header (GST_READ_UINT32_BE (data), + &layer, NULL, NULL, NULL, NULL, 0) != 0) { + prob = MIN (prob + 10, GST_TYPE_FIND_MAXIMUM); + } } if (prob > 0) |