1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-28 10:02:17 +00:00

demux_lavf: assume audio codec_tag 0 means unset

Libavformat does not distinguish between "no codec_tag given" and
"codec_tag given, value is 0". 0 can be a valid value. Change
demux_lavf to assume that 0 always means unset for audio. This
prevents incorrect selection of the PCM decoder, which includes
"format 0x0" in its codecs.conf entry. The video case accepts 0 iff
codec_id is RAWVIDEO, but there's no obvious similar check possible
for audio. Thus this could possibly cause issues if a file really uses
0 to mean uncompressed audio.
This commit is contained in:
Uoti Urpala 2012-08-08 23:50:23 +03:00 committed by wm4
parent 7f0926498c
commit c6b03ffef6

View File

@ -320,6 +320,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i)
codec->codec_tag = 0;
if (!codec->codec_tag)
codec->codec_tag = mp_taglist_audio(codec->codec_id);
if (!codec->codec_tag)
codec->codec_tag = -1;
wf->wFormatTag = codec->codec_tag;
wf->nChannels = codec->channels;
wf->nSamplesPerSec = codec->sample_rate;