summaryrefslogtreecommitdiff
path: root/libavformat/mp3dec.c
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2016-01-01 16:57:40 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2016-01-01 16:57:40 +0100
commita78d9abee0dfef2dc86e711e27b474e7d07dca2e (patch)
tree341560b9446ee0a9813b5b32028c153d3fa8c984 /libavformat/mp3dec.c
parent42ff56e362e823f5292c0d661fd35778da2d7eef (diff)
parent72d658766e6ccf198317dffd6499c5e288847a1c (diff)
Merge commit '72d658766e6ccf198317dffd6499c5e288847a1c'
* commit '72d658766e6ccf198317dffd6499c5e288847a1c': mp3dec: replace avpriv_mpa_decode_header with avpriv_mpegaudio_decode_header Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat/mp3dec.c')
-rw-r--r--libavformat/mp3dec.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 8d41657058..0a984d7f31 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -64,13 +64,9 @@ static int check(AVIOContext *pb, int64_t pos, uint32_t *header);
static int mp3_read_probe(AVProbeData *p)
{
int max_frames, first_frames = 0;
- int fsize, frames;
+ int fsize, frames, ret;
uint32_t header;
const uint8_t *buf, *buf0, *buf2, *end;
- AVCodecContext *avctx = avcodec_alloc_context3(NULL);
-
- if (!avctx)
- return AVERROR(ENOMEM);
buf0 = p->buf;
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) {
buf2 = buf;
for(frames = 0; buf2 < end; frames++) {
- int dummy;
+ MPADecodeHeader h;
+
header = AV_RB32(buf2);
- fsize = avpriv_mpa_decode_header(avctx, header,
- &dummy, &dummy, &dummy, &dummy);
- if(fsize < 0)
+ ret = avpriv_mpegaudio_decode_header(&h, header);
+ if (ret != 0)
break;
- buf2 += fsize;
+ buf2 += h.frame_size;
}
max_frames = FFMAX(max_frames, frames);
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>=7) return AVPROBE_SCORE_EXTENSION + 1;