Commit ef5c6d35 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

typefinding: don't detect mp3 based on just a few bits

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
parent 99ef452f
......@@ -1462,14 +1462,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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment