summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-05-27 14:22:48 +0200
committerCarl Hetherington <cth@carlh.net>2021-05-27 14:25:17 +0200
commitdd672d926e3b88cbe42b0778fda397d9e858b592 (patch)
tree1f30fe44ed09b2a588f87f17c8a58d2a7e00eb8f /src
parenta6a1294944d4ce02cbb429ca1aec07ca78d79a88 (diff)
Make similar changes to the previous commit for _xml_id.
This is also unavailable if the asset is encrypted.
Diffstat (limited to 'src')
-rw-r--r--src/smpte_subtitle_asset.cc6
-rw-r--r--src/smpte_subtitle_asset.h8
-rw-r--r--src/verify.cc15
3 files changed, 20 insertions, 9 deletions
diff --git a/src/smpte_subtitle_asset.cc b/src/smpte_subtitle_asset.cc
index d0fbc0eb..11450ef3 100644
--- a/src/smpte_subtitle_asset.cc
+++ b/src/smpte_subtitle_asset.cc
@@ -347,7 +347,8 @@ SMPTESubtitleAsset::xml_as_string () const
root->set_namespace_declaration (subtitle_smpte_ns, "dcst");
root->set_namespace_declaration ("http://www.w3.org/2001/XMLSchema", "xs");
- root->add_child("Id", "dcst")->add_child_text ("urn:uuid:" + _xml_id);
+ DCP_ASSERT (_xml_id);
+ root->add_child("Id", "dcst")->add_child_text ("urn:uuid:" + *_xml_id);
root->add_child("ContentTitleText", "dcst")->add_child_text (_content_title_text);
if (_annotation_text) {
root->add_child("AnnotationText", "dcst")->add_child_text (_annotation_text.get ());
@@ -422,7 +423,8 @@ SMPTESubtitleAsset::write (boost::filesystem::path p) const
descriptor.NamespaceName = subtitle_smpte_ns;
unsigned int c;
- Kumu::hex2bin (_xml_id.c_str(), descriptor.AssetID, ASDCP::UUIDlen, &c);
+ DCP_ASSERT (_xml_id);
+ Kumu::hex2bin (_xml_id->c_str(), descriptor.AssetID, ASDCP::UUIDlen, &c);
DCP_ASSERT (c == Kumu::UUID_Length);
descriptor.ContainerDuration = _intrinsic_duration;
diff --git a/src/smpte_subtitle_asset.h b/src/smpte_subtitle_asset.h
index f63392c7..4e220d4d 100644
--- a/src/smpte_subtitle_asset.h
+++ b/src/smpte_subtitle_asset.h
@@ -176,7 +176,10 @@ public:
return _start_time;
}
- std::string xml_id () const {
+ /** @return ID from XML's <Id> tag, or the <Id> that will be used when writing the XML,
+ * or boost::none if this content is encrypted and no key is available.
+ */
+ boost::optional<std::string> xml_id () const {
return _xml_id;
}
@@ -227,8 +230,9 @@ private:
std::vector<std::shared_ptr<SMPTELoadFontNode>> _load_font_nodes;
/** UUID for the XML inside the MXF, which should be the same as the ResourceID in the MXF (our _resource_id)
* but different to the AssetUUID in the MXF (our _id) according to SMPTE Bv2.1 and Doremi's 2.8.18 release notes.
+ * May be boost::none if this object has been made from an encrypted object without a key.
*/
- std::string _xml_id;
+ boost::optional<std::string> _xml_id;
/** ResourceID read from the MXF, if there was one */
boost::optional<std::string> _resource_id;
diff --git a/src/verify.cc b/src/verify.cc
index 40f7c0b6..5550a67f 100644
--- a/src/verify.cc
+++ b/src/verify.cc
@@ -703,12 +703,17 @@ verify_smpte_subtitle_asset (
}
DCP_ASSERT (asset->resource_id());
- if (asset->resource_id().get() != asset->xml_id()) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISMATCHED_TIMED_TEXT_RESOURCE_ID });
- }
+ auto xml_id = asset->xml_id();
+ if (xml_id) {
+ if (asset->resource_id().get() != xml_id) {
+ notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::MISMATCHED_TIMED_TEXT_RESOURCE_ID });
+ }
- if (asset->id() == asset->resource_id().get() || asset->id() == asset->xml_id()) {
- notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_TIMED_TEXT_ASSET_ID });
+ if (asset->id() == asset->resource_id().get() || asset->id() == xml_id) {
+ notes.push_back ({ VerificationNote::Type::BV21_ERROR, VerificationNote::Code::INCORRECT_TIMED_TEXT_ASSET_ID });
+ }
+ } else {
+ notes.push_back ({VerificationNote::Type::WARNING, VerificationNote::Code::MISSED_CHECK_OF_ENCRYPTED});
}
}