summaryrefslogtreecommitdiff
path: root/libavformat/psxstr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-07-11 15:10:58 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-07-11 15:10:58 +0000
commit6e264d45bc66cdef5027c072ca1d93f43261fa21 (patch)
treea30816433b58914c49b3121c1702240ae7d133df /libavformat/psxstr.c
parent4ad62d9a5c34a52b55efd1cb8978fcb62c55086d (diff)
Fix misdetection of MPEG-PS (AVSEQ03.DAT and AVSEQ06.DAT) as psxstr.
Originally committed as revision 14167 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/psxstr.c')
-rw-r--r--libavformat/psxstr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index bad3d33519..f090cd4349 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -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)
{
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 @@ static int str_probe(AVProbeData *p)
} 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;