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);
encoder.go ();
}
+
+/** Stereo project with mixdown-to-stereo set */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8)
+{
+ shared_ptr<Film> film = new_test_film2("ffmpeg_encoder_h264_test4");
+ film->examine_and_add_content(shared_ptr<DCPContent>(new DCPContent("test/data/scope_dcp")));
+ BOOST_REQUIRE(!wait_for_jobs());
+ film->set_audio_channels (2);
+
+ shared_ptr<Job> job(new TranscodeJob(film));
+ FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_h264_test8.mp4", EXPORT_FORMAT_H264_AAC, true, false, 23
+#ifdef DCPOMATIC_VARIANT_SWAROOP
+ , optional<dcp::Key>(), optional<string>()
+#endif
+ );
+ encoder.go();
+}