mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-06-19 19:03:00 +02:00
avoid too many false detections
Originally committed as revision 1537 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
+9
-6
@@ -405,15 +405,19 @@ static int mpeg_mux_end(AVFormatContext *ctx)
|
|||||||
|
|
||||||
static int mpegps_probe(AVProbeData *p)
|
static int mpegps_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
int code, c, i;
|
int code;
|
||||||
code = 0xff;
|
const uint8_t *d;
|
||||||
|
|
||||||
/* we search the first start code. If it is a packet start code,
|
/* we search the first start code. If it is a packet start code,
|
||||||
then we decide it is mpeg ps. We do not send highest value to
|
then we decide it is mpeg ps. We do not send highest value to
|
||||||
give a chance to mpegts */
|
give a chance to mpegts */
|
||||||
for(i=0;i<p->buf_size;i++) {
|
/* NOTE: the search range was restricted to avoid too many false
|
||||||
c = p->buf[i];
|
detections */
|
||||||
code = (code << 8) | c;
|
|
||||||
|
if (p->buf_size < 6)
|
||||||
|
return 0;
|
||||||
|
d = p->buf;
|
||||||
|
code = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3]);
|
||||||
if ((code & 0xffffff00) == 0x100) {
|
if ((code & 0xffffff00) == 0x100) {
|
||||||
if (code == PACK_START_CODE ||
|
if (code == PACK_START_CODE ||
|
||||||
code == SYSTEM_HEADER_START_CODE ||
|
code == SYSTEM_HEADER_START_CODE ||
|
||||||
@@ -427,7 +431,6 @@ static int mpegps_probe(AVProbeData *p)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-6
@@ -153,15 +153,19 @@ static int video_read_header(AVFormatContext *s,
|
|||||||
/* XXX: improve that by looking at several start codes */
|
/* XXX: improve that by looking at several start codes */
|
||||||
static int mpegvideo_probe(AVProbeData *p)
|
static int mpegvideo_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
int code, c, i;
|
int code;
|
||||||
code = 0xff;
|
const uint8_t *d;
|
||||||
|
|
||||||
/* we search the first start code. If it is a sequence, gop or
|
/* we search the first start code. If it is a sequence, gop or
|
||||||
picture start code then we decide it is an mpeg video
|
picture start code then we decide it is an mpeg video
|
||||||
stream. We do not send highest value to give a chance to mpegts */
|
stream. We do not send highest value to give a chance to mpegts */
|
||||||
for(i=0;i<p->buf_size;i++) {
|
/* NOTE: the search range was restricted to avoid too many false
|
||||||
c = p->buf[i];
|
detections */
|
||||||
code = (code << 8) | c;
|
|
||||||
|
if (p->buf_size < 6)
|
||||||
|
return 0;
|
||||||
|
d = p->buf;
|
||||||
|
code = (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3]);
|
||||||
if ((code & 0xffffff00) == 0x100) {
|
if ((code & 0xffffff00) == 0x100) {
|
||||||
if (code == SEQ_START_CODE ||
|
if (code == SEQ_START_CODE ||
|
||||||
code == GOP_START_CODE ||
|
code == GOP_START_CODE ||
|
||||||
@@ -170,7 +174,6 @@ static int mpegvideo_probe(AVProbeData *p)
|
|||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user