Bv2.1 8.1: CPL must have <AnnotationText>.
authorCarl Hetherington <cth@carlh.net>
Thu, 14 Jan 2021 21:38:58 +0000 (22:38 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 17 Jan 2021 19:13:23 +0000 (20:13 +0100)
src/verify.cc
src/verify.h
test/verify_test.cc

index b6498891ac4d06a045b20568e41e72b4497ca745..56ef21c9b14ebe460e786bae72eab2ac77016975 100644 (file)
@@ -1026,6 +1026,10 @@ dcp::verify (
                                verify_language_tag (cpl->release_territory().get(), notes);
                        }
 
+                       if (dcp->standard() == dcp::SMPTE && !cpl->annotation_text()) {
+                               notes.push_back (VerificationNote(VerificationNote::VERIFY_BV21_ERROR, VerificationNote::MISSING_ANNOTATION_TEXT_IN_CPL));
+                       }
+
                        /* Check that the CPL's hash corresponds to the PKL */
                        for (auto i: dcp->pkls()) {
                                optional<string> h = i->hash(cpl->id());
@@ -1219,6 +1223,8 @@ dcp::note_to_string (dcp::VerificationNote note)
                return "There are more than 32 characters in at least one closed caption line, which is disallowed by Bv2.1";
        case dcp::VerificationNote::INVALID_SOUND_FRAME_RATE:
                return "A sound asset has a sampling rate other than 48kHz, which is disallowed by Bv2.1";
+       case dcp::VerificationNote::MISSING_ANNOTATION_TEXT_IN_CPL:
+               return "The CPL has no <AnnotationText> tag, which is required by Bv2.1";
        }
 
        return "";
index fa16dfa12373a072af5c028c11e04d50eaf5c5a4..8ee7e1ef8e5fdc6bc77d8aa9e3b9f845e944ad89 100644 (file)
@@ -133,6 +133,8 @@ public:
                CLOSED_CAPTION_LINE_TOO_LONG,
                /** The audio sampling rate must be 48kHz [Bv2.1_7.3] */
                INVALID_SOUND_FRAME_RATE,
+               /** The CPL has no <AnnotationText> tag [Bv2.1_8.1] */
+               MISSING_ANNOTATION_TEXT_IN_CPL,
        };
 
        VerificationNote (Type type, Code code)
index 42e1eefc2a3036b71f8e874c10a97c2a071b744b..98a28cbc3635d960b0f39478612b9a342a9750c4 100644 (file)
@@ -1628,3 +1628,26 @@ BOOST_AUTO_TEST_CASE (verify_sound_sampling_rate_must_be_48k)
 
        check_verify_result ({dir}, {{ dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::INVALID_SOUND_FRAME_RATE }});
 }
+
+
+BOOST_AUTO_TEST_CASE (verify_cpl_must_have_annotation_text)
+{
+       boost::filesystem::path const dir("build/test/verify_cpl_must_have_annotation_text");
+       auto dcp = make_simple (dir);
+       dcp->write_xml (dcp::SMPTE);
+       BOOST_REQUIRE_EQUAL (dcp->cpls().size(), 1U);
+
+       {
+               BOOST_REQUIRE (dcp->cpls()[0]->file());
+               Editor e(dcp->cpls()[0]->file().get());
+               e.replace("<AnnotationText>A Test DCP</AnnotationText>", "");
+       }
+
+       check_verify_result (
+               {dir},
+               {
+                       { dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::MISSING_ANNOTATION_TEXT_IN_CPL },
+                       { dcp::VerificationNote::VERIFY_ERROR, dcp::VerificationNote::CPL_HASH_INCORRECT }
+               });
+}
+