diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-11-07 10:23:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-11-07 10:26:40 +0100 |
commit | cb395929e3793189403e473f208a669debe825d0 (patch) | |
tree | 34b68bfb22ec7dec28d2ee1ffd5afeef6f358c80 /libavcodec | |
parent | 7c2cfaac6a24d5767c0b2f3a21190e1777b8ff7d (diff) | |
parent | ad961726dc0bec7435aae7fbab10471b9063018b (diff) | |
download | ffmpeg-cb395929e3793189403e473f208a669debe825d0.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
libopencore-amr: Check the return value of amr_decode_fix_avctx
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libopencore-amr.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index c5bc3ccc2b..62d6806224 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -27,7 +27,7 @@ #include "audio_frame_queue.h" #include "internal.h" -static void amr_decode_fix_avctx(AVCodecContext *avctx) +static int amr_decode_fix_avctx(AVCodecContext *avctx) { const int is_amr_wb = 1 + (avctx->codec_id == AV_CODEC_ID_AMR_WB); @@ -36,12 +36,13 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx) if (avctx->channels > 1) { av_log_missing_feature(avctx, "multi-channel AMR", 0); - return; + return AVERROR_PATCHWELCOME; } avctx->channels = 1; avctx->channel_layout = AV_CH_LAYOUT_MONO; avctx->sample_fmt = AV_SAMPLE_FMT_S16; + return 0; } #if CONFIG_LIBOPENCORE_AMRNB @@ -108,6 +109,10 @@ static const AVClass class = { static av_cold int amr_nb_decode_init(AVCodecContext *avctx) { AMRContext *s = avctx->priv_data; + int ret; + + if ((ret = amr_decode_fix_avctx(avctx)) < 0) + return ret; s->dec_state = Decoder_Interface_init(); if (!s->dec_state) { @@ -115,13 +120,6 @@ static av_cold int amr_nb_decode_init(AVCodecContext *avctx) return -1; } - amr_decode_fix_avctx(avctx); - - if (avctx->channels > 1) { - av_log(avctx, AV_LOG_ERROR, "amr_nb: multichannel decoding not supported\n"); - return AVERROR(ENOSYS); - } - avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; @@ -323,15 +321,12 @@ typedef struct AMRWBContext { static av_cold int amr_wb_decode_init(AVCodecContext *avctx) { AMRWBContext *s = avctx->priv_data; + int ret; - s->state = D_IF_init(); - - amr_decode_fix_avctx(avctx); + if ((ret = amr_decode_fix_avctx(avctx)) < 0) + return ret; - if (avctx->channels > 1) { - av_log(avctx, AV_LOG_ERROR, "amr_wb: multichannel decoding not supported\n"); - return AVERROR(ENOSYS); - } + s->state = D_IF_init(); avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; |