Check for missing font files referred from Interop closed captions (as well as subs).
authorCarl Hetherington <cth@carlh.net>
Thu, 24 Aug 2023 21:19:44 +0000 (23:19 +0200)
committerCarl Hetherington <cth@carlh.net>
Thu, 24 Aug 2023 21:19:44 +0000 (23:19 +0200)
src/verify.cc
test/verify_test.cc

index 42ee192119b85280ada83512167a01aaa2a4805d..620ee31d872718be1be86295766a3045d70eb413 100644 (file)
@@ -715,9 +715,9 @@ verify_smpte_timed_text_asset (
 }
 
 
-/** Verify Interop subtitle-only stuff */
+/** Verify Interop subtitle / CCAP stuff */
 void
-verify_interop_subtitle_asset(shared_ptr<const InteropSubtitleAsset> asset, vector<VerificationNote>& notes)
+verify_interop_text_asset(shared_ptr<const InteropSubtitleAsset> asset, vector<VerificationNote>& notes)
 {
        if (asset->subtitles().empty()) {
                notes.push_back({VerificationNote::Type::ERROR, VerificationNote::Code::MISSING_SUBTITLE, asset->id(), asset->file().get() });
@@ -806,7 +806,7 @@ verify_subtitle_asset (
 
        auto interop = dynamic_pointer_cast<const InteropSubtitleAsset>(asset);
        if (interop) {
-               verify_interop_subtitle_asset(interop, notes);
+               verify_interop_text_asset(interop, notes);
                if (namespace_count(asset, "DCSubtitle") > 1) {
                        notes.push_back({ VerificationNote::Type::WARNING, VerificationNote::Code::INCORRECT_SUBTITLE_NAMESPACE_COUNT, asset->id() });
                }
@@ -848,6 +848,11 @@ verify_closed_caption_asset (
                notes.push_back ({VerificationNote::Type::WARNING, VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED});
        }
 
+       auto interop = dynamic_pointer_cast<const InteropSubtitleAsset>(asset);
+       if (interop) {
+               verify_interop_text_asset(interop, notes);
+       }
+
        auto smpte = dynamic_pointer_cast<const SMPTESubtitleAsset>(asset);
        if (smpte) {
                verify_smpte_timed_text_asset (smpte, reel_asset_duration, notes);
index 4138138f11d215d8517cfe3f8f24320da9ad7a0f..8b33db1a94828392231f6e457b6082c53d08454c 100644 (file)
@@ -670,6 +670,23 @@ BOOST_AUTO_TEST_CASE (verify_valid_interop_subtitles)
 }
 
 
+BOOST_AUTO_TEST_CASE(verify_catch_missing_font_file_with_interop_ccap)
+{
+       path const dir("build/test/verify_catch_missing_font_file_with_interop_ccap");
+       prepare_directory(dir);
+       copy_file("test/data/subs1.xml", dir / "ccap.xml");
+       auto asset = make_shared<dcp::InteropSubtitleAsset>(dir / "ccap.xml");
+       auto reel_asset = make_shared<dcp::ReelInteropClosedCaptionAsset>(asset, dcp::Fraction(24, 1), 16 * 24, 0);
+       write_dcp_with_single_asset(dir, reel_asset, dcp::Standard::INTEROP);
+
+       check_verify_result (
+               {dir}, {
+                       { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_STANDARD },
+                       { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISSING_FONT, string{"theFontId"} }
+               });
+}
+
+
 BOOST_AUTO_TEST_CASE (verify_invalid_interop_subtitles)
 {
        using namespace boost::filesystem;