summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_lavc.c
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2022-05-22 22:58:15 +0300
committerJan Ekström <jeebjp@gmail.com>2022-06-12 21:05:59 +0300
commit7a3f9af67fbd07a7e2dd10fb015d9563c0d15481 (patch)
treedb9a4ee9756371a3076112c826ce1d50bbf2c581 /audio/out/ao_lavc.c
parentcfc39bec00c95ecc33545399af80313eb97f6a69 (diff)
downloadmpv-7a3f9af67fbd07a7e2dd10fb015d9563c0d15481.tar.bz2
mpv-7a3f9af67fbd07a7e2dd10fb015d9563c0d15481.tar.xz
ao_lavc: switch to AVChannelLayout when available
Diffstat (limited to 'audio/out/ao_lavc.c')
-rw-r--r--audio/out/ao_lavc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c
index b49898fc5c..cb53407eb6 100644
--- a/audio/out/ao_lavc.c
+++ b/audio/out/ao_lavc.c
@@ -31,6 +31,7 @@
#include "options/options.h"
#include "common/common.h"
#include "audio/aframe.h"
+#include "audio/chmap_avchannel.h"
#include "audio/format.h"
#include "audio/fmt-conversion.h"
#include "filters/filter_internal.h"
@@ -124,8 +125,13 @@ static int init(struct ao *ao)
if (!ao_chmap_sel_adjust2(ao, &sel, &ao->channels, false))
goto fail;
mp_chmap_reorder_to_lavc(&ao->channels);
+
+#if !HAVE_AV_CHANNEL_LAYOUT
encoder->channels = ao->channels.num;
encoder->channel_layout = mp_chmap_to_lavc(&ao->channels);
+#else
+ mp_chmap_to_av_layout(&encoder->ch_layout, &ao->channels);
+#endif
encoder->sample_fmt = AV_SAMPLE_FMT_NONE;