Move 3D-to-2D check (#1941).
authorCarl Hetherington <cth@carlh.net>
Wed, 31 Mar 2021 23:25:27 +0000 (01:25 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 31 Mar 2021 23:25:27 +0000 (01:25 +0200)
We were checking for 3D content going into a 2D project in
the DCPEncoder, but we also need to do the same thing when exporting.
Moving the check into Player::emit_video() means that it is
applied to both DCP transcoding and export.

src/lib/dcp_encoder.cc
src/lib/player.cc
test/ffmpeg_encoder_test.cc

index c5bcf31f2c207ce25d65ab97ea577f719681bed7..f1c41253984f514563735b62580399711e4042f4 100644 (file)
@@ -132,16 +132,6 @@ DCPEncoder::go ()
 void
 DCPEncoder::video (shared_ptr<PlayerVideo> data, DCPTime time)
 {
-       if (!_film->three_d()) {
-               if (data->eyes() == Eyes::LEFT) {
-                       /* Use left-eye images for both eyes... */
-                       data->set_eyes (Eyes::BOTH);
-               } else if (data->eyes() == Eyes::RIGHT) {
-                       /* ...and discard the right */
-                       return;
-               }
-       }
-
        _j2k_encoder->encode (data, time);
 }
 
index a5538d9a6103120ec69b2543f6ac4d4eff004ff0..0bdf46f4abe33532f2edc7f14e7ad0f29bcb219f 100644 (file)
@@ -1199,6 +1199,16 @@ Player::seek (DCPTime time, bool accurate)
 void
 Player::emit_video (shared_ptr<PlayerVideo> pv, DCPTime time)
 {
+       if (!_film->three_d()) {
+               if (pv->eyes() == Eyes::LEFT) {
+                       /* Use left-eye images for both eyes... */
+                       pv->set_eyes (Eyes::BOTH);
+               } else if (pv->eyes() == Eyes::RIGHT) {
+                       /* ...and discard the right */
+                       return;
+               }
+       }
+
        /* We need a delay to give a little wiggle room to ensure that relevent subtitles arrive at the
           player before the video that requires them.
        */
index 74603f6c02699741da1b8ad4fcf593816aa9d774..9bce836c3fb4d3c814912ddedc9c888683b256fd 100644 (file)
@@ -330,6 +330,18 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6)
 }
 
 
+/** Test export of a 3D DCP in a 2D project */
+BOOST_AUTO_TEST_CASE (ffmpeg_encoder_3d_dcp_to_h264)
+{
+       auto dcp = make_shared<DCPContent>(TestPaths::private_data() / "XMenDarkPhoenix_TLR-12-3D_F_DE-XX_DE_51_2K_TCFG_20190227_TM_IOP-3D_OV");
+       auto film2 = new_test_film2 ("ffmpeg_encoder_3d_dcp_to_h264_export", {dcp});
+
+       auto job = make_shared<TranscodeJob> (film2);
+       FFmpegEncoder encoder (film2, job, "build/test/ffmpeg_encoder_3d_dcp_to_h264.mp4", ExportFormat::H264_AAC, true, false, false, 23);
+       encoder.go ();
+}
+
+
 /** Test export of a 3D DCP in a 2D project */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7)
 {