Cope with loading a film containing a missing DCP which itself contains subtitles.
[dcpomatic.git] / src / lib / screen.cc
index 5ef007214b874c02cbe52f8f5b4433a071a6a552..febf9085c3d344af6a77487c5aed1c04a60a7148 100644 (file)
@@ -75,8 +75,7 @@ Screen::trusted_device_thumbprints () const
 
 KDMWithMetadataPtr
 kdm_for_screen (
-       shared_ptr<const Film> film,
-       boost::filesystem::path cpl,
+       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,
@@ -94,15 +93,16 @@ kdm_for_screen (
        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(screen->recipient.get(), begin, end));
+       period_checks.push_back(check_kdm_and_certificate_validity_periods(cinema ? cinema->name : "", screen->name, screen->recipient.get(), begin, end));
 
        auto signer = Config::instance()->signer_chain();
        if (!signer->valid()) {
                throw InvalidSignerError();
        }
 
-       auto const decrypted_kdm = film->make_kdm(cpl, begin, end);
-       auto kdm = decrypted_kdm.encrypt(signer, screen->recipient.get(), screen->trusted_device_thumbprints(), formulation, disable_forensic_marking_picture, disable_forensic_marking_audio);
+       auto kdm = make_kdm(begin, end).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) {
@@ -116,6 +116,6 @@ kdm_for_screen (
        name_values['e'] = end.date() + " " + end.time_of_day(true, false);
        name_values['i'] = kdm.cpl_id();
 
-       return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : list<string>(), kdm);
+       return make_shared<KDMWithMetadata>(name_values, cinema.get(), cinema ? cinema->emails : vector<string>(), kdm);
 }