diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-07-18 11:24:46 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-07-18 11:37:11 +0100 |
commit | bd0adb11fd11ff1b026ab27f16658ecf117cca42 (patch) | |
tree | 8e37e9deedc92542ffdd34b1395f183e2a50e6be | |
parent | a16024d9fb76581a158e9f91dcff8dc4035c4442 (diff) |
typefinding: make mpeg-ts typefinder scan more data
We only look for packets with payload, but it appears there may be packets without,
which makes it harder to find the N packets with payload in a row that we need in
order to typefind this successfully, so scan some more data than necessary in the
optimistic scenario. Alternatively we could change IS_MPEGTS_HEADER().
Fixes #623663.
-rw-r--r-- | gst/typefind/gsttypefindfunctions.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index a95e8f61b..842680988 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -1821,6 +1821,8 @@ static GstStaticCaps mpegts_caps = GST_STATIC_CAPS ("video/mpegts, " (GST_MPEGTS_TYPEFIND_MIN_HEADERS * GST_MPEGTS_MAX_PACKET_SIZE) #define GST_MPEGTS_TYPEFIND_MAX_SYNC \ (GST_MPEGTS_TYPEFIND_MAX_HEADERS * GST_MPEGTS_MAX_PACKET_SIZE) +#define GST_MPEGTS_TYPEFIND_SCAN_LENGTH \ + (GST_MPEGTS_TYPEFIND_MAX_SYNC * 4) #define MPEGTS_HDR_SIZE 4 /* Check for sync byte, error_indicator == 0 and packet has payload */ @@ -1837,6 +1839,7 @@ mpeg_ts_probe_headers (GstTypeFind * tf, guint64 offset, gint packet_size) gint found = 1; guint8 *data = NULL; + GST_LOG ("looking for mpeg-ts packets of size %u", packet_size); while (found < GST_MPEGTS_TYPEFIND_MAX_HEADERS) { offset += packet_size; @@ -1845,6 +1848,7 @@ mpeg_ts_probe_headers (GstTypeFind * tf, guint64 offset, gint packet_size) return found; found++; + GST_LOG ("mpeg-ts sync #%2d at offset %" G_GUINT64_FORMAT, found, offset); } return found; @@ -1858,13 +1862,12 @@ mpeg_ts_type_find (GstTypeFind * tf, gpointer unused) /* TS packet sizes to test: normal, DVHS packet size and * FEC with 16 or 20 byte codes packet size. */ const gint pack_sizes[] = { 188, 192, 204, 208 }; - const gint n_pack_sizes = sizeof (pack_sizes) / sizeof (gint); guint8 *data = NULL; guint size = 0; guint64 skipped = 0; - while (skipped < GST_MPEGTS_TYPEFIND_MAX_SYNC) { + while (skipped < GST_MPEGTS_TYPEFIND_SCAN_LENGTH) { if (size < MPEGTS_HDR_SIZE) { data = gst_type_find_peek (tf, skipped, GST_MPEGTS_TYPEFIND_SYNC_SIZE); if (!data) @@ -1876,7 +1879,9 @@ mpeg_ts_type_find (GstTypeFind * tf, gpointer unused) if (IS_MPEGTS_HEADER (data)) { gint p; - for (p = 0; p < n_pack_sizes; p++) { + GST_LOG ("possible mpeg-ts sync at offset %" G_GUINT64_FORMAT, skipped); + + for (p = 0; p < G_N_ELEMENTS (pack_sizes); p++) { gint found; /* Probe ahead at size pack_sizes[p] */ @@ -3874,7 +3879,7 @@ plugin_init (GstPlugin * plugin) static const gchar *musepack_exts[] = { "mpc", "mpp", "mp+", NULL }; static const gchar *mpeg_sys_exts[] = { "mpe", "mpeg", "mpg", NULL }; static const gchar *mpeg_video_exts[] = { "mpv", "mpeg", "mpg", NULL }; - static const gchar *mpeg_ts_exts[] = { "ts", NULL }; + static const gchar *mpeg_ts_exts[] = { "ts", "mts", NULL }; static const gchar *ogg_exts[] = { "anx", "ogg", "ogm", NULL }; static const gchar *qt_exts[] = { "mov", NULL }; static const gchar *qtif_exts[] = { "qif", "qtif", "qti", NULL }; |