Fix build.
authorCarl Hetherington <cth@carlh.net>
Thu, 20 Mar 2014 16:16:03 +0000 (16:16 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 20 Mar 2014 16:16:03 +0000 (16:16 +0000)
src/lib/film.cc
src/lib/film.h
src/lib/kdm.cc
src/lib/kdm.h
src/lib/subrip.cc
src/tools/dcpomatic_kdm.cc
src/wx/film_viewer.cc
src/wx/screen_dialog.cc
src/wx/wx_util.cc

index cc80f5bc2d8be73bf40f60b99a136a963f0f582e..79833b3669ab7a6c41e8e6d7b9c0c821f11af186 100644 (file)
 #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));
index 9d1445d927b81ab7333f3197d2891ef1306de809..ee8756b3dfdcf860d837c0dd90a11188427bd350 100644 (file)
@@ -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 {
index 00d2f053781246e9631d7785ba3739e56de46a9c..793a3fa0eb5c0cea99d0edc60424742490ea3fae 100644 (file)
@@ -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);
index c4fd43d49bfc315e623c1bf005070e61e2031778..5df161b2a03404beafc39d88fa2d7dddb0b83e8e 100644 (file)
@@ -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
        );
 
index 3eac98e638d22c17a1940a2355abee33a3fe1649..aa4a0b548b88bae467fb68aad33db4ff07b7740f 100644 (file)
@@ -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"
index 820dc6ae64e5ef58f6ee273419258f00635cce80..2f6916df2be684ae5569e30a73af3922eaba3c72 100644 (file)
@@ -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";
                                }
index b0bc65750f71ea8e202d973a07792a858c814c13..a1cddf785c411c16a572868947acc432283c2c3e 100644 (file)
@@ -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
index f94400be7fed94ff873601d5f7740a714fe41089..89249645a5153009c2b0e26530561a4ce7e837d8 100644 (file)
@@ -105,5 +105,5 @@ void
 ScreenDialog::setup_sensitivity ()
 {
        wxButton* ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
-       ok->Enable (_certificate);
+       ok->Enable (_certificate.get ());
 }
index 367d1edbbf522d12634dbc2c967bea73732f83cd..a5399e62ea4d798c2957c36eb20a6586e84c3e0f 100644 (file)
@@ -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);