summaryrefslogtreecommitdiff
path: root/gst/typefind
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@gnome.org>2019-07-10 21:57:13 +0000
committerThibault Saunier <tsaunier@gnome.org>2019-07-10 21:57:13 +0000
commit6d49814932555aa4c60e9c798eb2867b4b23a104 (patch)
tree88759700f6c037d1e07efdfe3ddb747ade20411f /gst/typefind
parent36319169d06f778acee2b33d728d2089d15370d6 (diff)
downloadgstreamer-plugins-base-6d49814932555aa4c60e9c798eb2867b4b23a104.tar.gz
Revert "typefind: Hold off making suggestions too early for MPEG based formats"
This reverts commit 36319169d06f778acee2b33d728d2089d15370d6
Diffstat (limited to 'gst/typefind')
-rw-r--r--gst/typefind/gsttypefindfunctions.c44
1 files changed, 8 insertions, 36 deletions
diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c
index 627102552..46dd39967 100644
--- a/gst/typefind/gsttypefindfunctions.c
+++ b/gst/typefind/gsttypefindfunctions.c
@@ -2159,10 +2159,6 @@ static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, "
#define IS_MPEG_PES_HEADER(data) (IS_MPEG_HEADER (data) && \
IS_MPEG_PES_CODE (((guint8 *)(data))[3]))
-#define MPEG_MIN_PROBE_LENGTH (4 * 1024) /* Examine at least 4kB of data to
- * give the various MPEG formats enough
- * data to avoid mis-detections. */
-
#define MPEG2_MAX_PROBE_LENGTH (128 * 1024) /* 128kB should be 64 packs of the
* most common 2kB pack size. */
@@ -2170,17 +2166,6 @@ static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, "
#define MPEG2_MAX_SYS_HEADERS 5
static gboolean
-mpeg_should_suggest (GstTypeFind * tf, GstTypeFindProbability prob, guint size)
-{
- /* only suggest if we probed at least a certain amount of data, if
- * we have a high confindence, or when we reached eos. This gives
- * various MPEG based formats a better chance of correctly identifying
- * the data. */
- return prob > GST_TYPE_FIND_LIKELY || size >= MPEG_MIN_PROBE_LENGTH ||
- gst_type_find_is_eos (tf);
-}
-
-static gboolean
mpeg_sys_is_valid_pack (GstTypeFind * tf, const guint8 * data, guint len,
guint * pack_size)
{
@@ -2422,9 +2407,6 @@ suggest:
if (data0 != first_sync && prob >= 10)
prob -= 10;
- if (!mpeg_should_suggest (tf, prob, end - data0))
- return;
-
GST_LOG ("Suggesting MPEG %d system stream, %d packs, %d pes, prob %u%%",
mpegversion, pack_headers, pes_headers, prob);
@@ -2523,9 +2505,6 @@ mpeg_ts_type_find (GstTypeFind * tf, gpointer unused)
* found, 40% -> 100% */
probability = MIN (10 * found, GST_TYPE_FIND_MAXIMUM);
- if (!mpeg_should_suggest (tf, probability, size))
- return;
-
gst_type_find_suggest_simple (tf, probability, "video/mpegts",
"systemstream", G_TYPE_BOOLEAN, TRUE,
"packetsize", G_TYPE_INT, pack_sizes[p], NULL);
@@ -2685,8 +2664,7 @@ mpeg4_video_type_find (GstTypeFind * tf, gpointer unused)
else if (seen_vos && seen_vol)
probability = GST_TYPE_FIND_POSSIBLE - 20;
- if (mpeg_should_suggest (tf, probability, c.size))
- gst_type_find_suggest (tf, probability, MPEG4_VIDEO_CAPS);
+ gst_type_find_suggest (tf, probability, MPEG4_VIDEO_CAPS);
}
}
@@ -2829,8 +2807,7 @@ h264_video_type_find (GstTypeFind * tf, gpointer unused)
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, idr:%d ssps:%d", good, bad,
seen_pps, seen_sps, seen_idr, seen_ssps);
- if (seen_sps && seen_pps && seen_idr && good >= 10 && bad < 4
- && mpeg_should_suggest (tf, GST_TYPE_FIND_LIKELY, c.size)) {
+ if (seen_sps && seen_pps && seen_idr && good >= 10 && bad < 4) {
gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, H264_VIDEO_CAPS);
return;
}
@@ -2843,8 +2820,7 @@ h264_video_type_find (GstTypeFind * tf, gpointer unused)
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, idr:%d ssps=%d", good, bad,
seen_pps, seen_sps, seen_idr, seen_ssps);
- if (good >= 2 && bad == 0
- && mpeg_should_suggest (tf, GST_TYPE_FIND_POSSIBLE, c.size)) {
+ if (good >= 2 && bad == 0) {
gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, H264_VIDEO_CAPS);
}
}
@@ -2924,8 +2900,7 @@ h265_video_type_find (GstTypeFind * tf, gpointer unused)
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, vps:%d, irap:%d", good, bad,
seen_pps, seen_sps, seen_vps, seen_irap);
- if (seen_sps && seen_pps && seen_irap && good >= 10 && bad < 4
- && mpeg_should_suggest (tf, GST_TYPE_FIND_LIKELY, c.size)) {
+ if (seen_sps && seen_pps && seen_irap && good >= 10 && bad < 4) {
gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY, H265_VIDEO_CAPS);
return;
}
@@ -2938,8 +2913,7 @@ h265_video_type_find (GstTypeFind * tf, gpointer unused)
GST_LOG ("good:%d, bad:%d, pps:%d, sps:%d, vps:%d, irap:%d", good, bad,
seen_pps, seen_sps, seen_vps, seen_irap);
- if (good >= 2 && bad == 0
- && mpeg_should_suggest (tf, GST_TYPE_FIND_POSSIBLE, c.size)) {
+ if (good >= 2 && bad == 0) {
gst_type_find_suggest (tf, GST_TYPE_FIND_POSSIBLE, H265_VIDEO_CAPS);
}
}
@@ -3046,11 +3020,9 @@ mpeg_video_stream_type_find (GstTypeFind * tf, gpointer unused)
else if (seen_seq)
probability = GST_TYPE_FIND_POSSIBLE - 20;
- if (mpeg_should_suggest (tf, probability, c.size)) {
- gst_type_find_suggest_simple (tf, probability, "video/mpeg",
- "systemstream", G_TYPE_BOOLEAN, FALSE,
- "mpegversion", G_TYPE_INT, 1, "parsed", G_TYPE_BOOLEAN, FALSE, NULL);
- }
+ gst_type_find_suggest_simple (tf, probability, "video/mpeg",
+ "systemstream", G_TYPE_BOOLEAN, FALSE,
+ "mpegversion", G_TYPE_INT, 1, "parsed", G_TYPE_BOOLEAN, FALSE, NULL);
}
}