# HG changeset patch # User michael # Date 1215789058 0 # Node ID 44699ecd5f6f00727e23ddd1941a406c9d45a556 # Parent bc473761b9e7aadce4ef3f5a060839f20305616f Fix misdetection of MPEG-PS (AVSEQ03.DAT and AVSEQ06.DAT) as psxstr. diff -r bc473761b9e7 -r 44699ecd5f6f psxstr.c --- a/psxstr.c Fri Jul 11 07:41:11 2008 +0000 +++ b/psxstr.c Fri Jul 11 15:10:58 2008 +0000 @@ -67,9 +67,9 @@ static int str_probe(AVProbeData *p) { int start; + uint8_t *sector; - /* need at least 0x38 bytes to validate */ - if (p->buf_size < 0x38) + if (p->buf_size < RAW_CD_SECTOR_SIZE) return 0; if ((AV_RL32(&p->buf[0]) == RIFF_TAG) && @@ -80,10 +80,19 @@ } else start = 0; + sector= p->buf + start; + /* look for CD sync header (00, 0xFF x 10, 00) */ if (memcmp(p->buf+start,sync_header,sizeof(sync_header))) 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; * only return half certainty */ return 50;