From fa3e246866220680e1d3b7950de8cd0079809997 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Mon, 8 Aug 2011 10:00:40 +0100 Subject: [PATCH] typefind: bump probability if all frames we found are similar Similar meaning same layer, same bitrate, and same number of channels This fixes misdetection of (some MP3 files that have zero padding between the ID3 tag and the MP3 stream) as H.264 video. https://bugzilla.gnome.org/show_bug.cgi?id=656018 --- gst/typefind/gsttypefindfunctions.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 4b6f80507d..5d3d95cbef 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -1014,6 +1014,7 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off, guint layer = 0, bitrate, samplerate, channels; guint found = 0; /* number of valid headers found */ guint64 offset = skipped; + gboolean changed = FALSE; while (found < GST_MP3_TYPEFIND_TRY_HEADERS) { guint32 head; @@ -1064,6 +1065,8 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off, * that this is not a mp3 but just a random bytestream. It could * be a freaking funky encoded mp3 though. We'll just not count * this header*/ + if (prev_layer) + changed = TRUE; prev_layer = layer; prev_channels = channels; prev_samplerate = samplerate; @@ -1094,6 +1097,8 @@ mp3_type_find_at_offset (GstTypeFind * tf, guint64 start_off, probability = GST_TYPE_FIND_MINIMUM; if (start_off > 0) probability /= 2; + if (!changed) + probability = (probability + GST_TYPE_FIND_MAXIMUM) / 2; GST_INFO ("audio/mpeg calculated %u = %u * %u / %u * (%u - %"