summaryrefslogtreecommitdiff
path: root/src/lib/screen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/screen.cc')
-rw-r--r--src/lib/screen.cc58
1 files changed, 15 insertions, 43 deletions
diff --git a/src/lib/screen.cc b/src/lib/screen.cc
index febf9085c..b77eb6b52 100644
--- a/src/lib/screen.cc
+++ b/src/lib/screen.cc
@@ -20,6 +20,7 @@
#include "cinema.h"
+#include "cinema_list.h"
#include "config.h"
#include "film.h"
#include "kdm_util.h"
@@ -39,29 +40,6 @@ using boost::optional;
using namespace dcpomatic;
-Screen::Screen (cxml::ConstNodePtr node)
- : KDMRecipient (node)
-{
- for (auto i: node->node_children ("TrustedDevice")) {
- if (boost::algorithm::starts_with(i->content(), "-----BEGIN CERTIFICATE-----")) {
- trusted_devices.push_back (TrustedDevice(dcp::Certificate(i->content())));
- } else {
- trusted_devices.push_back (TrustedDevice(i->content()));
- }
- }
-}
-
-
-void
-Screen::as_xml (xmlpp::Element* parent) const
-{
- KDMRecipient::as_xml (parent);
- for (auto i: trusted_devices) {
- parent->add_child("TrustedDevice")->add_child_text(i.as_string());
- }
-}
-
-
vector<string>
Screen::trusted_device_thumbprints () const
{
@@ -76,46 +54,40 @@ Screen::trusted_device_thumbprints () const
KDMWithMetadataPtr
kdm_for_screen (
std::function<dcp::DecryptedKDM (dcp::LocalTime, dcp::LocalTime)> make_kdm,
- shared_ptr<const dcpomatic::Screen> screen,
- boost::posix_time::ptime valid_from,
- boost::posix_time::ptime valid_to,
+ CinemaID cinema_id,
+ Cinema const& cinema,
+ Screen const& screen,
+ dcp::LocalTime valid_from,
+ dcp::LocalTime valid_to,
dcp::Formulation formulation,
bool disable_forensic_marking_picture,
optional<int> disable_forensic_marking_audio,
vector<KDMCertificatePeriod>& period_checks
)
{
- if (!screen->recipient) {
+ if (!screen.recipient) {
return {};
}
- auto cinema = screen->cinema;
- dcp::LocalTime const begin(valid_from, dcp::UTCOffset(cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0));
- dcp::LocalTime const end (valid_to, dcp::UTCOffset(cinema ? cinema->utc_offset_hour() : 0, cinema ? cinema->utc_offset_minute() : 0));
-
- period_checks.push_back(check_kdm_and_certificate_validity_periods(cinema ? cinema->name : "", screen->name, screen->recipient.get(), begin, end));
+ period_checks.push_back(check_kdm_and_certificate_validity_periods(cinema.name, screen.name, screen.recipient.get(), valid_from, valid_to));
auto signer = Config::instance()->signer_chain();
if (!signer->valid()) {
throw InvalidSignerError();
}
- auto kdm = make_kdm(begin, end).encrypt(
- signer, screen->recipient.get(), screen->trusted_device_thumbprints(), formulation, disable_forensic_marking_picture, disable_forensic_marking_audio
+ auto kdm = make_kdm(valid_from, valid_to).encrypt(
+ signer, screen.recipient.get(), screen.trusted_device_thumbprints(), formulation, disable_forensic_marking_picture, disable_forensic_marking_audio
);
dcp::NameFormat::Map name_values;
- if (cinema) {
- name_values['c'] = cinema->name;
- } else {
- name_values['c'] = "";
- }
- name_values['s'] = screen->name;
+ name_values['c'] = cinema.name;
+ name_values['s'] = screen.name;
name_values['f'] = kdm.content_title_text();
- name_values['b'] = begin.date() + " " + begin.time_of_day(true, false);
- name_values['e'] = end.date() + " " + end.time_of_day(true, false);
+ name_values['b'] = valid_from.date() + " " + valid_from.time_of_day(true, false);
+ name_values['e'] = valid_to.date() + " " + valid_to.time_of_day(true, false);
name_values['i'] = kdm.cpl_id();
- return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : vector<string>(), kdm);
+ return make_shared<KDMWithMetadata>(name_values, cinema_id, cinema.emails, kdm);
}