mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
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
This commit is contained in:
parent
99ef452fc4
commit
ef5c6d351f
1 changed files with 8 additions and 8 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue