From a863000bf1b7bdcd67286206916f5f9c4fdbd844 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 14 Jun 2020 22:12:51 +0200 Subject: Fix error when exporting stereo projects with "mixdown to stereo" set. --- src/lib/ffmpeg_encoder.cc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/lib/ffmpeg_encoder.cc') diff --git a/src/lib/ffmpeg_encoder.cc b/src/lib/ffmpeg_encoder.cc index 61e489f07..ee49a0646 100644 --- a/src/lib/ffmpeg_encoder.cc +++ b/src/lib/ffmpeg_encoder.cc @@ -104,12 +104,24 @@ FFmpegEncoder::FFmpegEncoder ( map = AudioMapping (ch, 2); float const overall_gain = 2 / (4 + sqrt(2)); float const minus_3dB = 1 / sqrt(2); - map.set (dcp::LEFT, 0, overall_gain); - map.set (dcp::RIGHT, 1, overall_gain); - map.set (dcp::CENTRE, 0, overall_gain * minus_3dB); - map.set (dcp::CENTRE, 1, overall_gain * minus_3dB); - map.set (dcp::LS, 0, overall_gain); - map.set (dcp::RS, 1, overall_gain); + if (ch == 2) { + map.set (dcp::LEFT, 0, 1); + map.set (dcp::RIGHT, 1, 1); + } else if (ch == 4) { + map.set (dcp::LEFT, 0, overall_gain); + map.set (dcp::RIGHT, 1, overall_gain); + map.set (dcp::CENTRE, 0, overall_gain * minus_3dB); + map.set (dcp::CENTRE, 1, overall_gain * minus_3dB); + map.set (dcp::LS, 0, overall_gain); + } else if (ch >= 6) { + map.set (dcp::LEFT, 0, overall_gain); + map.set (dcp::RIGHT, 1, overall_gain); + map.set (dcp::CENTRE, 0, overall_gain * minus_3dB); + map.set (dcp::CENTRE, 1, overall_gain * minus_3dB); + map.set (dcp::LS, 0, overall_gain); + map.set (dcp::RS, 1, overall_gain); + } + /* XXX: maybe we should do something better for >6 channel DCPs */ } else { _output_audio_channels = ch; map = AudioMapping (ch, ch); -- cgit v1.2.3