From 0411acf5f632fd5814a9f62760df4d21fafc1b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= Date: Tue, 24 May 2022 23:11:39 +0300 Subject: f_lavfi: switch to AVChannelLayout when available --- filters/f_lavfi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/filters/f_lavfi.c b/filters/f_lavfi.c index e764598997..ec6fb9f095 100644 --- a/filters/f_lavfi.c +++ b/filters/f_lavfi.c @@ -33,6 +33,8 @@ #include #include +#include "config.h" + #include "common/common.h" #include "common/av_common.h" #include "common/tags.h" @@ -40,6 +42,7 @@ #include "audio/format.h" #include "audio/aframe.h" +#include "audio/chmap_avchannel.h" #include "video/mp_image.h" #include "audio/fmt-conversion.h" #include "video/fmt-conversion.h" @@ -470,7 +473,11 @@ static bool init_pads(struct lavfi *c) params->sample_rate = mp_aframe_get_rate(fmt); struct mp_chmap chmap = {0}; mp_aframe_get_chmap(fmt, &chmap); +#if !HAVE_AV_CHANNEL_LAYOUT params->channel_layout = mp_chmap_to_lavc(&chmap); +#else + mp_chmap_to_av_layout(¶ms->ch_layout, &chmap); +#endif pad->timebase = (AVRational){1, mp_aframe_get_rate(fmt)}; filter_name = "abuffer"; } else if (pad->type == MP_FRAME_VIDEO) { -- cgit v1.2.3