Fix failure to playback encrypted DCPs, introduced when adding DCPDecoder re-use...
[dcpomatic.git] / src / lib / dcp_decoder.cc
index 90b730f5b5d921fb58a8d5535f230d6bb8e3e6f4..95cad926620ad9a4824b40e8ff1914331d3e776e 100644 (file)
@@ -44,6 +44,7 @@
 #include <dcp/sound_frame.h>
 #include <dcp/sound_asset_reader.h>
 #include <dcp/subtitle_image.h>
+#include <dcp/decrypted_kdm.h>
 #include <boost/foreach.hpp>
 #include <iostream>
 
@@ -76,6 +77,14 @@ DCPDecoder::DCPDecoder (shared_ptr<const Film> film, shared_ptr<const DCPContent
 
        if (old) {
                _reels = old->_reels;
+
+               /* We might have gained a KDM since we made the Reel objects */
+               if (_dcp_content->kdm ()) {
+                       dcp::DecryptedKDM k = decrypted_kdm ();
+                       BOOST_FOREACH (shared_ptr<dcp::Reel> i, _reels) {
+                               i->add (k);
+                       }
+               }
        } else {
 
                list<shared_ptr<dcp::CPL> > cpl_list = cpls ();