You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
Merge commit '72d658766e6ccf198317dffd6499c5e288847a1c'
* commit '72d658766e6ccf198317dffd6499c5e288847a1c': mp3dec: replace avpriv_mpa_decode_header with avpriv_mpegaudio_decode_header Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
@@ -64,13 +64,9 @@ static int check(AVIOContext *pb, int64_t pos, uint32_t *header);
|
|||||||
static int mp3_read_probe(AVProbeData *p)
|
static int mp3_read_probe(AVProbeData *p)
|
||||||
{
|
{
|
||||||
int max_frames, first_frames = 0;
|
int max_frames, first_frames = 0;
|
||||||
int fsize, frames;
|
int fsize, frames, ret;
|
||||||
uint32_t header;
|
uint32_t header;
|
||||||
const uint8_t *buf, *buf0, *buf2, *end;
|
const uint8_t *buf, *buf0, *buf2, *end;
|
||||||
AVCodecContext *avctx = avcodec_alloc_context3(NULL);
|
|
||||||
|
|
||||||
if (!avctx)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
|
|
||||||
buf0 = p->buf;
|
buf0 = p->buf;
|
||||||
end = p->buf + p->buf_size - sizeof(uint32_t);
|
end = p->buf + p->buf_size - sizeof(uint32_t);
|
||||||
@@ -83,19 +79,18 @@ static int mp3_read_probe(AVProbeData *p)
|
|||||||
for(; buf < end; buf= buf2+1) {
|
for(; buf < end; buf= buf2+1) {
|
||||||
buf2 = buf;
|
buf2 = buf;
|
||||||
for(frames = 0; buf2 < end; frames++) {
|
for(frames = 0; buf2 < end; frames++) {
|
||||||
int dummy;
|
MPADecodeHeader h;
|
||||||
|
|
||||||
header = AV_RB32(buf2);
|
header = AV_RB32(buf2);
|
||||||
fsize = avpriv_mpa_decode_header(avctx, header,
|
ret = avpriv_mpegaudio_decode_header(&h, header);
|
||||||
&dummy, &dummy, &dummy, &dummy);
|
if (ret != 0)
|
||||||
if(fsize < 0)
|
|
||||||
break;
|
break;
|
||||||
buf2 += fsize;
|
buf2 += h.frame_size;
|
||||||
}
|
}
|
||||||
max_frames = FFMAX(max_frames, frames);
|
max_frames = FFMAX(max_frames, frames);
|
||||||
if(buf == buf0)
|
if(buf == buf0)
|
||||||
first_frames= frames;
|
first_frames= frames;
|
||||||
}
|
}
|
||||||
avcodec_free_context(&avctx);
|
|
||||||
// keep this in sync with ac3 probe, both need to avoid
|
// keep this in sync with ac3 probe, both need to avoid
|
||||||
// issues with MPEG-files!
|
// issues with MPEG-files!
|
||||||
if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
|
if (first_frames>=7) return AVPROBE_SCORE_EXTENSION + 1;
|
||||||
|
Reference in New Issue
Block a user