+void
+MXFAsset::add_typed_key_id (xmlpp::Element* parent) const
+{
+ xmlpp::Element* typed_key_id = parent->add_child("TypedKeyId");
+ typed_key_id->add_child("KeyType")->add_child_text(key_type ());
+ typed_key_id->add_child("KeyId")->add_child_text("urn:uuid:" + _key_id);
+}
+
+void
+MXFAsset::write_to_cpl (xmlpp::Element* node, bool interop) const
+{
+ pair<string, string> const attr = cpl_node_attribute (interop);
+ xmlpp::Element* a = node->add_child (cpl_node_name ());
+ if (!attr.first.empty ()) {
+ a->set_attribute (attr.first, attr.second);
+ }
+ a->add_child ("Id")->add_child_text ("urn:uuid:" + _uuid);
+ a->add_child ("AnnotationText")->add_child_text (_file_name);
+ a->add_child ("EditRate")->add_child_text (lexical_cast<string> (_edit_rate) + " 1");
+ a->add_child ("IntrinsicDuration")->add_child_text (lexical_cast<string> (_intrinsic_duration));
+ a->add_child ("EntryPoint")->add_child_text (lexical_cast<string> (_entry_point));
+ a->add_child ("Duration")->add_child_text (lexical_cast<string> (_duration));
+ if (!_key_id.empty ()) {
+ a->add_child("KeyId")->add_child_text ("urn:uuid:" + _key_id);
+ }
+}
+
+void
+MXFAsset::set_key (Key key)
+{
+ _key = key;
+
+ if (_key_id.empty ()) {
+ /* No key ID so far; we now need one */
+ _key_id = make_uuid ();