Commit 51c57e4a authored by michael's avatar michael

slightly better detection


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@14167 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c83671be
...@@ -67,9 +67,9 @@ static const char sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf ...@@ -67,9 +67,9 @@ static const char sync_header[12] = {0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf
static int str_probe(AVProbeData *p) static int str_probe(AVProbeData *p)
{ {
int start; int start;
uint8_t *sector;
/* need at least 0x38 bytes to validate */ if (p->buf_size < RAW_CD_SECTOR_SIZE)
if (p->buf_size < 0x38)
return 0; return 0;
if ((AV_RL32(&p->buf[0]) == RIFF_TAG) && if ((AV_RL32(&p->buf[0]) == RIFF_TAG) &&
...@@ -80,10 +80,19 @@ static int str_probe(AVProbeData *p) ...@@ -80,10 +80,19 @@ static int str_probe(AVProbeData *p)
} else } else
start = 0; start = 0;
sector= p->buf + start;
/* look for CD sync header (00, 0xFF x 10, 00) */ /* look for CD sync header (00, 0xFF x 10, 00) */
if (memcmp(p->buf+start,sync_header,sizeof(sync_header))) if (memcmp(p->buf+start,sync_header,sizeof(sync_header)))
return 0; return 0;
if(sector[0x11] >= 32)
return 0;
if( (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_VIDEO
&& (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_AUDIO
&& (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_DATA)
return 0;
/* MPEG files (like those ripped from VCDs) can also look like this; /* MPEG files (like those ripped from VCDs) can also look like this;
* only return half certainty */ * only return half certainty */
return 50; return 50;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment