diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-06-26 19:15:56 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-06-26 19:15:56 +0100 |
| commit | 075f418cc6d9be06bed7a1d98257ae8d17ef3019 (patch) | |
| tree | a5a6924da614ea0c65657802fffd291e67487532 /src | |
| parent | d1125d09c7741d05b57b1520531a0451663ad66c (diff) | |
Support different KDM formulations.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/film.cc | 10 | ||||
| -rw-r--r-- | src/lib/film.h | 8 | ||||
| -rw-r--r-- | src/lib/kdm.cc | 21 | ||||
| -rw-r--r-- | src/lib/kdm.h | 5 | ||||
| -rw-r--r-- | src/lib/send_kdm_email_job.cc | 6 | ||||
| -rw-r--r-- | src/lib/send_kdm_email_job.h | 5 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 4 | ||||
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 21 | ||||
| -rw-r--r-- | src/wx/kdm_dialog.cc | 23 | ||||
| -rw-r--r-- | src/wx/kdm_dialog.h | 2 |
10 files changed, 80 insertions, 25 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index 940eba1eb..0a77caf50 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1086,7 +1086,8 @@ Film::make_kdm ( shared_ptr<libdcp::Certificate> target, boost::filesystem::path cpl_file, boost::posix_time::ptime from, - boost::posix_time::ptime until + boost::posix_time::ptime until, + libdcp::KDM::Formulation formulation ) const { shared_ptr<const Signer> signer = make_signer (); @@ -1095,7 +1096,7 @@ Film::make_kdm ( struct tm* tm = localtime (&now); string const issue_date = libdcp::tm_to_string (tm); - return libdcp::KDM (cpl_file, signer, target, key (), from, until, "DCP-o-matic", issue_date); + return libdcp::KDM (cpl_file, signer, target, key (), from, until, "DCP-o-matic", issue_date, formulation); } list<libdcp::KDM> @@ -1103,13 +1104,14 @@ Film::make_kdms ( list<shared_ptr<Screen> > screens, boost::filesystem::path dcp, boost::posix_time::ptime from, - boost::posix_time::ptime until + boost::posix_time::ptime until, + libdcp::KDM::Formulation formulation ) const { list<libdcp::KDM> kdms; for (list<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) { - kdms.push_back (make_kdm ((*i)->certificate, dcp, from, until)); + kdms.push_back (make_kdm ((*i)->certificate, dcp, from, until, formulation)); } return kdms; diff --git a/src/lib/film.h b/src/lib/film.h index cbe6d7b6b..b7d105688 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -128,14 +128,16 @@ public: boost::shared_ptr<libdcp::Certificate> target, boost::filesystem::path cpl_file, boost::posix_time::ptime from, - boost::posix_time::ptime until + boost::posix_time::ptime until, + libdcp::KDM::Formulation formulation ) const; std::list<libdcp::KDM> make_kdms ( std::list<boost::shared_ptr<Screen> >, boost::filesystem::path cpl_file, boost::posix_time::ptime from, - boost::posix_time::ptime until + boost::posix_time::ptime until, + libdcp::KDM::Formulation formulation ) const; libdcp::Key key () const { diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc index 5efea089c..49bfae20a 100644 --- a/src/lib/kdm.cc +++ b/src/lib/kdm.cc @@ -105,10 +105,11 @@ make_screen_kdms ( list<shared_ptr<Screen> > screens, boost::filesystem::path cpl, boost::posix_time::ptime from, - boost::posix_time::ptime to + boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation ) { - list<libdcp::KDM> kdms = film->make_kdms (screens, cpl, from, to); + list<libdcp::KDM> kdms = film->make_kdms (screens, cpl, from, to, formulation); list<ScreenKDM> screen_kdms; @@ -129,10 +130,11 @@ make_cinema_kdms ( list<shared_ptr<Screen> > screens, boost::filesystem::path cpl, boost::posix_time::ptime from, - boost::posix_time::ptime to + boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation ) { - list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to); + list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to, formulation); list<CinemaKDMs> cinema_kdms; while (!screen_kdms.empty ()) { @@ -175,10 +177,11 @@ write_kdm_files ( boost::filesystem::path cpl, boost::posix_time::ptime from, boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation, boost::filesystem::path directory ) { - list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to); + list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to, formulation); /* Write KDMs to the specified directory */ for (list<ScreenKDM>::iterator i = screen_kdms.begin(); i != screen_kdms.end(); ++i) { @@ -195,10 +198,11 @@ write_kdm_zip_files ( boost::filesystem::path cpl, boost::posix_time::ptime from, boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation, boost::filesystem::path directory ) { - list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to); + list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to, formulation); for (list<CinemaKDMs>::const_iterator i = cinema_kdms.begin(); i != cinema_kdms.end(); ++i) { boost::filesystem::path path = directory; @@ -213,10 +217,11 @@ email_kdms ( list<shared_ptr<Screen> > screens, boost::filesystem::path cpl, boost::posix_time::ptime from, - boost::posix_time::ptime to + boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation ) { - list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to); + list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to, formulation); for (list<CinemaKDMs>::const_iterator i = cinema_kdms.begin(); i != cinema_kdms.end(); ++i) { diff --git a/src/lib/kdm.h b/src/lib/kdm.h index 8aacd7b72..8fb4ec494 100644 --- a/src/lib/kdm.h +++ b/src/lib/kdm.h @@ -29,6 +29,7 @@ extern void write_kdm_files ( boost::filesystem::path cpl, boost::posix_time::ptime from, boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation, boost::filesystem::path directory ); @@ -38,6 +39,7 @@ extern void write_kdm_zip_files ( boost::filesystem::path cpl, boost::posix_time::ptime from, boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation, boost::filesystem::path directory ); @@ -46,6 +48,7 @@ extern void email_kdms ( std::list<boost::shared_ptr<Screen> > screens, boost::filesystem::path cpl, boost::posix_time::ptime from, - boost::posix_time::ptime to + boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation ); diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc index 8af0b556a..1dec2ffb0 100644 --- a/src/lib/send_kdm_email_job.cc +++ b/src/lib/send_kdm_email_job.cc @@ -33,13 +33,15 @@ SendKDMEmailJob::SendKDMEmailJob ( list<shared_ptr<Screen> > screens, boost::filesystem::path dcp, boost::posix_time::ptime from, - boost::posix_time::ptime to + boost::posix_time::ptime to, + libdcp::KDM::Formulation formulation ) : Job (f) , _screens (screens) , _dcp (dcp) , _from (from) , _to (to) + , _formulation (formulation) { } @@ -62,7 +64,7 @@ SendKDMEmailJob::run () try { set_progress_unknown (); - email_kdms (_film, _screens, _dcp, _from, _to); + email_kdms (_film, _screens, _dcp, _from, _to, _formulation); set_progress (1); set_state (FINISHED_OK); diff --git a/src/lib/send_kdm_email_job.h b/src/lib/send_kdm_email_job.h index f4d154a91..8a8903040 100644 --- a/src/lib/send_kdm_email_job.h +++ b/src/lib/send_kdm_email_job.h @@ -18,6 +18,7 @@ */ #include <boost/filesystem.hpp> +#include <libdcp/kdm.h> #include "job.h" class Screen; @@ -30,7 +31,8 @@ public: std::list<boost::shared_ptr<Screen> >, boost::filesystem::path, boost::posix_time::ptime, - boost::posix_time::ptime + boost::posix_time::ptime, + libdcp::KDM::Formulation ); std::string name () const; @@ -42,4 +44,5 @@ private: boost::filesystem::path _dcp; boost::posix_time::ptime _from; boost::posix_time::ptime _to; + libdcp::KDM::Formulation _formulation; }; diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index c9d17eb9b..588fd5c48 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -470,10 +470,10 @@ private: try { if (d->write_to ()) { - write_kdm_files (film, d->screens (), d->cpl (), d->from (), d->until (), d->directory ()); + write_kdm_files (film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation (), d->directory ()); } else { JobManager::instance()->add ( - shared_ptr<Job> (new SendKDMEmailJob (film, d->screens (), d->cpl (), d->from (), d->until ())) + shared_ptr<Job> (new SendKDMEmailJob (film, d->screens (), d->cpl (), d->from (), d->until (), d->formulation ())) ); } } catch (libdcp::NotEncryptedError& e) { diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 041f6c7ef..8c26ba4cc 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -44,6 +44,7 @@ help () " -f, --valid-from valid from time (e.g. \"2013-09-28 01:41:51\") or \"now\"\n" " -t, --valid-to valid to time (e.g. \"2014-09-28 01:41:51\")\n" " -d, --valid-duration valid duration (e.g. \"1 day\", \"4 hours\", \"2 weeks\")\n" + " --formulation modified-transitional-1, dci-any or dci-specific [default modified-transitional-1]\n" " -z, --zip ZIP each cinema's KDMs into its own file\n" " -v, --verbose be verbose\n" " -c, --cinema specify a cinema, either by name or email address\n" @@ -110,6 +111,7 @@ int main (int argc, char* argv[]) bool cinemas = false; string duration_string; bool verbose = false; + libdcp::KDM::Formulation formulation = libdcp::KDM::MODIFIED_TRANSITIONAL_1; program_name = argv[0]; @@ -126,10 +128,11 @@ int main (int argc, char* argv[]) { "zip", no_argument, 0, 'z' }, { "duration", required_argument, 0, 'd' }, { "verbose", no_argument, 0, 'v' }, + { "formulation", required_argument, 0, 'C' }, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "ho:f:t:c:A:Bzd:v", long_options, &option_index); + int c = getopt_long (argc, argv, "ho:f:t:c:A:Bzd:vC:", long_options, &option_index); if (c == -1) { break; @@ -166,6 +169,16 @@ int main (int argc, char* argv[]) case 'v': verbose = true; break; + case 'C': + if (string (optarg) == "modified-transitional-1") { + formulation = libdcp::KDM::MODIFIED_TRANSITIONAL_1; + } else if (string (optarg) == "dci-any") { + formulation = libdcp::KDM::DCI_ANY; + } else if (string (optarg) == "dci-specific") { + formulation = libdcp::KDM::DCI_SPECIFIC; + } else { + error ("unrecognised KDM formulation " + formulation); + } } } @@ -236,7 +249,7 @@ int main (int argc, char* argv[]) } shared_ptr<libdcp::Certificate> certificate (new libdcp::Certificate (boost::filesystem::path (certificate_file))); - libdcp::KDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get()); + libdcp::KDM kdm = film->make_kdm (certificate, cpl, valid_from.get(), valid_to.get(), formulation); kdm.as_xml (output); if (verbose) { cout << "Generated KDM " << output << " for certificate.\n"; @@ -260,12 +273,12 @@ int main (int argc, char* argv[]) try { if (zip) { - write_kdm_zip_files (film, (*i)->screens(), cpl, valid_from.get(), valid_to.get(), output); + write_kdm_zip_files (film, (*i)->screens(), cpl, valid_from.get(), valid_to.get(), formulation, output); if (verbose) { cout << "Wrote ZIP files to " << output << "\n"; } } else { - write_kdm_files (film, (*i)->screens(), cpl, valid_from.get(), valid_to.get(), output); + write_kdm_files (film, (*i)->screens(), cpl, valid_from.get(), valid_to.get(), formulation, output); if (verbose) { cout << "Wrote KDM files to " << output << "\n"; } diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 6750e0e98..8df94de9c 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -159,6 +159,14 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film) table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0); + add_label_to_sizer (table, this, _("KDM type"), true); + _type = new wxChoice (this, wxID_ANY); + _type->Append ("Modified Transitional 1"); + _type->Append ("DCI Any"); + _type->Append ("DCI Specific"); + table->Add (_type, 1, wxEXPAND); + _type->SetSelection (0); + _write_to = new wxRadioButton (this, wxID_ANY, _("Write to")); table->Add (_write_to, 1, wxEXPAND); @@ -480,6 +488,21 @@ KDMDialog::write_to () const return _write_to->GetValue (); } +libdcp::KDM::Formulation +KDMDialog::formulation () const +{ + switch (_type->GetSelection()) { + case 0: + return libdcp::KDM::MODIFIED_TRANSITIONAL_1; + case 1: + return libdcp::KDM::DCI_ANY; + case 2: + return libdcp::KDM::DCI_SPECIFIC; + default: + assert (false); + } +} + void KDMDialog::update_cpl_choice () { diff --git a/src/wx/kdm_dialog.h b/src/wx/kdm_dialog.h index 6327b29e8..13e9196ea 100644 --- a/src/wx/kdm_dialog.h +++ b/src/wx/kdm_dialog.h @@ -48,6 +48,7 @@ public: boost::filesystem::path cpl () const; boost::filesystem::path directory () const; bool write_to () const; + libdcp::KDM::Formulation formulation () const; private: void add_cinema (boost::shared_ptr<Cinema>); @@ -83,6 +84,7 @@ private: wxStaticText* _dcp_directory; wxStaticText* _cpl_id; wxStaticText* _cpl_annotation_text; + wxChoice* _type; wxRadioButton* _write_to; #ifdef DCPOMATIC_USE_OWN_DIR_PICKER DirPickerCtrl* _folder; |
