Move Film::make_kdms to the call sites.
authorCarl Hetherington <cth@carlh.net>
Fri, 1 May 2020 20:53:01 +0000 (22:53 +0200)
committerCarl Hetherington <cth@carlh.net>
Mon, 4 May 2020 15:17:12 +0000 (17:17 +0200)
src/lib/film.cc
src/lib/film.h
src/tools/dcpomatic_kdm_cli.cc
src/wx/kdm_dialog.cc

index a24e9aa30046b316408a810e9b5a2d31d3c3164c..cbbdf596478b796754ac4700cec20812a7935808 100644 (file)
@@ -1502,47 +1502,6 @@ Film::make_kdm (
                ).encrypt (signer, recipient, trusted_devices, formulation, disable_forensic_marking_picture, disable_forensic_marking_audio);
 }
 
-/** @param screens Screens to make KDMs for.
- *  @param cpl_file Path to CPL to make KDMs for.
- *  @param from KDM from time expressed as a local time in the time zone of the Screen's Cinema.
- *  @param until KDM to time expressed as a local time in the time zone of the Screen's Cinema.
- *  @param formulation KDM formulation to use.
- *  @param disable_forensic_marking_picture true to disable forensic marking of picture.
- *  @param disable_forensic_marking_audio if not set, don't disable forensic marking of audio.  If set to 0,
- *  disable all forensic marking; if set above 0, disable forensic marking above that channel.
- */
-list<shared_ptr<ScreenKDM> >
-Film::make_kdms (
-       list<shared_ptr<Screen> > screens,
-       boost::filesystem::path cpl_file,
-       boost::posix_time::ptime from,
-       boost::posix_time::ptime until,
-       dcp::Formulation formulation,
-       bool disable_forensic_marking_picture,
-       optional<int> disable_forensic_marking_audio
-       ) const
-{
-       list<shared_ptr<ScreenKDM> > kdms;
-
-       BOOST_FOREACH (shared_ptr<Screen> i, screens) {
-               if (i->recipient) {
-                       dcp::EncryptedKDM const kdm = make_kdm (
-                               i->recipient.get(),
-                               i->trusted_device_thumbprints(),
-                               cpl_file,
-                               dcp::LocalTime (from,  i->cinema ? i->cinema->utc_offset_hour() : 0, i->cinema ? i->cinema->utc_offset_minute() : 0),
-                               dcp::LocalTime (until, i->cinema ? i->cinema->utc_offset_hour() : 0, i->cinema ? i->cinema->utc_offset_minute() : 0),
-                               formulation,
-                               disable_forensic_marking_picture,
-                               disable_forensic_marking_audio
-                               );
-
-                       kdms.push_back (shared_ptr<ScreenKDM>(new DCPScreenKDM(i, kdm)));
-               }
-       }
-
-       return kdms;
-}
 
 /** @return The approximate disk space required to encode a DCP of this film with the
  *  current settings, in bytes.
index 6cce07c17f3fa23bcb047f660582e02b553e7efa..40d366f8f68c8a331ee7840c9bf37ee944515f89 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -60,7 +60,6 @@ class AudioProcessor;
 class AudioMapping;
 class Ratio;
 class Job;
-class ScreenKDM;
 class Film;
 struct isdcf_name_test;
 
@@ -169,16 +168,6 @@ public:
                boost::optional<int> disable_forensic_marking_audio
                ) const;
 
-       std::list<boost::shared_ptr<ScreenKDM> > make_kdms (
-               std::list<boost::shared_ptr<dcpomatic::Screen> > screens,
-               boost::filesystem::path cpl_file,
-               boost::posix_time::ptime from,
-               boost::posix_time::ptime until,
-               dcp::Formulation formulation,
-               bool disable_forensic_marking_picture,
-               boost::optional<int> disable_forensic_marking_audio
-               ) const;
-
        int state_version () const {
                return _state_version;
        }
index 166b22285a741f8cd5cdc491982042c78d3f8f8a..505a70c2bcc7d3574206bf16d1834c12bbd8a5c1 100644 (file)
@@ -229,11 +229,26 @@ from_film (
        values['e'] = dcp::LocalTime(valid_to).date() + " " + dcp::LocalTime(valid_to).time_of_day(true, false);
 
        try {
-               list<shared_ptr<ScreenKDM> > screen_kdms = film->make_kdms (
-                       screens, cpl, valid_from, valid_to, formulation, disable_forensic_marking_picture, disable_forensic_marking_audio
-                       );
+               list<shared_ptr<ScreenKDM> > kdms;
 
-               write_files (screen_kdms, zip, output, container_name_format, filename_format, values, verbose);
+               BOOST_FOREACH (shared_ptr<Screen> i, screens) {
+                       if (i->recipient) {
+                               dcp::EncryptedKDM const kdm = film->make_kdm (
+                                               i->recipient.get(),
+                                               i->trusted_device_thumbprints(),
+                                               cpl,
+                                               dcp::LocalTime(valid_from, i->cinema ? i->cinema->utc_offset_hour() : 0, i->cinema ? i->cinema->utc_offset_minute() : 0),
+                                               dcp::LocalTime(valid_to,   i->cinema ? i->cinema->utc_offset_hour() : 0, i->cinema ? i->cinema->utc_offset_minute() : 0),
+                                               formulation,
+                                               disable_forensic_marking_picture,
+                                               disable_forensic_marking_audio
+                                               );
+
+                               kdms.push_back (shared_ptr<ScreenKDM>(new DCPScreenKDM(i, kdm)));
+                       }
+               }
+
+               write_files (kdms, zip, output, container_name_format, filename_format, values, verbose);
        } catch (FileError& e) {
                cerr << program_name << ": " << e.what() << " (" << e.file().string() << ")\n";
                exit (EXIT_FAILURE);
index 8682fe82f92a460aef24350e665875f981c8f2d4..59d961e6c9d1e226cf7790c0af252c72cb43bb48 100644 (file)
@@ -161,10 +161,23 @@ KDMDialog::make_clicked ()
                        /* Forensic mark up to this channel; disabled on channels greater than this */
                        for_audio = _output->forensic_mark_audio_up_to();
                }
-               screen_kdms = film->make_kdms (
-                       _screens->screens(), _cpl->cpl(), _timing->from(), _timing->until(), _output->formulation(),
-                       !_output->forensic_mark_video(), for_audio
-                       );
+
+               BOOST_FOREACH (shared_ptr<dcpomatic::Screen> i, _screens->screens()) {
+                       if (i->recipient) {
+                               dcp::EncryptedKDM const kdm = film->make_kdm (
+                                               i->recipient.get(),
+                                               i->trusted_device_thumbprints(),
+                                               _cpl->cpl(),
+                                               dcp::LocalTime(_timing->from(),  i->cinema ? i->cinema->utc_offset_hour() : 0, i->cinema ? i->cinema->utc_offset_minute() : 0),
+                                               dcp::LocalTime(_timing->until(), i->cinema ? i->cinema->utc_offset_hour() : 0, i->cinema ? i->cinema->utc_offset_minute() : 0),
+                                               _output->formulation(),
+                                               !_output->forensic_mark_video(),
+                                               for_audio
+                                               );
+
+                               screen_kdms.push_back (shared_ptr<ScreenKDM>(new DCPScreenKDM(i, kdm)));
+                       }
+               }
 
        } catch (dcp::BadKDMDateError& e) {
                if (e.starts_too_early()) {