diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-01-29 00:59:48 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-02-11 22:26:38 +0100 |
| commit | 5ba982a14020f75e678d794c7c1c5246b0332e45 (patch) | |
| tree | bcf7eac9b3e1260e914bc762d2b17b55ba8e96b1 /src | |
| parent | 20c7c1a0bc0c9c07d70b5d3dcc536a5cd94e8a2c (diff) | |
Use kdm_for_screen also in dcpomatic_kdm
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 0d79d67a8..2e28b548a 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -377,46 +377,40 @@ private: vector<KDMCertificatePeriod> period_checks; - for (auto i: _screens->screens()) { - - if (!i->recipient) { - continue; - } - - dcp::LocalTime begin(_timing->from(), dcp::UTCOffset(i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute())); - dcp::LocalTime end(_timing->until(), dcp::UTCOffset(i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute())); - - period_checks.push_back(check_kdm_and_certificate_validity_periods(*i->recipient, begin, end)); - + std::function<dcp::DecryptedKDM (dcp::LocalTime, dcp::LocalTime)> make_kdm = [decrypted, title](dcp::LocalTime begin, dcp::LocalTime end) { /* Make an empty KDM */ dcp::DecryptedKDM kdm ( begin, end, - decrypted.annotation_text().get_value_or (""), + decrypted.annotation_text().get_value_or(""), title, dcp::LocalTime().as_string() ); /* Add keys from the DKDM */ for (auto const& j: decrypted.keys()) { - kdm.add_key (j); + kdm.add_key(j); } - auto const encrypted = kdm.encrypt( - signer, i->recipient.get(), i->trusted_device_thumbprints(), _output->formulation(), - !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional<int>() : 0 - ); - - dcp::NameFormat::Map name_values; - name_values['c'] = i->cinema->name; - name_values['s'] = i->name; - name_values['f'] = title; - name_values['b'] = begin.date() + " " + begin.time_of_day(true, false); - name_values['e'] = end.date() + " " + end.time_of_day(true, false); - name_values['i'] = encrypted.cpl_id (); - - /* Encrypt */ - kdms.push_back (make_shared<KDMWithMetadata>(name_values, i->cinema.get(), i->cinema->emails, encrypted)); + return kdm; + }; + + for (auto i: _screens->screens()) { + + auto kdm = kdm_for_screen( + make_kdm, + i, + _timing->from(), + _timing->until(), + _output->formulation(), + !_output->forensic_mark_video(), + _output->forensic_mark_audio() ? boost::optional<int>() : 0, + period_checks + ); + + if (kdm) { + kdms.push_back(kdm); + } } if (kdms.empty()) { |
