mirror of https://github.com/mpv-player/mpv
demux_lavf: switch to AVChannelLayout when available
This commit is contained in:
parent
46b19aedc6
commit
cfc39bec00
|
@ -40,6 +40,8 @@
|
||||||
#include <libavutil/dovi_meta.h>
|
#include <libavutil/dovi_meta.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "audio/chmap_avchannel.h"
|
||||||
|
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
#include "common/tags.h"
|
#include "common/tags.h"
|
||||||
#include "common/av_common.h"
|
#include "common/av_common.h"
|
||||||
|
@ -658,10 +660,22 @@ static void handle_new_stream(demuxer_t *demuxer, int i)
|
||||||
case AVMEDIA_TYPE_AUDIO: {
|
case AVMEDIA_TYPE_AUDIO: {
|
||||||
sh = demux_alloc_sh_stream(STREAM_AUDIO);
|
sh = demux_alloc_sh_stream(STREAM_AUDIO);
|
||||||
|
|
||||||
|
#if !HAVE_AV_CHANNEL_LAYOUT
|
||||||
// probably unneeded
|
// probably unneeded
|
||||||
mp_chmap_set_unknown(&sh->codec->channels, codec->channels);
|
mp_chmap_set_unknown(&sh->codec->channels, codec->channels);
|
||||||
if (codec->channel_layout)
|
if (codec->channel_layout)
|
||||||
mp_chmap_from_lavc(&sh->codec->channels, 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->samplerate = codec->sample_rate;
|
||||||
sh->codec->bitrate = codec->bit_rate;
|
sh->codec->bitrate = codec->bit_rate;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue