summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-03-20 16:16:03 +0000
committerCarl Hetherington <cth@carlh.net>2014-03-20 16:16:03 +0000
commitcfd4beb36642439db23603f9b8099294761e4624 (patch)
tree3e79ba3ea6089033a97917d1e977f94da551422d /src
parent1f8b45c7fd49714628009f5ed2161fbaa2b4d729 (diff)
Fix build.
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc25
-rw-r--r--src/lib/film.h15
-rw-r--r--src/lib/kdm.cc30
-rw-r--r--src/lib/kdm.h12
-rw-r--r--src/lib/subrip.cc1
-rw-r--r--src/tools/dcpomatic_kdm.cc12
-rw-r--r--src/wx/film_viewer.cc6
-rw-r--r--src/wx/screen_dialog.cc2
-rw-r--r--src/wx/wx_util.cc4
9 files changed, 53 insertions, 54 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index cc80f5bc2..79833b366 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -28,14 +28,13 @@
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
-#include <boost/date_time.hpp>
#include <libxml++/libxml++.h>
#include <libcxml/cxml.h>
#include <dcp/signer_chain.h>
#include <dcp/cpl.h>
#include <dcp/signer.h>
#include <dcp/util.h>
-#include <dcp/kdm.h>
+#include <dcp/local_time.h>
#include "film.h"
#include "job.h"
#include "util.h"
@@ -949,12 +948,12 @@ Film::frame_size () const
return fit_ratio_within (container()->ratio(), full_frame ());
}
-dcp::KDM
+dcp::EncryptedKDM
Film::make_kdm (
shared_ptr<dcp::Certificate> target,
boost::filesystem::path dcp_dir,
- boost::posix_time::ptime from,
- boost::posix_time::ptime until
+ dcp::LocalTime from,
+ dcp::LocalTime until
) const
{
shared_ptr<const Signer> signer = make_signer ();
@@ -967,24 +966,22 @@ Film::make_kdm (
throw KDMError (_("Could not read DCP to make KDM for"));
}
- time_t now = time (0);
- struct tm* tm = localtime (&now);
- string const issue_date = dcp::tm_to_string (tm);
-
dcp.cpls().front()->set_mxf_keys (key ());
- return dcp::KDM (dcp.cpls().front(), signer, target, from, until, "DCP-o-matic", issue_date);
+ return dcp::DecryptedKDM (
+ dcp.cpls().front(), from, until, "DCP-o-matic", dcp.cpls().front()->content_title_text(), dcp::LocalTime().as_string()
+ ).encrypt (signer, target);
}
-list<dcp::KDM>
+list<dcp::EncryptedKDM>
Film::make_kdms (
list<shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime until
+ dcp::LocalTime from,
+ dcp::LocalTime until
) const
{
- list<dcp::KDM> kdms;
+ list<dcp::EncryptedKDM> kdms;
for (list<shared_ptr<Screen> >::iterator i = screens.begin(); i != screens.end(); ++i) {
kdms.push_back (make_kdm ((*i)->certificate, dcp, from, until));
diff --git a/src/lib/film.h b/src/lib/film.h
index 9d1445d92..ee8756b3d 100644
--- a/src/lib/film.h
+++ b/src/lib/film.h
@@ -32,7 +32,8 @@
#include <boost/enable_shared_from_this.hpp>
#include <boost/filesystem.hpp>
#include <dcp/key.h>
-#include <dcp/kdm.h>
+#include <dcp/decrypted_kdm.h>
+#include <dcp/encrypted_kdm.h>
#include "util.h"
#include "types.h"
#include "dci_metadata.h"
@@ -116,19 +117,19 @@ public:
int best_video_frame_rate () const;
FrameRateChange active_frame_rate_change (DCPTime) const;
- dcp::KDM
+ dcp::EncryptedKDM
make_kdm (
boost::shared_ptr<dcp::Certificate> target,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime until
+ dcp::LocalTime from,
+ dcp::LocalTime until
) const;
- std::list<dcp::KDM> make_kdms (
+ std::list<dcp::EncryptedKDM> make_kdms (
std::list<boost::shared_ptr<Screen> >,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime until
+ dcp::LocalTime from,
+ dcp::LocalTime until
) const;
dcp::Key key () const {
diff --git a/src/lib/kdm.cc b/src/lib/kdm.cc
index 00d2f0537..793a3fa0e 100644
--- a/src/lib/kdm.cc
+++ b/src/lib/kdm.cc
@@ -21,7 +21,7 @@
#include <boost/shared_ptr.hpp>
#include <quickmail.h>
#include <zip.h>
-#include <dcp/kdm.h>
+#include <dcp/encrypted_kdm.h>
#include "kdm.h"
#include "cinema.h"
#include "exceptions.h"
@@ -36,13 +36,13 @@ using boost::shared_ptr;
struct ScreenKDM
{
- ScreenKDM (shared_ptr<Screen> s, dcp::KDM k)
+ ScreenKDM (shared_ptr<Screen> s, dcp::EncryptedKDM k)
: screen (s)
, kdm (k)
{}
shared_ptr<Screen> screen;
- dcp::KDM kdm;
+ dcp::EncryptedKDM kdm;
};
static string
@@ -103,16 +103,16 @@ make_screen_kdms (
shared_ptr<const Film> film,
list<shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to
+ dcp::LocalTime from,
+ dcp::LocalTime to
)
{
- list<dcp::KDM> kdms = film->make_kdms (screens, dcp, from, to);
+ list<dcp::EncryptedKDM> kdms = film->make_kdms (screens, dcp, from, to);
list<ScreenKDM> screen_kdms;
list<shared_ptr<Screen> >::iterator i = screens.begin ();
- list<dcp::KDM>::iterator j = kdms.begin ();
+ list<dcp::EncryptedKDM>::iterator j = kdms.begin ();
while (i != screens.end() && j != kdms.end ()) {
screen_kdms.push_back (ScreenKDM (*i, *j));
++i;
@@ -127,8 +127,8 @@ make_cinema_kdms (
shared_ptr<const Film> film,
list<shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to
+ dcp::LocalTime from,
+ dcp::LocalTime to
)
{
list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, dcp, from, to);
@@ -169,8 +169,8 @@ write_kdm_files (
shared_ptr<const Film> film,
list<shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to,
+ dcp::LocalTime from,
+ dcp::LocalTime to,
boost::filesystem::path directory
)
{
@@ -189,8 +189,8 @@ write_kdm_zip_files (
shared_ptr<const Film> film,
list<shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to,
+ dcp::LocalTime from,
+ dcp::LocalTime to,
boost::filesystem::path directory
)
{
@@ -208,8 +208,8 @@ email_kdms (
shared_ptr<const Film> film,
list<shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to
+ dcp::LocalTime from,
+ dcp::LocalTime to
)
{
list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, dcp, from, to);
diff --git a/src/lib/kdm.h b/src/lib/kdm.h
index c4fd43d49..5df161b2a 100644
--- a/src/lib/kdm.h
+++ b/src/lib/kdm.h
@@ -27,8 +27,8 @@ extern void write_kdm_files (
boost::shared_ptr<const Film> film,
std::list<boost::shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to,
+ dcp::LocalTime from,
+ dcp::LocalTime to,
boost::filesystem::path directory
);
@@ -36,8 +36,8 @@ extern void write_kdm_zip_files (
boost::shared_ptr<const Film> film,
std::list<boost::shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to,
+ dcp::LocalTime from,
+ dcp::LocalTime to,
boost::filesystem::path directory
);
@@ -45,7 +45,7 @@ extern void email_kdms (
boost::shared_ptr<const Film> film,
std::list<boost::shared_ptr<Screen> > screens,
boost::filesystem::path dcp,
- boost::posix_time::ptime from,
- boost::posix_time::ptime to
+ dcp::LocalTime from,
+ dcp::LocalTime to
);
diff --git a/src/lib/subrip.cc b/src/lib/subrip.cc
index 3eac98e63..aa4a0b548 100644
--- a/src/lib/subrip.cc
+++ b/src/lib/subrip.cc
@@ -18,6 +18,7 @@
*/
#include <boost/algorithm/string.hpp>
+#include <boost/lexical_cast.hpp>
#include "subrip.h"
#include "subrip_content.h"
#include "subrip_subtitle.h"
diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc
index 820dc6ae6..2f6916df2 100644
--- a/src/tools/dcpomatic_kdm.cc
+++ b/src/tools/dcpomatic_kdm.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-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
@@ -40,8 +40,8 @@ help ()
cerr << "Syntax: " << program_name << " [OPTION] [<FILM>]\n"
" -h, --help show this help\n"
" -o, --output output file or directory\n"
- " -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"
+ " -f, --valid-from valid from time (in local time zone) (e.g. \"2013-09-28 01:41:51\") or \"now\"\n"
+ " -t, --valid-to valid to time (in local time zone) (e.g. \"2014-09-28 01:41:51\")\n"
" -d, --valid-duration valid duration (e.g. \"1 day\", \"4 hours\", \"2 weeks\")\n"
" -z, --zip ZIP each cinema's KDMs into its own file\n"
" -v, --verbose be verbose\n"
@@ -235,7 +235,7 @@ int main (int argc, char* argv[])
}
shared_ptr<dcp::Certificate> certificate (new dcp::Certificate (boost::filesystem::path (certificate_file)));
- dcp::KDM kdm = film->make_kdm (certificate, dcp, valid_from.get(), valid_to.get());
+ dcp::EncryptedKDM kdm = film->make_kdm (certificate, dcp, valid_from.get(), valid_to.get());
kdm.as_xml (output);
if (verbose) {
cout << "Generated KDM " << output << " for certificate.\n";
@@ -259,12 +259,12 @@ int main (int argc, char* argv[])
try {
if (zip) {
- write_kdm_zip_files (film, (*i)->screens(), dcp, valid_from.get(), valid_to.get(), output);
+ write_kdm_zip_files (film, (*i)->screens(), dcp, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), output);
if (verbose) {
cout << "Wrote ZIP files to " << output << "\n";
}
} else {
- write_kdm_files (film, (*i)->screens(), dcp, valid_from.get(), valid_to.get(), output);
+ write_kdm_files (film, (*i)->screens(), dcp, dcp::LocalTime (valid_from.get()), dcp::LocalTime (valid_to.get()), output);
if (verbose) {
cout << "Wrote KDM files to " << output << "\n";
}
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index b0bc65750..a1cddf785 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -222,12 +222,12 @@ FilmViewer::slider_moved ()
{
if (_film && _player) {
try {
- Time t = _slider->GetValue() * _film->length() / 4096;
+ DCPTime t (_slider->GetValue() * _film->length().get() / 4096);
/* Ensure that we hit the end of the film at the end of the slider */
if (t >= _film->length ()) {
- t = _film->length() - _film->video_frames_to_time (1);
+ t = _film->length() - DCPTime::from_frames (1, _film->video_frame_rate ());
}
- _player->seek (DCPTime (_film->length().get() * _slider->GetValue() / 4096), false);
+ _player->seek (t, false);
fetch_next_frame ();
} catch (OpenFileError& e) {
/* There was a problem opening a content file; we'll let this slide as it
diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc
index f94400be7..89249645a 100644
--- a/src/wx/screen_dialog.cc
+++ b/src/wx/screen_dialog.cc
@@ -105,5 +105,5 @@ void
ScreenDialog::setup_sensitivity ()
{
wxButton* ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
- ok->Enable (_certificate);
+ ok->Enable (_certificate.get ());
}
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 367d1edbb..a5399e62e 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -123,7 +123,7 @@ int const ThreadedStaticText::_update_event_id = 10000;
* @param initial Initial text for the wxStaticText while the computation is being run.
* @param fn Function which works out what the wxStaticText content should be and returns it.
*/
-ThreadedStaticText::ThreadedStaticText (wxWindow* parent, wxString initial, function<string ()> fn)
+ThreadedStaticText::ThreadedStaticText (wxWindow* parent, wxString initial, boost::function<string ()> fn)
: wxStaticText (parent, wxID_ANY, initial)
{
Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ThreadedStaticText::thread_finished, this, _1), _update_event_id);
@@ -139,7 +139,7 @@ ThreadedStaticText::~ThreadedStaticText ()
/** Run our thread and post the result to the GUI thread via AddPendingEvent */
void
-ThreadedStaticText::run (function<string ()> fn)
+ThreadedStaticText::run (boost::function<string ()> fn)
try
{
wxCommandEvent ev (wxEVT_COMMAND_TEXT_UPDATED, _update_event_id);