mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
gst/typefind/gsttypefindfunctions.c: Small mpeg2 system stream typefinding improvement: make typefinder probe a bit i...
Original commit message from CVS: * gst/typefind/gsttypefindfunctions.c: (mpeg2_sys_type_find): Small mpeg2 system stream typefinding improvement: make typefinder probe a bit into the stream instead of just looking for a marker at the beginning. Fixes #397810.
This commit is contained in:
parent
4936d6ba02
commit
c47074371a
2 changed files with 34 additions and 13 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2007-01-19 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst/typefind/gsttypefindfunctions.c: (mpeg2_sys_type_find):
|
||||||
|
Small mpeg2 system stream typefinding improvement: make typefinder
|
||||||
|
probe a bit into the stream instead of just looking for a marker
|
||||||
|
at the beginning. Fixes #397810.
|
||||||
|
|
||||||
2007-01-18 Tim-Philipp Müller <tim at centricular dot net>
|
2007-01-18 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* gst/audioconvert/gstchannelmix.c:
|
* gst/audioconvert/gstchannelmix.c:
|
||||||
|
|
|
@ -1029,13 +1029,25 @@ static GstStaticCaps mpeg_sys_caps = GST_STATIC_CAPS ("video/mpeg, "
|
||||||
(((guint8 *)(data))[3] == 0xC0) || \
|
(((guint8 *)(data))[3] == 0xC0) || \
|
||||||
(((guint8 *)(data))[3] == 0xBD)))
|
(((guint8 *)(data))[3] == 0xBD)))
|
||||||
|
|
||||||
|
#define MPEG2_MAX_PROBE_LENGTH 4096 /* 4kB (random value) */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mpeg2_sys_type_find (GstTypeFind * tf, gpointer unused)
|
mpeg2_sys_type_find (GstTypeFind * tf, gpointer unused)
|
||||||
{
|
{
|
||||||
guint8 *data = gst_type_find_peek (tf, 0, 5);
|
guint8 *data;
|
||||||
gint mpegversion;
|
gint mpegversion, len;
|
||||||
|
|
||||||
if (data && IS_MPEG_PACK_HEADER (data)) {
|
len = MPEG2_MAX_PROBE_LENGTH * 2;
|
||||||
|
do {
|
||||||
|
len = len / 2;
|
||||||
|
data = gst_type_find_peek (tf, 0, 5 + len);
|
||||||
|
} while (data == NULL && len >= 32);
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (len > 0) {
|
||||||
|
if (IS_MPEG_PACK_HEADER (data)) {
|
||||||
if ((data[4] & 0xC0) == 0x40) {
|
if ((data[4] & 0xC0) == 0x40) {
|
||||||
/* type 2 */
|
/* type 2 */
|
||||||
mpegversion = 2;
|
mpegversion = 2;
|
||||||
|
@ -1044,12 +1056,14 @@ mpeg2_sys_type_find (GstTypeFind * tf, gpointer unused)
|
||||||
mpegversion = 1;
|
mpegversion = 1;
|
||||||
goto suggest;
|
goto suggest;
|
||||||
}
|
}
|
||||||
} else if (data && IS_MPEG_PES_HEADER (data)) {
|
} else if (IS_MPEG_PES_HEADER (data)) {
|
||||||
/* PES stream */
|
/* PES stream */
|
||||||
mpegversion = 2;
|
mpegversion = 2;
|
||||||
goto suggest;
|
goto suggest;
|
||||||
}
|
}
|
||||||
|
++data;
|
||||||
|
--len;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
suggest:
|
suggest:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue