From 441fe2508da82b1824d71d5b62059c17262eb76d Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 10 Mar 2022 10:57:39 -0300 Subject: [PATCH] dfpw: convert to new channel layout API --- libavcodec/dfpwmdec.c | 4 ++-- libavcodec/dfpwmenc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/dfpwmdec.c b/libavcodec/dfpwmdec.c index 05f79448ef..27b60a4ea4 100644 --- a/libavcodec/dfpwmdec.c +++ b/libavcodec/dfpwmdec.c @@ -83,7 +83,7 @@ static av_cold int dfpwm_dec_init(struct AVCodecContext *ctx) { DFPWMState *state = ctx->priv_data; - if (ctx->channels <= 0) { + if (ctx->ch_layout.nb_channels <= 0) { av_log(ctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR(EINVAL); } @@ -106,7 +106,7 @@ static int dfpwm_dec_frame(struct AVCodecContext *ctx, void *data, AVFrame *frame = data; int ret; - frame->nb_samples = packet->size * 8 / ctx->channels; + frame->nb_samples = packet->size * 8 / ctx->ch_layout.nb_channels; if (frame->nb_samples <= 0) { av_log(ctx, AV_LOG_ERROR, "invalid number of samples in packet\n"); return AVERROR_INVALIDDATA; diff --git a/libavcodec/dfpwmenc.c b/libavcodec/dfpwmenc.c index 02f2e647d2..8efd23e094 100644 --- a/libavcodec/dfpwmenc.c +++ b/libavcodec/dfpwmenc.c @@ -93,7 +93,7 @@ static int dfpwm_enc_frame(struct AVCodecContext *ctx, struct AVPacket *packet, const struct AVFrame *frame, int *got_packet) { DFPWMState *state = ctx->priv_data; - int size = frame->nb_samples * frame->channels / 8 + (frame->nb_samples % 8 > 0 ? 1 : 0); + int size = frame->nb_samples * frame->ch_layout.nb_channels / 8 + (frame->nb_samples % 8 > 0 ? 1 : 0); int ret = ff_get_encode_buffer(ctx, packet, size, 0); if (ret) {