summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-11-29 01:09:16 +0100
committerCarl Hetherington <cth@carlh.net>2024-12-08 21:29:37 +0100
commitf97db44f499d5f1b1749a6f188ebba9b5c101f1f (patch)
tree48a7d6b1d2e81858046e28b2b14bbf1f685ad9ac
parentd0255af1234de0f90017930b2ceb7e75ec14ca95 (diff)
Fix DCP Constraints Profile verification in the presence of other CPL metadata Properties.
-rw-r--r--src/verify.cc19
-rw-r--r--test/verify_test.cc24
2 files changed, 29 insertions, 14 deletions
diff --git a/src/verify.cc b/src/verify.cc
index 8ad5f8a2..8bf65fc3 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -1300,17 +1300,14 @@ dcp::verify_extension_metadata(Context& context)
}
}
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'";
- }
- }
+ auto properties = property_list->node_children("Property");
+ auto is_bv21 = [](shared_ptr<const cxml::Node> property) {
+ auto name = property->optional_node_child("Name");
+ auto value = property->optional_node_child("Value");
+ return name && value && name->content() == "DCP Constraints Profile" && value->content() == "SMPTE-RDD-52:2020-Bv2.1";
+ };
+ if (!std::any_of(properties.begin(), properties.end(), is_bv21)) {
+ malformed = "No correctly-formed DCP Constraints Profile found";
}
}
}
diff --git a/test/verify_test.cc b/test/verify_test.cc
index 57e2e0f6..51448297 100644
--- a/test/verify_test.cc
+++ b/test/verify_test.cc
@@ -4340,7 +4340,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_extension_metadata2)
dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->file().get()
).set_cpl_id(cpl->id()).set_reference_hash(calc.old_hash()).set_calculated_hash(calc.new_hash()),
dcp::VerificationNote(
- dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_EXTENSION_METADATA, string("<Name> property should be 'DCP Constraints Profile'"), cpl->file().get()
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_EXTENSION_METADATA, string("No correctly-formed DCP Constraints Profile found"), cpl->file().get()
).set_cpl_id(cpl->id())
});
}
@@ -4387,7 +4387,10 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata6)
).set_cpl_id(cpl->id()),
dcp::VerificationNote(
dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->file().get()
- ).set_cpl_id(cpl->id()).set_reference_hash(calc.old_hash()).set_calculated_hash(calc.new_hash())
+ ).set_cpl_id(cpl->id()).set_reference_hash(calc.old_hash()).set_calculated_hash(calc.new_hash()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_EXTENSION_METADATA, string("No correctly-formed DCP Constraints Profile found"), cpl->file().get()
+ ).set_cpl_id(cpl->id())
});
}
@@ -4428,7 +4431,7 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata7)
dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->file().get()
).set_cpl_id(cpl->id()).set_reference_hash(calc.old_hash()).set_calculated_hash(calc.new_hash()),
dcp::VerificationNote(
- dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_EXTENSION_METADATA, string("<Value> property should be 'SMPTE-RDD-52:2020-Bv2.1'"), cpl->file().get()
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_EXTENSION_METADATA, string("No correctly-formed DCP Constraints Profile found"), cpl->file().get()
).set_cpl_id(cpl->id())
});
}
@@ -4475,6 +4478,9 @@ BOOST_AUTO_TEST_CASE (verify_invalid_xml_cpl_extension_metadata8)
dcp::VerificationNote(
dcp::VerificationNote::Type::ERROR, dcp::VerificationNote::Code::MISMATCHED_CPL_HASHES, cpl->file().get()
).set_cpl_id(cpl->id()).set_reference_hash(calc.old_hash()).set_calculated_hash(calc.new_hash()),
+ dcp::VerificationNote(
+ dcp::VerificationNote::Type::BV21_ERROR, dcp::VerificationNote::Code::INVALID_EXTENSION_METADATA, string("No correctly-formed DCP Constraints Profile found"), cpl->file().get()
+ ).set_cpl_id(cpl->id())
});
}
@@ -5875,3 +5881,15 @@ BOOST_AUTO_TEST_CASE(overlapping_subtitles)
dcp::verify_text_lines_and_characters(asset, 64, 80, &result);
}
+
+BOOST_AUTO_TEST_CASE(multiple_metadata_property)
+{
+ vector<dcp::VerificationNote> notes;
+ auto stage = [](std::string, boost::optional<boost::filesystem::path>) {};
+ auto progress = [](float) {};
+
+ dcp::Context context(notes, {}, stage, progress, {});
+ context.cpl = make_shared<dcp::CPL>(private_test / "CPL_6935f81f-30d3-4283-898e-5bb1e9c2558c.xml");
+ verify_extension_metadata(context);
+}
+