Handle 2D/3D mismatches in the player (#2409).
[dcpomatic.git] / test / ffmpeg_encoder_test.cc
index ff730ad53354a904a8aabf9894a8bf48e16500a1..c58689a02613765f910a8dda8c75df9514d0aaf8 100644 (file)
@@ -22,6 +22,7 @@
 #include "lib/audio_content.h"
 #include "lib/compose.hpp"
 #include "lib/config.h"
+#include "lib/constants.h"
 #include "lib/content_factory.h"
 #include "lib/dcp_content.h"
 #include "lib/dcpomatic_log.h"
@@ -39,9 +40,8 @@
 #include <boost/test/unit_test.hpp>
 
 
-using std::string;
-using std::shared_ptr;
 using std::make_shared;
+using std::string;
 using namespace dcpomatic;
 
 
@@ -57,8 +57,12 @@ ffmpeg_content_test (int number, boost::filesystem::path content, ExportFormat f
                name += "h264";
                extension = "mp4";
                break;
+       case ExportFormat::PRORES_4444:
+               name += "prores-444";
+               extension = "mov";
+               break;
        case ExportFormat::PRORES_HQ:
-               name += "prores";
+               name += "prores-hq";
                extension = "mov";
                break;
        case ExportFormat::SUBTITLES_DCP:
@@ -318,7 +322,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test6)
        film2->examine_and_add_content (ov);
        BOOST_REQUIRE (!wait_for_jobs());
        ov->set_reference_video (true);
-       auto subs = content_factory("test/data/subrip.srt").front();
+       auto subs = content_factory("test/data/subrip.srt")[0];
        film2->examine_and_add_content (subs);
        BOOST_REQUIRE (!wait_for_jobs());
        for (auto i: subs->text) {
@@ -365,6 +369,18 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test7)
 }
 
 
+BOOST_AUTO_TEST_CASE(ffmpeg_encoder_2d_content_in_3d_project)
+{
+       auto content = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
+       auto film = new_test_film2("ffmpeg_encoder_2d_content_in_3d_project", { content });
+       film->set_three_d(true);
+
+       auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
+       FFmpegEncoder encoder(film, job, "build/test/ffmpeg_encoder_2d_content_in_3d_project.mp4", ExportFormat::H264_AAC, true, false, false, 23);
+       encoder.go();
+}
+
+
 /** Stereo project with mixdown-to-stereo set */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8)
 {
@@ -382,9 +398,9 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test8)
 /** 7.1/HI/VI (i.e. 12-channel) project */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_test9)
 {
-       shared_ptr<Film> film = new_test_film ("ffmpeg_encoder_prores_test9");
-       film->set_name ("ffmpeg_encoder_prores_test9");
        auto c = make_shared<ImageContent>(TestPaths::private_data() / "bbc405.png");
+       auto film = new_test_film2("ffmpeg_encoder_prores_test9", { c });
+       film->set_name ("ffmpeg_encoder_prores_test9");
        film->set_container (Ratio::from_id ("185"));
        film->set_audio_channels (12);
 
@@ -433,8 +449,8 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_from_dcp_with_crop)
 /** Export to H264 with reels */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_with_reels)
 {
-       auto content1 = content_factory("test/data/flat_red.png").front();
-       auto content2 = content_factory("test/data/flat_red.png").front();
+       auto content1 = content_factory("test/data/flat_red.png")[0];
+       auto content2 = content_factory("test/data/flat_red.png")[0];
        auto film = new_test_film2 ("ffmpeg_encoder_h264_with_reels", { content1, content2 });
        film->set_reel_type (ReelType::BY_VIDEO_CONTENT);
        content1->video->set_length (240);
@@ -445,7 +461,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_with_reels)
        encoder.go ();
 
        auto check = [](boost::filesystem::path path) {
-               auto reel = std::dynamic_pointer_cast<FFmpegContent>(content_factory(path).front());
+               auto reel = std::dynamic_pointer_cast<FFmpegContent>(content_factory(path)[0]);
                BOOST_REQUIRE (reel);
                FFmpegExaminer examiner(reel);
                BOOST_CHECK_EQUAL (examiner.video_length(), 240U);
@@ -459,7 +475,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_h264_with_reels)
 /** Regression test for "Error during decoding: Butler finished" (#2097) */
 BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_regression_1)
 {
-       auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv").front();
+       auto content = content_factory(TestPaths::private_data() / "arrietty_JP-EN.mkv")[0];
        auto film = new_test_film2 ("ffmpeg_encoder_prores_regression_1", { content });
 
        auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);
@@ -474,7 +490,7 @@ BOOST_AUTO_TEST_CASE (ffmpeg_encoder_prores_regression_2)
        auto logs = dcpomatic_log->types();
        dcpomatic_log->set_types(logs | LogEntry::TYPE_DEBUG_PLAYER);
 
-       auto content = content_factory(TestPaths::private_data() / "tge_clip.mkv").front();
+       auto content = content_factory(TestPaths::private_data() / "tge_clip.mkv")[0];
        auto film = new_test_film2 ("ffmpeg_encoder_prores_regression_2", { content });
 
        auto job = make_shared<TranscodeJob>(film, TranscodeJob::ChangedBehaviour::IGNORE);