From 981ffdc9db4a84c614b3186a0fb27136fe6feb37 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 1 Apr 2021 01:25:27 +0200 Subject: [PATCH] Move 3D-to-2D check (#1941). 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 | 10 ---------- src/lib/player.cc | 10 ++++++++++ test/ffmpeg_encoder_test.cc | 12 ++++++++++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/lib/dcp_encoder.cc b/src/lib/dcp_encoder.cc index c5bcf31f2..f1c412539 100644 --- a/src/lib/dcp_encoder.cc +++ b/src/lib/dcp_encoder.cc @@ -132,16 +132,6 @@ DCPEncoder::go () void DCPEncoder::video (shared_ptr 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); } diff --git a/src/lib/player.cc b/src/lib/player.cc index a5538d9a6..0bdf46f4a 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -1199,6 +1199,16 @@ Player::seek (DCPTime time, bool accurate) void Player::emit_video (shared_ptr 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. */ diff --git a/test/ffmpeg_encoder_test.cc b/test/ffmpeg_encoder_test.cc index 74603f6c0..9bce836c3 100644 --- a/test/ffmpeg_encoder_test.cc +++ b/test/ffmpeg_encoder_test.cc @@ -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(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 (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) { -- 2.30.2