- /* Add keys from the DKDM */
- BOOST_FOREACH (dcp::DecryptedKDMKey const & j, decrypted.keys()) {
- kdm.add_key (j);
+ BOOST_FOREACH (shared_ptr<Screen> i, _screens->screens()) {
+
+ if (!i->recipient) {
+ continue;
+ }
+
+ /* Make an empty KDM */
+ dcp::DecryptedKDM kdm (
+ dcp::LocalTime (_timing->from(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()),
+ dcp::LocalTime (_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()),
+ decrypted.annotation_text().get_value_or (""),
+ decrypted.content_title_text(),
+ dcp::LocalTime().as_string()
+ );
+
+ /* Add keys from the DKDM */
+ BOOST_FOREACH (dcp::DecryptedKDMKey const & j, decrypted.keys()) {
+ kdm.add_key (j);
+ }
+
+ /* Encrypt */
+ screen_kdms.push_back (
+ shared_ptr<ScreenKDM>(
+ new DCPScreenKDM(
+ i,
+ kdm.encrypt(
+ signer, i->recipient.get(), i->trusted_device_thumbprints(), _output->formulation(),
+ !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional<int>() : 0
+ )
+ )
+ )
+ );