Fix signing of KDMs.
[libdcp.git] / src / reel.cc
index 3b49042a144cd10e148e780880f8bd2f79e0ff7c..51aa560c706297a0658c5744808c1cbc9698d2c3 100644 (file)
@@ -32,11 +32,11 @@ using boost::shared_ptr;
 using namespace libdcp;
 
 void
-Reel::write_to_cpl (xmlpp::Node* node, bool interop) const
+Reel::write_to_cpl (xmlpp::Element* node, bool interop) const
 {
-       xmlpp::Node* reel = node->add_child ("Reel");
+       xmlpp::Element* reel = node->add_child ("Reel");
        reel->add_child("Id")->add_child_text ("urn:uuid:" + make_uuid());
-       xmlpp::Node* asset_list = reel->add_child ("AssetList");
+       xmlpp::Element* asset_list = reel->add_child ("AssetList");
        
        if (_main_picture) {
                _main_picture->write_to_cpl (asset_list, interop);
@@ -93,14 +93,25 @@ Reel::encrypted () const
 void
 Reel::add_kdm (KDM const & kdm)
 {
-       list<KDMCipher> ciphers = kdm.ciphers ();
+       list<KDMKey> keys = kdm.keys ();
        
-       for (list<KDMCipher>::iterator i = ciphers.begin(); i != ciphers.end(); ++i) {
+       for (list<KDMKey>::iterator i = keys.begin(); i != keys.end(); ++i) {
                if (i->key_id() == _main_picture->key_id()) {
-                       _main_picture->set_kdm_cipher (*i);
+                       _main_picture->set_key (i->key ());
                }
                if (i->key_id() == _main_sound->key_id()) {
-                       _main_sound->set_kdm_cipher (*i);
+                       _main_sound->set_key (i->key ());
                }
        }
 }
+
+void
+Reel::set_mxf_keys (Key key)
+{
+       _main_picture->set_key (key);
+       if (_main_sound) {
+               _main_sound->set_key (key);
+       }
+
+       /* XXX: subtitle asset? */
+}