From 6d8b25841ca47a03abd1cab95be3ec5810bdf84f Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 25 Aug 2021 10:37:54 -0300 Subject: [PATCH] mf: convert to new channel layout API Signed-off-by: James Almer --- libavcodec/mfenc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/mfenc.c b/libavcodec/mfenc.c index 410ad64d8d..043026112a 100644 --- a/libavcodec/mfenc.c +++ b/libavcodec/mfenc.c @@ -288,7 +288,7 @@ static IMFSample *mf_a_avframe_to_sample(AVCodecContext *avctx, const AVFrame *f size_t bps; IMFSample *sample; - bps = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->channels; + bps = av_get_bytes_per_sample(avctx->sample_fmt) * avctx->ch_layout.nb_channels; len = frame->nb_samples * bps; sample = ff_create_memory_sample(frame->data[0], len, c->in_info.cbAlignment); @@ -536,7 +536,7 @@ static int64_t mf_enca_output_score(AVCodecContext *avctx, IMFMediaType *type) score |= 1LL << 32; hr = IMFAttributes_GetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, &t); - if (!FAILED(hr) && t == avctx->channels) + if (!FAILED(hr) && t == avctx->ch_layout.nb_channels) score |= 2LL << 32; hr = IMFAttributes_GetGUID(type, &MF_MT_SUBTYPE, &tg); @@ -591,7 +591,7 @@ static int64_t mf_enca_input_score(AVCodecContext *avctx, IMFMediaType *type) score |= 2; hr = IMFAttributes_GetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, &t); - if (!FAILED(hr) && t == avctx->channels) + if (!FAILED(hr) && t == avctx->ch_layout.nb_channels) score |= 4; return score; @@ -615,7 +615,7 @@ static int mf_enca_input_adjust(AVCodecContext *avctx, IMFMediaType *type) } hr = IMFAttributes_GetUINT32(type, &MF_MT_AUDIO_NUM_CHANNELS, &t); - if (FAILED(hr) || t != avctx->channels) { + if (FAILED(hr) || t != avctx->ch_layout.nb_channels) { av_log(avctx, AV_LOG_ERROR, "unsupported input channel number set\n"); return AVERROR(EINVAL); }