diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-18 22:53:57 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-18 22:53:57 +0100 |
| commit | 49b30838def07c225481def5e54458c22f6ceece (patch) | |
| tree | fce213ba90b6688f038be5edf5d51c756fe5a6bb /src | |
| parent | 2c11132af71aefb81f9e201403b1f3b9b005d0c0 (diff) | |
Bv2.1 9.1: PKL annotation text must match CPL ContentTitleText if there is only one CPL in the PKL.
Diffstat (limited to 'src')
| -rw-r--r-- | src/verify.cc | 25 | ||||
| -rw-r--r-- | src/verify.h | 4 |
2 files changed, 27 insertions, 2 deletions
diff --git a/src/verify.cc b/src/verify.cc index 3f15668f..901f44bc 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1127,12 +1127,33 @@ dcp::verify ( } } - /* Check that the CPL's hash corresponds to the PKL */ for (auto i: dcp->pkls()) { + /* Check that the CPL's hash corresponds to the PKL */ optional<string> h = i->hash(cpl->id()); if (h && make_digest(ArrayData(*cpl->file())) != *h) { notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::CPL_HASH_INCORRECT)); } + + /* Check that any PKL with a single CPL has its AnnotationText the same as the CPL's ContentTitleText */ + optional<string> required_annotation_text; + for (auto j: i->asset_list()) { + /* See if this is a CPL */ + for (auto k: dcp->cpls()) { + if (j->id() == k->id()) { + if (!required_annotation_text) { + /* First CPL we have found; this is the required AnnotationText unless we find another */ + required_annotation_text = cpl->content_title_text(); + } else { + /* There's more than one CPL so we don't care what the PKL's AnnotationText is */ + required_annotation_text = boost::none; + } + } + } + } + + if (required_annotation_text && i->annotation_text() != required_annotation_text) { + notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::PKL_ANNOTATION_TEXT_DOES_NOT_MATCH_CPL_CONTENT_TITLE_TEXT, i->file().get()}); + } } /* set to true if any reel has a MainSubtitle */ @@ -1452,6 +1473,8 @@ dcp::note_to_string (dcp::VerificationNote note) return String::compose("The <ExtensionMetadata> is malformed in some way: %1", note.note().get()); case dcp::VerificationNote::CPL_WITH_ENCRYPTED_CONTENT_NOT_SIGNED: return String::compose("The CPL %1, which has encrypted content, is not signed", note.file()->filename()); + case dcp::VerificationNote::PKL_ANNOTATION_TEXT_DOES_NOT_MATCH_CPL_CONTENT_TITLE_TEXT: + return String::compose("The PKL %1 has only one CPL but its <AnnotationText> does not match the CPL's <ContentTitleText>", note.file()->filename()); } return ""; diff --git a/src/verify.h b/src/verify.h index 833efa72..46c7b2e3 100644 --- a/src/verify.h +++ b/src/verify.h @@ -174,7 +174,9 @@ public: /** <ExtensionMetadata> must have a particular form Bv2.1_8.6.3 */ INVALID_EXTENSION_METADATA, /** CPLs containing encrypted content must be signed Bv2.1_8.7 */ - CPL_WITH_ENCRYPTED_CONTENT_NOT_SIGNED + CPL_WITH_ENCRYPTED_CONTENT_NOT_SIGNED, + /** If a PKL has one CPL its <ContentTitleText> must be the same as the PKL's <AnnotationText> */ + PKL_ANNOTATION_TEXT_DOES_NOT_MATCH_CPL_CONTENT_TITLE_TEXT }; VerificationNote (Type type, Code code) |
