Add check for empty <LabelText> in <ContentVersion> v1.8.76
authorCarl Hetherington <cth@carlh.net>
Fri, 11 Aug 2023 18:51:21 +0000 (20:51 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 11 Aug 2023 18:51:23 +0000 (20:51 +0200)
We have a report of Deluxe failing a DCP because of this.

src/verify.cc
src/verify.h
test/verify_test.cc

index 8f318af9f2674f47de2615de1a6605f6f98d35a4..42ee192119b85280ada83512167a01aaa2a4805d 100644 (file)
@@ -1548,6 +1548,15 @@ verify_cpl(
                }
        }
 
+       for (auto version: cpl->content_versions()) {
+               if (version.label_text.empty()) {
+                       notes.push_back(
+                               dcp::VerificationNote(VerificationNote::Type::WARNING, VerificationNote::Code::EMPTY_CONTENT_VERSION_LABEL_TEXT, cpl->file().get()).set_id(cpl->id())
+                               );
+                       break;
+               }
+       }
+
        if (dcp->standard() == Standard::SMPTE) {
                if (!cpl->annotation_text()) {
                        notes.push_back({VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISSING_CPL_ANNOTATION_TEXT, cpl->id(), cpl->file().get()});
@@ -2091,6 +2100,8 @@ dcp::note_to_string (VerificationNote note)
                return String::compose("The SMPTE subtitle asset %1 has <Text> nodes but no <LoadFont> node", note.id().get());
        case VerificationNote::Code::MISMATCHED_ASSET_MAP_ID:
                return String::compose("The asset with ID %1 in the asset map actually has an id of %2", note.id().get(), note.other_id().get());
+       case VerificationNote::Code::EMPTY_CONTENT_VERSION_LABEL_TEXT:
+               return String::compose("The <LabelText> in a <ContentVersion> in CPL %1 is empty", note.id().get());
        }
 
        return "";
index 37a1fc11400fba8235faa4896e93ffd9039a27b0..fdf2d7ffbdedf93ce94f008a504da22e961bc533 100644 (file)
@@ -462,6 +462,11 @@ public:
                 *  other_id contains the ID from the file.
                 */
                MISMATCHED_ASSET_MAP_ID,
+               /** The <LabelText> inside a <ContentVersion> is empty
+                *  note contains the CPL ID
+                *  file contains the CPL filename
+                */
+               EMPTY_CONTENT_VERSION_LABEL_TEXT,
        };
 
        VerificationNote (Type type, Code code)
index ef406662d1e023be34258d75ff044f69729b7ee1..4138138f11d215d8517cfe3f8f24320da9ad7a0f 100644 (file)
@@ -541,6 +541,12 @@ BOOST_AUTO_TEST_CASE (verify_invalid_standard)
 BOOST_AUTO_TEST_CASE (verify_invalid_duration)
 {
        auto dir = setup (8, "invalid_duration");
+
+       dcp::DCP dcp(dir);
+       dcp.read();
+       BOOST_REQUIRE(dcp.cpls().size() == 1);
+       auto cpl = dcp.cpls()[0];
+
        check_verify_result (
                { dir },
                {
@@ -549,7 +555,12 @@ BOOST_AUTO_TEST_CASE (verify_invalid_duration)
                        { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_INTRINSIC_DURATION, string("d7576dcb-a361-4139-96b8-267f5f8d7f91") },
                        { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_DURATION, string("a2a87f5d-b749-4a7e-8d0c-9d48a4abf626") },
                        { dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::INVALID_INTRINSIC_DURATION, string("a2a87f5d-b749-4a7e-8d0c-9d48a4abf626") },
-                       { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K, string("2") }
+                       { dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_JPEG2000_GUARD_BITS_FOR_2K, string("2") },
+                       dcp::VerificationNote(
+                               dcp::VerificationNote::Type::WARNING,
+                               dcp::VerificationNote::Code::EMPTY_CONTENT_VERSION_LABEL_TEXT,
+                               cpl->file().get()
+                       ).set_id("d74fda30-d5f4-4c5f-870f-ebc089d97eb7")
                });
 }
 
@@ -3618,3 +3629,22 @@ BOOST_AUTO_TEST_CASE(verify_spots_wrong_asset)
                        dcp::VerificationNote(dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_ASSET_MAP_ID).set_id(asset_1).set_other_id(asset_2)
                });
 }
+
+
+BOOST_AUTO_TEST_CASE(verify_cpl_content_version_label_text_empty)
+{
+       boost::filesystem::path const dir = "build/test/verify_cpl_content_version_label_text_empty";
+       boost::filesystem::remove_all(dir);
+
+       auto dcp = make_simple(dir);
+       BOOST_REQUIRE(dcp->cpls().size() == 1);
+       auto cpl = dcp->cpls()[0];
+       cpl->set_content_version(dcp::ContentVersion(""));
+       dcp->write_xml();
+
+       check_verify_result(
+               {dir},
+               {
+                       dcp::VerificationNote(dcp::VerificationNote::Type::WARNING, dcp::VerificationNote::Code::EMPTY_CONTENT_VERSION_LABEL_TEXT, cpl->file().get()).set_id(cpl->id())
+               });
+}