From 678c1952a90570753eee842851e50d9c8a7b111e Mon Sep 17 00:00:00 2001 From: James Almer Date: Fri, 27 Aug 2021 13:48:37 -0300 Subject: [PATCH] avdevice/lavfi: convert to new channel layout API Signed-off-by: James Almer --- libavdevice/lavfi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 710ad7c530..fdb93b835f 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -332,9 +332,12 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) st ->sample_aspect_ratio = par->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(sink); } else if (par->codec_type == AVMEDIA_TYPE_AUDIO) { - par->channels = av_buffersink_get_channels(sink); par->sample_rate = av_buffersink_get_sample_rate(sink); - par->channel_layout = av_buffersink_get_channel_layout(sink); + ret = av_channel_layout_from_mask(&par->ch_layout, av_buffersink_get_channel_layout(sink)); + if (ret < 0) { + par->ch_layout.nb_channels = av_buffersink_get_channels(sink); + par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; + } par->format = av_buffersink_get_format(sink); par->codec_id = av_get_pcm_codec(par->format, -1); if (par->codec_id == AV_CODEC_ID_NONE)