diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-01-18 17:06:23 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-01-18 17:06:23 +0100 |
| commit | b2e68c20550fce629d9ebaf1fca5244d1e2ca517 (patch) | |
| tree | 70ec866c91e440d82cd885e723f8bf0afb9ec137 /src | |
| parent | 36310b78f8fd84554f2c87dc513bd04efe0fd69a (diff) | |
Bv2.1 8.6.3: <ExtensionMetadata> must be present and have precise contents.
Diffstat (limited to 'src')
| -rw-r--r-- | src/verify.cc | 64 | ||||
| -rw-r--r-- | src/verify.h | 4 |
2 files changed, 68 insertions, 0 deletions
diff --git a/src/verify.cc b/src/verify.cc index d5b80b9f..58e777fb 100644 --- a/src/verify.cc +++ b/src/verify.cc @@ -1003,6 +1003,64 @@ check_text_timing (vector<shared_ptr<dcp::Reel>> reels, vector<VerificationNote> } +void +check_extension_metadata (shared_ptr<dcp::CPL> cpl, vector<VerificationNote>& notes) +{ + DCP_ASSERT (cpl->file()); + cxml::Document doc ("CompositionPlaylist"); + doc.read_file (cpl->file().get()); + + auto missing = false; + string malformed; + + if (auto reel_list = doc.node_child("ReelList")) { + auto reels = reel_list->node_children("Reel"); + if (!reels.empty()) { + if (auto asset_list = reels[0]->optional_node_child("AssetList")) { + if (auto metadata = asset_list->optional_node_child("CompositionMetadataAsset")) { + if (auto extension_list = metadata->optional_node_child("ExtensionMetadataList")) { + missing = true; + for (auto extension: extension_list->node_children("ExtensionMetadata")) { + if (extension->optional_string_attribute("scope").get_value_or("") != "http://isdcf.com/ns/cplmd/app") { + continue; + } + missing = false; + if (auto name = extension->optional_node_child("Name")) { + if (name->content() != "Application") { + malformed = "<Name> should be 'Application'"; + } + } + if (auto property_list = extension->optional_node_child("PropertyList")) { + if (auto property = property_list->optional_node_child("Property")) { + if (auto name = property->optional_node_child("Name")) { + if (name->content() != "DCP Constraints Profile") { + malformed = "<Name> property should be 'DCP Constraints Profile'"; + } + } + if (auto value = property->optional_node_child("Value")) { + if (value->content() != "SMPTE-RDD-52:2020-Bv2.1") { + malformed = "<Value> property should be 'SMPTE-RDD-52:2020-Bv2.1'"; + } + } + } + } + } + } else { + missing = true; + } + } + } + } + } + + if (missing) { + notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::MISSING_EXTENSION_METADATA}); + } else if (!malformed.empty()) { + notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::INVALID_EXTENSION_METADATA, malformed}); + } +} + + vector<VerificationNote> dcp::verify ( vector<boost::filesystem::path> directories, @@ -1240,6 +1298,8 @@ dcp::verify ( } else if (!cpl->version_number()) { notes.push_back ({VerificationNote::VERIFY_BV21_ERROR, VerificationNote::MISSING_CPL_METADATA_VERSION_NUMBER}); } + + check_extension_metadata (cpl, notes); } } @@ -1377,6 +1437,10 @@ dcp::note_to_string (dcp::VerificationNote note) return "There should be a <CompositionMetadataAsset> tag"; case dcp::VerificationNote::MISSING_CPL_METADATA_VERSION_NUMBER: return "The CPL metadata must contain a <VersionNumber>"; + case dcp::VerificationNote::MISSING_EXTENSION_METADATA: + return "The CPL metadata must contain <ExtensionMetadata>"; + case dcp::VerificationNote::INVALID_EXTENSION_METADATA: + return String::compose("The <ExtensionMetadata> is malformed in some way: %1", note.note().get()); } return ""; diff --git a/src/verify.h b/src/verify.h index 65095a8f..60100435 100644 --- a/src/verify.h +++ b/src/verify.h @@ -169,6 +169,10 @@ public: MISSING_CPL_METADATA, /** CPL metadata should contain <VersionNumber> of 1, at least */ MISSING_CPL_METADATA_VERSION_NUMBER, + /** There must be an <ExtensionMetadata> in <CompositionMetadataAsset> Bv2.1_8.6.3 */ + MISSING_EXTENSION_METADATA, + /** <ExtensionMetadata> must have a particular form Bv2.1_8.6.3 */ + INVALID_EXTENSION_METADATA, }; VerificationNote (Type type, Code code) |
