Commit 441fe250 authored by James Almer's avatar James Almer

dfpw: convert to new channel layout API

parent b2af4bc8
......@@ -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;
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment