diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-15 22:56:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-17 20:13:23 +0100 |
| commit | 2fecea3b47ab64a8b8580b9d186d05c18ae0e29c (patch) | |
| tree | acf1969ba8f7c6be14e09aafa0801f00bc395bc7 | |
| parent | 9a6cf0df676175022f7d0cade7919153207b7910 (diff) | |
Bv2.1 8.4 We must have <Hash>es
| -rw-r--r-- | src/verify.cc | 6 | ||||
| -rw-r--r-- | src/verify.h | 2 | ||||
| -rw-r--r-- | test/verify_test.cc | 25 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/verify.cc b/src/verify.cc index 01d2e786..e02c573b 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1084,6 +1084,10 @@ dcp::verify ( if ((i->intrinsic_duration() * i->edit_rate().denominator / i->edit_rate().numerator) < 1) { notes.push_back (VerificationNote(VerificationNote::VERIFY_ERROR, VerificationNote::INTRINSIC_DURATION_TOO_SMALL, i->id())); } + auto mxf = dynamic_pointer_cast<ReelMXF>(i); + if (mxf && !mxf->hash()) { + notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::MISSING_HASH, i->id()}); + } } if (dcp->standard() == dcp::SMPTE) { @@ -1304,6 +1308,8 @@ dcp::note_to_string (dcp::VerificationNote note) return "Closed caption assets must have an <EntryPoint> tag."; case dcp::VerificationNote::CLOSED_CAPTION_ENTRY_POINT_NON_ZERO: return "Closed caption assets must have an <EntryPoint> of 0."; + case dcp::VerificationNote::MISSING_HASH: + return String::compose("An asset is missing a <Hash> tag: %1", note.note().get()); } return ""; diff --git a/src/verify.h b/src/verify.h index 917d5e53..5ba029c9 100644 --- a/src/verify.h +++ b/src/verify.h @@ -151,6 +151,8 @@ public: MISSING_CLOSED_CAPTION_ENTRY_POINT, /** Closed caption MainSubtitle <EntryPoint> must be zero Bv2.1_8.3.2 */ CLOSED_CAPTION_ENTRY_POINT_NON_ZERO, + /** <Hash> must be present for assets in CPLs */ + MISSING_HASH, }; VerificationNote (Type type, Code code) diff --git a/test/verify_test.cc b/test/verify_test.cc index 31647933..0b7faad5 100644 --- a/test/verify_test.cc +++ b/test/verify_test.cc @@ -1902,3 +1902,28 @@ BOOST_AUTO_TEST_CASE (verify_text_entry_point) } ); } + + +BOOST_AUTO_TEST_CASE (verify_assets_must_have_hashes) +{ + RNGFixer fix; + + boost::filesystem::path const dir("build/test/verify_assets_must_have_hashes"); + 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("<Hash>cb1OLhgHG9svy7G8hoTSPpltzhw=</Hash>", ""); + } + + check_verify_result ( + {dir}, + { + { dcp::VerificationNote::VERIFY_ERROR, dcp::VerificationNote::CPL_HASH_INCORRECT }, + { dcp::VerificationNote::VERIFY_BV21_ERROR, dcp::VerificationNote::MISSING_HASH } + }); +} + |
