diff options
author | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-04-09 22:31:40 +0200 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2014-04-09 23:21:38 +0200 |
commit | bf87d582b1cbbb5604d4e1521c4b674206e605a0 (patch) | |
tree | bf0802b3291e478f38b1feae51d9c439099ff94d /libavformat/riffenc.c | |
parent | 2773ab36cc6480ce77845df0b1d1e2f790c59cde (diff) | |
download | ffmpeg-bf87d582b1cbbb5604d4e1521c4b674206e605a0.tar.gz |
Do not allow writing invalid wav channel layouts by default.
Neither WMP nor QT play wav files with too large channel layouts.
Fixes ticket #3543.
Diffstat (limited to 'libavformat/riffenc.c')
-rw-r--r-- | libavformat/riffenc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index c3e3e66b37..6c91cb693a 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -172,12 +172,14 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc) } /* write WAVEFORMATEXTENSIBLE extensions */ if (waveformatextensible) { + int write_channel_mask = enc->strict_std_compliance < FF_COMPLIANCE_NORMAL || + enc->channel_layout < 0x40000; /* 22 is WAVEFORMATEXTENSIBLE size */ avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* ValidBitsPerSample || SamplesPerBlock || Reserved */ avio_wl16(pb, bps); /* dwChannelMask */ - avio_wl32(pb, enc->channel_layout); + avio_wl32(pb, write_channel_mask ? enc->channel_layout : 0); /* GUID + next 3 */ if (enc->codec_id == AV_CODEC_ID_EAC3) { ff_put_guid(pb, get_codec_guid(enc->codec_id, ff_codec_wav_guids)); |