[FFmpeg-devel] [PATCH]lavf/riffenc: Always write unexpected channel_mask

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Sep 26 13:39:39 EEST 2016


Hi!

Attached patch allows to write arbitrary (mono) channel_masks 
even for 16bit 48kHz pcm audio.

Please comment, Carl Eugen
-------------- next part --------------
From bbbbde791edddeb16aadaa28f7ab53f1f60a9874 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos at ag.or.at>
Date: Mon, 26 Sep 2016 12:36:54 +0200
Subject: [PATCH] lavf/riffenc: Always write unexpected channel_mask.

---
 libavformat/riffenc.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 36e6ac7..8ff7923 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -71,6 +71,8 @@ int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb,
     frame_size = av_get_audio_frame_duration2(par, par->block_align);
 
     waveformatextensible = (par->channels > 2 && par->channel_layout) ||
+                           par->channels == 1 && par->channel_layout && par->channel_layout != AV_CH_LAYOUT_MONO ||
+                           par->channels == 2 && par->channel_layout && par->channel_layout != AV_CH_LAYOUT_STEREO ||
                            par->sample_rate > 48000 ||
                            par->codec_id == AV_CODEC_ID_EAC3 ||
                            av_get_bits_per_sample(par->codec_id) > 16;
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list