X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Ftools%2Fdcpomatic_kdm.cc;h=cc070b45467f8bc9c34f8d7494d92a280364cb7e;hb=1a7c50245309bb0b99001940b2203a267de942ca;hp=ef6b783f4fa0045bb753b2fdfc8f4aefe1509d80;hpb=e6f2a4b0085b35be378f2cdd687146857d61df80;p=dcpomatic.git diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index ef6b783f4..cc070b454 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -38,9 +38,8 @@ #include "lib/util.h" #include "lib/screen.h" #include "lib/job_manager.h" -#include "lib/screen_kdm.h" +#include "lib/kdm_with_metadata.h" #include "lib/exceptions.h" -#include "lib/cinema_kdms.h" #include "lib/send_kdm_email_job.h" #include "lib/compose.hpp" #include "lib/cinema.h" @@ -52,10 +51,13 @@ #include #include #include +#include "lib/warnings.h" +DCPOMATIC_DISABLE_WARNINGS #include #include #include #include +DCPOMATIC_ENABLE_WARNINGS #ifdef __WXOSX__ #include #endif @@ -77,6 +79,9 @@ using boost::bind; using boost::optional; using boost::ref; using boost::dynamic_pointer_cast; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif using namespace dcpomatic; enum { @@ -303,7 +308,7 @@ private: return; } - list > screen_kdms; + list kdms; string title; #ifdef DCPOMATIC_VARIANT_SWAROOP @@ -318,18 +323,29 @@ private: continue; } + dcp::LocalTime begin(_timing->from(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); + dcp::LocalTime end(_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); + DecryptedECinemaKDM kdm ( decrypted.id(), decrypted.name(), decrypted.key(), - 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()) + begin, + end ); + 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'] = kdm.id(); + /* Encrypt */ - screen_kdms.push_back ( - shared_ptr( - new ECinemaScreenKDM(i, kdm.encrypt(i->recipient.get())) + kdms.push_back ( + KDMWithMetadataPtr( + new ECinemaKDMWithMetadata(name_values, i->cinema, kdm.encrypt(i->recipient.get())) ) ); } @@ -355,10 +371,13 @@ private: continue; } + dcp::LocalTime begin(_timing->from(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); + dcp::LocalTime end(_timing->until(), i->cinema->utc_offset_hour(), i->cinema->utc_offset_minute()); + /* 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()), + begin, + end, decrypted.annotation_text().get_value_or (""), decrypted.content_title_text(), dcp::LocalTime().as_string() @@ -369,27 +388,34 @@ private: kdm.add_key (j); } + dcp::EncryptedKDM const encrypted = kdm.encrypt( + signer, i->recipient.get(), i->trusted_device_thumbprints(), _output->formulation(), + !_output->forensic_mark_video(), _output->forensic_mark_audio() ? boost::optional() : 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 */ - screen_kdms.push_back ( - shared_ptr( - 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() : 0 - ) - ) + kdms.push_back ( + KDMWithMetadataPtr( + new DCPKDMWithMetadata(name_values, i->cinema.get(), i->cinema->emails, encrypted) ) ); } } - if (screen_kdms.empty()) { + if (kdms.empty()) { return; } pair, int> result = _output->make ( - screen_kdms, title, _timing, bind (&DOMFrame::confirm_overwrite, this, _1) + kdms, title, bind (&DOMFrame::confirm_overwrite, this, _1) ); if (result.first) { @@ -698,10 +724,8 @@ private: unsetenv ("UBUNTU_MENUPROXY"); #endif -#ifdef __WXOSX__ - ProcessSerialNumber serial; - GetCurrentProcess (&serial); - TransformProcessType (&serial, kProcessTransformToForegroundApplication); +#ifdef DCPOMATIC_OSX + make_foreground_application (); #endif dcpomatic_setup_path_encoding ();