Emit no audio from DCPs if none is mapped
[dcpomatic.git] / test / vf_test.cc
index 2311e353733ad55553c794102d984f3e9554a503..ca987b22d4ce4cc91d51bf41b5ad7b86ff4beb5a 100644 (file)
@@ -73,6 +73,7 @@ BOOST_AUTO_TEST_CASE (vf_test1)
 
        /* Multi-reel DCP can't be referenced if we are using a single reel for the project */
        film->set_reel_type (ReelType::SINGLE);
+       film->set_audio_channels(16);
        string why_not;
        BOOST_CHECK (!dcp->can_reference_video(film, why_not));
        BOOST_CHECK (!dcp->can_reference_audio(film, why_not));
@@ -142,7 +143,9 @@ BOOST_AUTO_TEST_CASE (vf_test2)
                        dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
                        dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
                        dcp::VerificationNote::Code::INVALID_SUBTITLE_DURATION
-               });
+               },
+               false
+               );
 
        dcp::DCP ov_c (ov->dir(ov->dcp_name()));
        ov_c.read ();
@@ -197,7 +200,7 @@ BOOST_AUTO_TEST_CASE (vf_test3)
        BOOST_REQUIRE (!wait_for_jobs());
        dcp->set_reference_video (true);
        dcp->set_reference_audio (true);
-       make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+       make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
 
        dcp::DCP vf_c (vf->dir(vf->dcp_name()));
        vf_c.read ();
@@ -246,7 +249,7 @@ BOOST_AUTO_TEST_CASE (vf_test4)
        BOOST_REQUIRE (!wait_for_jobs());
        more_video->set_position (vf, DCPTime());
        vf->write_metadata ();
-       make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+       make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
 
        dcp::DCP ov_c (ov->dir(ov->dcp_name()));
        ov_c.read ();
@@ -299,7 +302,7 @@ BOOST_AUTO_TEST_CASE (vf_test5)
        dcp->set_reference_video (true);
        dcp->set_reference_audio (true);
        dcp->set_trim_end (ContentTime::from_seconds(15));
-       make_and_verify_dcp (vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET});
+       make_and_verify_dcp(vf, {dcp::VerificationNote::Code::EXTERNAL_ASSET}, false);
 
        /* Check that the selected reel assets are right */
        auto a = get_referenced_reel_assets(vf, vf->playlist());
@@ -351,7 +354,9 @@ BOOST_AUTO_TEST_CASE (vf_test6)
                        dcp::VerificationNote::Code::EXTERNAL_ASSET,
                        dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE,
                        dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME
-               });
+               },
+               false
+               );
 }
 
 
@@ -405,7 +410,7 @@ BOOST_AUTO_TEST_CASE (test_vf_with_trimmed_multi_reel_dcp)
        vf_dcp->set_reference_audio(true);
        vf_dcp->set_trim_start(vf, ContentTime::from_seconds(10));
        vf_dcp->set_position(vf, DCPTime::from_seconds(10));
-       make_and_verify_dcp (vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET });
+       make_and_verify_dcp(vf, { dcp::VerificationNote::Code::EXTERNAL_ASSET }, false);
 }
 
 
@@ -555,3 +560,25 @@ BOOST_AUTO_TEST_CASE(test_referencing_ov_with_missing_subtitle_in_some_reels)
        verify_dcp(vf->dir(vf->dcp_name()), ignore);
 }
 
+
+/* Test bug #2703: a VF that refers to some OV subs does not get the correct subtitle language in the ISDCF name */
+BOOST_AUTO_TEST_CASE(ov_subs_in_vf_name)
+{
+       auto subs = content_factory("test/data/short.srt")[0];
+       auto ov = new_test_film2("ov_subs_in_vf_name_ov", { subs });
+       subs->only_text()->set_language(dcp::LanguageTag("de"));
+       make_and_verify_dcp(
+               ov,
+               {
+                       dcp::VerificationNote::Code::INVALID_SUBTITLE_FIRST_TEXT_TIME,
+                       dcp::VerificationNote::Code::MISSING_CPL_METADATA
+               });
+
+       auto ov_dcp = make_shared<DCPContent>(ov->dir(ov->dcp_name()));
+       auto vf = new_test_film2("ov_subs_in_vf_name_vf", { ov_dcp });
+       vf->set_name("foo");
+       ov_dcp->set_reference_text(TextType::OPEN_SUBTITLE, true);
+       vf->_isdcf_date = boost::gregorian::date(2023, boost::gregorian::Jan, 18);
+
+       BOOST_CHECK_EQUAL(vf->isdcf_name(false), "Foo_TST-1_F_XX-DE_51-HI-VI_2K_20230118_SMPTE_VF");
+}