2014-06-26 Carl Hetherington <cth@carlh.net>
+ * Support different KDM formulations.
+
* Allow override of detected video frame rates.
* Optimisation of uncertain effect to encoder and server
def dependencies(target):
return (('ffmpeg-cdist', '67dc770'),
- ('libdcp', '2224998'))
+ ('libdcp', '7103135'))
def build(target, options):
cmd = './waf configure --prefix=%s' % target.work_dir_cscript()
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 ();
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>
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;
/*
- 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
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 {
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;
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 ()) {
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) {
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;
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) {
boost::filesystem::path cpl,
boost::posix_time::ptime from,
boost::posix_time::ptime to,
+ libdcp::KDM::Formulation formulation,
boost::filesystem::path directory
);
boost::filesystem::path cpl,
boost::posix_time::ptime from,
boost::posix_time::ptime to,
+ libdcp::KDM::Formulation formulation,
boost::filesystem::path directory
);
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
);
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)
{
}
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);
*/
#include <boost/filesystem.hpp>
+#include <libdcp/kdm.h>
#include "job.h"
class Screen;
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;
boost::filesystem::path _dcp;
boost::posix_time::ptime _from;
boost::posix_time::ptime _to;
+ libdcp::KDM::Formulation _formulation;
};
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) {
" -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"
bool cinemas = false;
string duration_string;
bool verbose = false;
+ libdcp::KDM::Formulation formulation = libdcp::KDM::MODIFIED_TRANSITIONAL_1;
program_name = argv[0];
{ "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;
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);
+ }
}
}
}
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";
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";
}
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);
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 ()
{
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>);
wxStaticText* _dcp_directory;
wxStaticText* _cpl_id;
wxStaticText* _cpl_annotation_text;
+ wxChoice* _type;
wxRadioButton* _write_to;
#ifdef DCPOMATIC_USE_OWN_DIR_PICKER
DirPickerCtrl* _folder;