From 91773593cf747eb238c92cedb629995977d85d57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 19 Jan 2007 12:23:06 +0000 Subject: [PATCH] gst/typefind/gsttypefindfunctions.c: Lower probability a bit if the marker isn't right at the start, to decrease the ... Original commit message from CVS: * gst/typefind/gsttypefindfunctions.c: (mpeg2_sys_type_find): Lower probability a bit if the marker isn't right at the start, to decrease the chance of false positives. --- ChangeLog | 6 ++++++ gst/typefind/gsttypefindfunctions.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc8ee2c957..450e857ae2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-01-19 Tim-Philipp Müller + + * gst/typefind/gsttypefindfunctions.c: (mpeg2_sys_type_find): + Lower probability a bit if the marker isn't right at the start, + to decrease the chance of false positives. + 2007-01-19 Tim-Philipp Müller * gst/typefind/gsttypefindfunctions.c: (mpeg2_sys_type_find): diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 66b14501e8..fa680c72c3 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -1034,7 +1034,7 @@ static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, " static void mpeg2_sys_type_find (GstTypeFind * tf, gpointer unused) { - guint8 *data; + guint8 *data, *data0; gint mpegversion, len; len = MPEG2_MAX_PROBE_LENGTH * 2; @@ -1046,6 +1046,7 @@ mpeg2_sys_type_find (GstTypeFind * tf, gpointer unused) if (!data) return; + data0 = data; while (len > 0) { if (IS_MPEG_PACK_HEADER (data)) { if ((data[4] & 0xC0) == 0x40) { @@ -1071,7 +1072,11 @@ suggest: gst_structure_set (gst_caps_get_structure (caps, 0), "mpegversion", G_TYPE_INT, mpegversion, NULL); - gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, caps); + /* lower probability if the marker isn't right at the start */ + if (data0 == data) + gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, caps); + else + gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE - 10, caps); gst_caps_unref (caps); } };