Revision 6e264d45

View differences:

libavformat/psxstr.c
67 67
static int str_probe(AVProbeData *p)
68 68
{
69 69
    int start;
70
    uint8_t *sector;
70 71

  
71
    /* need at least 0x38 bytes to validate */
72
    if (p->buf_size < 0x38)
72
    if (p->buf_size < RAW_CD_SECTOR_SIZE)
73 73
        return 0;
74 74

  
75 75
    if ((AV_RL32(&p->buf[0]) == RIFF_TAG) &&
......
80 80
    } else
81 81
        start = 0;
82 82

  
83
    sector= p->buf + start;
84

  
83 85
    /* look for CD sync header (00, 0xFF x 10, 00) */
84 86
    if (memcmp(p->buf+start,sync_header,sizeof(sync_header)))
85 87
        return 0;
86 88

  
89
    if(sector[0x11] >= 32)
90
        return 0;
91
    if(   (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_VIDEO
92
       && (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_AUDIO
93
       && (sector[0x12] & CDXA_TYPE_MASK) != CDXA_TYPE_DATA)
94
        return 0;
95

  
87 96
    /* MPEG files (like those ripped from VCDs) can also look like this;
88 97
     * only return half certainty */
89 98
    return 50;

Also available in: Unified diff