mpegaudio_parser: add MP3 ADU headers parser

Signed-off-by: Martin Storsjö <martin@martin.st>
pull/113/head^2
Gilles Chanteperdrix 10 years ago committed by Martin Storsjö
parent 5e5583efe4
commit 5cbae5651d
  1. 13
      libavcodec/mpegaudio_parser.c
  2. 1
      libavcodec/mpegaudiodecheader.c
  3. 2
      libavcodec/version.h

@ -63,6 +63,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 = avctx->codec_id;
state= (state<<8) + buf[i++]; state= (state<<8) + buf[i++];
@ -86,6 +87,16 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count; avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count;
} }
} }
if (s1->flags & PARSER_FLAG_COMPLETE_FRAMES) {
s->frame_size = 0;
next = buf_size;
} else if (codec_id == AV_CODEC_ID_MP3ADU) {
avpriv_report_missing_feature(avctx,
"MP3ADU full parser");
return AVERROR_PATCHWELCOME;
}
break; break;
} }
} }
@ -106,7 +117,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,6 +134,7 @@ int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_r
break; break;
default: default:
case 3: case 3:
if (avctx->codec_id != AV_CODEC_ID_MP3ADU)
avctx->codec_id = AV_CODEC_ID_MP3; avctx->codec_id = AV_CODEC_ID_MP3;
if (s->lsf) if (s->lsf)
*frame_size = 576; *frame_size = 576;

@ -29,7 +29,7 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56 #define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 15 #define LIBAVCODEC_VERSION_MINOR 16
#define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_MICRO 0
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Loading…
Cancel
Save