Add KDMs after resolving asset references; don't complain
[dcpomatic.git] / src / lib / dcp.cc
index 6d5c0b2910ba5e6a78b41a75b5c873f8db81ea12..f58b06b57f4aab65ed48ac282f59cb4c18d7792c 100644 (file)
@@ -38,9 +38,6 @@ DCP::cpls () const
        BOOST_FOREACH (boost::filesystem::path i, _dcp_content->directories()) {
                shared_ptr<dcp::DCP> dcp (new dcp::DCP (i));
                dcp->read (false, 0, true);
-               if (_dcp_content->kdm ()) {
-                       dcp->add (dcp::DecryptedKDM (_dcp_content->kdm().get(), Config::instance()->decryption_chain()->key().get ()));
-               }
                dcps.push_back (dcp);
                BOOST_FOREACH (shared_ptr<dcp::CPL> i, dcp->cpls()) {
                        cpls.push_back (i);
@@ -55,5 +52,11 @@ DCP::cpls () const
                }
        }
 
+       if (_dcp_content->kdm ()) {
+               BOOST_FOREACH (shared_ptr<dcp::DCP> i, dcps) {
+                       i->add (dcp::DecryptedKDM (_dcp_content->kdm().get(), Config::instance()->decryption_chain()->key().get ()));
+               }
+       }
+
        return cpls;
 }