Revision dc4ed3b1 libavformat/mp3.c

View differences:

libavformat/mp3.c
240 240
}
241 241

  
242 242
/* mp3 read */
243

  
244
static int mp3_read_probe(AVProbeData *p)
245
{
246
    int d;
247

  
248
    if(p->buf_size < 4)
249
        return 0;
250

  
251
    if(p->buf[0] == 'I' && p->buf[1] == 'D' && p->buf[2] == '3' &&
252
       p->buf[3] < 5)
253
        return AVPROBE_SCORE_MAX;
254

  
255
    if(p->buf[0] != 0xff)
256
        return 0;
257

  
258
    d = p->buf[1];
259
    if((d & 0xe0) != 0xe0 || ((d & 0x18) == 0x08 || (d & 0x06) == 0))
260
        return 0;
261

  
262
    d = p->buf[2];
263
    if((d & 0xf0) == 0xf0 || (d & 0x0c) == 0x0c)
264
        return 0;
265

  
266
    return AVPROBE_SCORE_MAX;
267
}
268

  
243 269
static int mp3_read_header(AVFormatContext *s,
244 270
                           AVFormatParameters *ap)
245 271
{
......
346 372
    "mp3",
347 373
    "MPEG audio",
348 374
    0,
349
    NULL,
375
    mp3_read_probe,
350 376
    mp3_read_header,
351 377
    mp3_read_packet,
352 378
    mp3_read_close,

Also available in: Unified diff