[FFmpeg-devel] [PATCH 221/281] interplayacm: convert to new channel layout API
James Almer
jamrial at gmail.com
Thu Jan 13 04:05:00 EET 2022
From: Anton Khirnov <anton at khirnov.net>
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavcodec/interplayacm.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavcodec/interplayacm.c b/libavcodec/interplayacm.c
index c11178a9ee..7b4e539239 100644
--- a/libavcodec/interplayacm.c
+++ b/libavcodec/interplayacm.c
@@ -79,12 +79,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (avctx->extradata_size < 14)
return AVERROR_INVALIDDATA;
- if (avctx->channels <= 0) {
- av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->channels);
+ if (avctx->ch_layout.nb_channels <= 0) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid number of channels: %d\n", avctx->ch_layout.nb_channels);
return AVERROR_INVALIDDATA;
}
- s->max_samples = AV_RL32(avctx->extradata + 4) / avctx->channels;
+ s->max_samples = AV_RL32(avctx->extradata + 4) / avctx->ch_layout.nb_channels;
if (s->max_samples == 0)
s->max_samples = UINT64_MAX;
s->level = AV_RL16(avctx->extradata + 12) & 0xf;
@@ -585,7 +585,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
if ((ret = init_get_bits8(gb, buf, buf_size)) < 0)
return ret;
- frame->nb_samples = FFMIN(s->block_len / avctx->channels, s->max_samples);
+ frame->nb_samples = FFMIN(s->block_len / avctx->ch_layout.nb_channels, s->max_samples);
s->max_samples -= FFMIN(frame->nb_samples, s->max_samples);
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
@@ -596,7 +596,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return ret;
samples = (int16_t *)frame->data[0];
- for (n = 0; n < frame->nb_samples * avctx->channels; n++) {
+ for (n = 0; n < frame->nb_samples * avctx->ch_layout.nb_channels; n++) {
int val = s->block[n] >> s->level;
*samples++ = val;
}
--
2.34.1
More information about the ffmpeg-devel
mailing list