summaryrefslogtreecommitdiff
path: root/libavcodec/libopencore-amr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-02 14:15:28 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-02 14:20:33 +0100
commit6788350281c418f0f395a8279eee82f7abe7c63b (patch)
tree69cd76f699eff929f5b13f76b42eabc7f25f9355 /libavcodec/libopencore-amr.c
parent00aa7fa786e41b5fc8404732453869aa3c14e33a (diff)
parent50a65e7a540ce6747f81d6dbf6a602ad35be77ff (diff)
Merge commit '50a65e7a540ce6747f81d6dbf6a602ad35be77ff'
* commit '50a65e7a540ce6747f81d6dbf6a602ad35be77ff': (24 commits) vmdaudio: set channel layout twinvq: validate sample rate code twinvq: set channel layout twinvq: validate that channels is not <= 0 truespeech: set channel layout sipr: set channel layout shorten: validate that the channel count in the header is not <= 0 ra288dec: set channel layout ra144dec: set channel layout qdm2: remove unneeded checks for channel count qdm2: make sure channels is not <= 0 and set channel layout qcelpdec: set channel layout nellymoserdec: set channels to 1 libopencore-amr: set channel layout for amr-nb or if not set by the user libilbc: set channel layout dpcm: use AVCodecContext.channels instead of keeping a private copy imc: set channels to 1 instead of validating it gsmdec: always set channel layout and sample rate at initialization libgsmdec: always set channel layout and sample rate at initialization g726dec: do not validate sample rate ... Conflicts: libavcodec/dpcm.c libavcodec/qdm2.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libopencore-amr.c')
-rw-r--r--libavcodec/libopencore-amr.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index aa6dfa62ec..2a7d252c67 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/audioconvert.h"
#include "avcodec.h"
#include "libavutil/avstring.h"
#include "libavutil/common.h"
@@ -30,13 +31,16 @@ static void amr_decode_fix_avctx(AVCodecContext *avctx)
{
const int is_amr_wb = 1 + (avctx->codec_id == AV_CODEC_ID_AMR_WB);
- if (!avctx->sample_rate)
- avctx->sample_rate = 8000 * is_amr_wb;
+ avctx->sample_rate = 8000 * is_amr_wb;
- if (!avctx->channels)
- avctx->channels = 1;
+ if (avctx->channels > 1) {
+ av_log_missing_feature(avctx, "multi-channel AMR", 0);
+ return AVERROR_PATCHWELCOME;
+ }
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
+ avctx->channels = 1;
+ avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16;
}
#if CONFIG_LIBOPENCORE_AMRNB