int fsize, frames;
uint32_t header;
const uint8_t *buf, *buf0, *buf2, *end;
- AVCodecContext avctx;
+ AVCodecContext *avctx = avcodec_alloc_context3(NULL);
+
+ if (!avctx)
+ return 0;
buf0 = p->buf;
end = p->buf + p->buf_size - sizeof(uint32_t);
for(frames = 0; buf2 < end; frames++) {
int dummy;
header = AV_RB32(buf2);
- fsize = avpriv_mpa_decode_header(&avctx, header, &dummy, &dummy, &dummy, &dummy);
+ fsize = avpriv_mpa_decode_header(avctx, header, &dummy, &dummy, &dummy, &dummy);
if(fsize < 0)
break;
buf2 += fsize;
if(buf == buf0)
first_frames= frames;
}
+ avcodec_free_context(&avctx);
// keep this in sync with ac3 probe, both need to avoid
// issues with MPEG-files!
if (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1;