1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-11 09:29:29 +00:00

common/av_common: switch to AVChannelLayout when available

This commit is contained in:
Jan Ekström 2022-06-01 23:57:56 +03:00
parent 302acb27c8
commit 46b19aedc6

View File

@ -30,6 +30,7 @@
#include "config.h"
#include "audio/chmap_avchannel.h"
#include "common/common.h"
#include "common/msg.h"
#include "demux/packet.h"
@ -108,9 +109,14 @@ AVCodecParameters *mp_codec_params_to_av(struct mp_codec_params *c)
avp->sample_rate = c->samplerate;
avp->bit_rate = c->bitrate;
avp->block_align = c->block_align;
#if !HAVE_AV_CHANNEL_LAYOUT
avp->channels = c->channels.num;
if (!mp_chmap_is_unknown(&c->channels))
avp->channel_layout = mp_chmap_to_lavc(&c->channels);
#else
mp_chmap_to_av_layout(&avp->ch_layout, &c->channels);
#endif
return avp;
error: