1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-21 18:57:35 +00:00

ao_lavc: switch to AVChannelLayout when available

This commit is contained in:
Jan Ekström 2022-05-22 22:58:15 +03:00
parent cfc39bec00
commit 7a3f9af67f

View File

@ -31,6 +31,7 @@
#include "options/options.h" #include "options/options.h"
#include "common/common.h" #include "common/common.h"
#include "audio/aframe.h" #include "audio/aframe.h"
#include "audio/chmap_avchannel.h"
#include "audio/format.h" #include "audio/format.h"
#include "audio/fmt-conversion.h" #include "audio/fmt-conversion.h"
#include "filters/filter_internal.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)) if (!ao_chmap_sel_adjust2(ao, &sel, &ao->channels, false))
goto fail; goto fail;
mp_chmap_reorder_to_lavc(&ao->channels); mp_chmap_reorder_to_lavc(&ao->channels);
#if !HAVE_AV_CHANNEL_LAYOUT
encoder->channels = ao->channels.num; encoder->channels = ao->channels.num;
encoder->channel_layout = mp_chmap_to_lavc(&ao->channels); 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; encoder->sample_fmt = AV_SAMPLE_FMT_NONE;