diff options
author | James Almer <jamrial@gmail.com> | 2022-03-10 10:57:39 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-03-15 09:42:41 -0300 |
commit | 441fe2508da82b1824d71d5b62059c17262eb76d (patch) | |
tree | e1b31bc998895c0bcd76b7b7ade687044eb2e7e8 | |
parent | b2af4bc807cfc62d61213c6050aac26ec8a1e675 (diff) | |
download | ffmpeg-441fe2508da82b1824d71d5b62059c17262eb76d.tar.gz |
dfpw: convert to new channel layout API
-rw-r--r-- | libavcodec/dfpwmdec.c | 4 | ||||
-rw-r--r-- | 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) { |