summaryrefslogtreecommitdiff
path: root/src/reel_mxf_asset.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/reel_mxf_asset.cc')
-rw-r--r--src/reel_mxf_asset.cc24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/reel_mxf_asset.cc b/src/reel_mxf_asset.cc
index 95b97021..938f1e48 100644
--- a/src/reel_mxf_asset.cc
+++ b/src/reel_mxf_asset.cc
@@ -41,9 +41,27 @@ ReelMXFAsset::ReelMXFAsset (shared_ptr<MXF> mxf, Fraction edit_rate, int64_t int
ReelMXFAsset::ReelMXFAsset (shared_ptr<const cxml::Node> node)
: ReelAsset (node)
- , _key_id (node->optional_string_child ("KeyId").get_value_or (""))
+ , _key_id (node->optional_string_child ("KeyId"))
{
- if (_key_id.length() > 9) {
- _key_id = _key_id.substr (9);
+ if (_key_id && _key_id.get().length() > 9) {
+ _key_id = _key_id.get().substr (9);
}
}
+
+void
+ReelMXFAsset::write_to_cpl (xmlpp::Node* node, Standard s) const
+{
+ ReelAsset::write_to_cpl (node, s);
+
+ xmlpp::Node::NodeList c = node->get_children ();
+ xmlpp::Node::NodeList::iterator i = c.begin();
+ while (i != c.end() && (*i)->get_name() != cpl_node_name ()) {
+ ++i;
+ }
+
+ DCP_ASSERT (i != c.end ());
+
+ if (_key_id) {
+ (*i)->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id.get ());
+ }
+}