summaryrefslogtreecommitdiff
path: root/libavcodec/qdmc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2019-06-04 12:25:53 +0200
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:44 -0300
commit884a97de692825a0eedc6dcad438e1e65440611c (patch)
treefa57be0a32a03d94bb874e81f4c23eff10a523f6 /libavcodec/qdmc.c
parentb7716325d95a926f4b24ffd1783f4329120dddd2 (diff)
qdmc: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/qdmc.c')
-rw-r--r--libavcodec/qdmc.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavcodec/qdmc.c b/libavcodec/qdmc.c
index eb4526de09..4827c02269 100644
--- a/libavcodec/qdmc.c
+++ b/libavcodec/qdmc.c
@@ -248,13 +248,14 @@ static av_cold int qdmc_decode_init(AVCodecContext *avctx)
}
bytestream2_skipu(&b, 4);
- avctx->channels = s->nb_channels = bytestream2_get_be32u(&b);
+ s->nb_channels = bytestream2_get_be32u(&b);
if (s->nb_channels <= 0 || s->nb_channels > 2) {
av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n");
return AVERROR_INVALIDDATA;
}
- avctx->channel_layout = avctx->channels == 2 ? AV_CH_LAYOUT_STEREO :
- AV_CH_LAYOUT_MONO;
+ av_channel_layout_uninit(&avctx->ch_layout);
+ avctx->ch_layout = s->nb_channels == 2 ? (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO :
+ (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
avctx->sample_rate = bytestream2_get_be32u(&b);
avctx->bit_rate = bytestream2_get_be32u(&b);
@@ -280,7 +281,7 @@ static av_cold int qdmc_decode_init(AVCodecContext *avctx)
s->frame_size = 1 << s->frame_bits;
s->subframe_size = s->frame_size >> 5;
- if (avctx->channels == 2)
+ if (avctx->ch_layout.nb_channels == 2)
x = 3 * x / 2;
s->band_index = noise_bands_selector[FFMIN(6, llrint(floor(avctx->bit_rate * 3.0 / (double)x + 0.5)))];