summaryrefslogtreecommitdiff
path: root/libavcodec/amrwbdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-05-07 07:20:32 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:40 -0300
commita4a73c6a9c2007dbea55519482499c7b7462ac9b (patch)
treefd99363eae27f6263c8b87e7901ab119fc6ee009 /libavcodec/amrwbdec.c
parent62473cbd8e43cfcdca3024787e2baef6daff80ce (diff)
amr: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/amrwbdec.c')
-rw-r--r--libavcodec/amrwbdec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c
index 7d1b820bbb..261ef02255 100644
--- a/libavcodec/amrwbdec.c
+++ b/libavcodec/amrwbdec.c
@@ -102,20 +102,20 @@ static av_cold int amrwb_decode_init(AVCodecContext *avctx)
AMRWBChannelsContext *s = avctx->priv_data;
int i;
- if (avctx->channels > 2) {
+ if (avctx->ch_layout.nb_channels > 2) {
avpriv_report_missing_feature(avctx, ">2 channel AMR");
return AVERROR_PATCHWELCOME;
}
- if (!avctx->channels) {
- avctx->channels = 1;
- avctx->channel_layout = AV_CH_LAYOUT_MONO;
+ if (!avctx->ch_layout.nb_channels) {
+ av_channel_layout_uninit(&avctx->ch_layout);
+ avctx->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
}
if (!avctx->sample_rate)
avctx->sample_rate = 16000;
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
- for (int ch = 0; ch < avctx->channels; ch++) {
+ for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
AMRWBContext *ctx = &s->ch[ch];
av_lfg_init(&ctx->prng, 1);
@@ -1115,7 +1115,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
- for (int ch = 0; ch < avctx->channels; ch++) {
+ for (int ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
AMRWBContext *ctx = &s->ch[ch];
AMRWBFrame *cf = &ctx->frame;
int expected_fr_size, header_size;