Fix ISDCF name when referring to OVs with subs (#2703).
authorCarl Hetherington <cth@carlh.net>
Wed, 17 Jan 2024 22:46:26 +0000 (23:46 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 17 Jan 2024 22:46:26 +0000 (23:46 +0100)
src/lib/film.cc
src/lib/film.h
test/vf_test.cc

index 27d23b1850a9f7c0dc14e2a5514ad0b42f112522..0bba13e2802c369504e973262b7140f0b306c8d4 100644 (file)
@@ -784,8 +784,10 @@ Film::subtitle_languages(bool* burnt_in) const
 
        pair<optional<dcp::LanguageTag>, vector<dcp::LanguageTag>> result;
        for (auto i: content()) {
+               auto dcp = dynamic_pointer_cast<DCPContent>(i);
                for (auto const& text: i->text) {
-                       if (text->use() && text->type() == TextType::OPEN_SUBTITLE) {
+                       auto const use = text->use() || (dcp && dcp->reference_text(TextType::OPEN_SUBTITLE));
+                       if (use && text->type() == TextType::OPEN_SUBTITLE) {
                                if (!text->burn() && burnt_in) {
                                        *burnt_in = false;
                                }
index 13be4b8db5e84270ac6c1a602b3a4b839c7063eb..43a41ad45d5a43fbeaf92accdea2595e9155e6db 100644 (file)
@@ -77,6 +77,7 @@ struct atmos_encrypted_passthrough_test;
 struct isdcf_name_test;
 struct isdcf_name_with_atmos;
 struct isdcf_name_with_ccap;
+struct ov_subs_in_vf_name;
 struct recover_test_2d_encrypted;
 
 
@@ -459,6 +460,7 @@ private:
        friend struct ::isdcf_name_with_ccap;
        friend struct ::recover_test_2d_encrypted;
        friend struct ::atmos_encrypted_passthrough_test;
+       friend struct ::ov_subs_in_vf_name;
        template <class, class> friend class ChangeSignalDespatcher;
 
        boost::filesystem::path info_file (dcpomatic::DCPTimePeriod p) const;
index eb93dab0e8fad5f40e6a86e9c39842e9b982dc4d..ed7f483ae5ae91617ab89eec0107079719fb5549 100644 (file)
@@ -559,3 +559,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");
+}