diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2007-09-15 02:41:24 +0000 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2007-09-15 02:41:24 +0000 |
commit | 3df880934e721d7e37e4feb1d4a3f226cfc1bf2d (patch) | |
tree | e73bc62f058a311c71fffecd89a59f323147dc0c /libavcodec/ac3dec.c | |
parent | d5b7144e1ffa9b1a48832ba5995261873cb211d7 (diff) | |
download | ffmpeg-3df880934e721d7e37e4feb1d4a3f226cfc1bf2d.tar.gz |
better AC3 header error reporting
Originally committed as revision 10496 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r-- | libavcodec/ac3dec.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index e59b4162aa..70c4d93450 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1089,16 +1089,32 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size, { AC3DecodeContext *ctx = (AC3DecodeContext *)avctx->priv_data; int16_t *out_samples = (int16_t *)data; - int i, blk, ch; + int i, blk, ch, err; /* initialize the GetBitContext with the start of valid AC-3 Frame */ init_get_bits(&ctx->gb, buf, buf_size * 8); /* parse the syncinfo */ - if (ac3_parse_header(ctx)) { - av_log(avctx, AV_LOG_ERROR, "\n"); - *data_size = 0; - return buf_size; + err = ac3_parse_header(ctx); + if(err) { + switch(err) { + case AC3_PARSE_ERROR_SYNC: + av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); + break; + case AC3_PARSE_ERROR_BSID: + av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n"); + break; + case AC3_PARSE_ERROR_SAMPLE_RATE: + av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); + break; + case AC3_PARSE_ERROR_FRAME_SIZE: + av_log(avctx, AV_LOG_ERROR, "invalid frame size\n"); + break; + default: + av_log(avctx, AV_LOG_ERROR, "invalid header\n"); + break; + } + return -1; } avctx->sample_rate = ctx->sampling_rate; |