Commit 8ca098f4 authored by Gilles Chanteperdrix's avatar Gilles Chanteperdrix Committed by Michael Niedermayer

avcocdec/mpegaudio_parser: add MP3 ADU headers parser

Reviewed-by: 's avatarThomas Volkert <silvo@gmx.net>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b5339498
...@@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, ...@@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
}else{ }else{
while(i<buf_size){ while(i<buf_size){
int ret, sr, channels, bit_rate, frame_size; int ret, sr, channels, bit_rate, frame_size;
enum AVCodecID codec_id; enum AVCodecID codec_id = avctx->codec_id;
state= (state<<8) + buf[i++]; state= (state<<8) + buf[i++];
...@@ -90,6 +90,16 @@ static int mpegaudio_parse(AVCodecParserContext *s1, ...@@ -90,6 +90,16 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold); avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold);
} }
} }
if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) {
s->frame_size = 0;
next = buf_size;
} else if (codec_id == AV_CODEC_ID_MP3ADU) {
av_log(avctx, AV_LOG_ERROR,
"MP3ADU full parser not implemented");
return AVERROR_PATCHWELCOME;
}
break; break;
} }
} }
...@@ -110,7 +120,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, ...@@ -110,7 +120,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
AVCodecParser ff_mpegaudio_parser = { AVCodecParser ff_mpegaudio_parser = {
.codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3 }, .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU },
.priv_data_size = sizeof(MpegAudioParseContext), .priv_data_size = sizeof(MpegAudioParseContext),
.parser_parse = mpegaudio_parse, .parser_parse = mpegaudio_parse,
.parser_close = ff_parse_close, .parser_close = ff_parse_close,
......
...@@ -134,7 +134,8 @@ int avpriv_mpa_decode_header2(uint32_t head, int *sample_rate, int *channels, in ...@@ -134,7 +134,8 @@ int avpriv_mpa_decode_header2(uint32_t head, int *sample_rate, int *channels, in
break; break;
default: default:
case 3: case 3:
*codec_id = AV_CODEC_ID_MP3; if (*codec_id != AV_CODEC_ID_MP3ADU)
*codec_id = AV_CODEC_ID_MP3;
if (s->lsf) if (s->lsf)
*frame_size = 576; *frame_size = 576;
else else
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56 #define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 21 #define LIBAVCODEC_VERSION_MINOR 22
#define LIBAVCODEC_VERSION_MICRO 102 #define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \ LIBAVCODEC_VERSION_MINOR, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment