diff options
author | Jan Ekström <jeebjp@gmail.com> | 2022-06-01 23:58:17 +0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2022-06-12 21:05:59 +0300 |
commit | cfc39bec00c95ecc33545399af80313eb97f6a69 (patch) | |
tree | 14a35374e88e8511acd26c2e2041cce34e8c0641 | |
parent | 46b19aedc6c091219a936c3dfc9ac7bbb738e513 (diff) | |
download | mpv-cfc39bec00c95ecc33545399af80313eb97f6a69.tar.bz2 mpv-cfc39bec00c95ecc33545399af80313eb97f6a69.tar.xz |
demux_lavf: switch to AVChannelLayout when available
-rw-r--r-- | demux/demux_lavf.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 03c0a1fa0d..0602f7c3d1 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -40,6 +40,8 @@ #include <libavutil/dovi_meta.h> #endif +#include "audio/chmap_avchannel.h" + #include "common/msg.h" #include "common/tags.h" #include "common/av_common.h" @@ -658,10 +660,22 @@ static void handle_new_stream(demuxer_t *demuxer, int i) case AVMEDIA_TYPE_AUDIO: { sh = demux_alloc_sh_stream(STREAM_AUDIO); +#if !HAVE_AV_CHANNEL_LAYOUT // probably unneeded mp_chmap_set_unknown(&sh->codec->channels, codec->channels); if (codec->channel_layout) mp_chmap_from_lavc(&sh->codec->channels, codec->channel_layout); +#else + if (!mp_chmap_from_av_layout(&sh->codec->channels, &codec->ch_layout)) { + char layout[128] = {0}; + MP_WARN(demuxer, + "Failed to convert channel layout %s to mpv one!\n", + av_channel_layout_describe(&codec->ch_layout, + layout, 128) < 0 ? + "undefined" : layout); + } +#endif + sh->codec->samplerate = codec->sample_rate; sh->codec->bitrate = codec->bit_rate; |