summaryrefslogtreecommitdiff
path: root/src/lib/ffmpeg_encoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-06-14 22:12:51 +0200
committerCarl Hetherington <cth@carlh.net>2020-06-14 22:12:51 +0200
commita863000bf1b7bdcd67286206916f5f9c4fdbd844 (patch)
tree1909ee4551feb85b19c56d6179aeba21b43bf5ce /src/lib/ffmpeg_encoder.cc
parent46c1a60d39c09d2212aca0404bd11b51cf440a88 (diff)
Fix error when exporting stereo projects with "mixdown to stereo"v2.15.79
set.
Diffstat (limited to 'src/lib/ffmpeg_encoder.cc')
-rw-r--r--src/lib/ffmpeg_encoder.cc24
1 files changed, 18 insertions, 6 deletions
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);