Merge remote-tracking branch 'origin/master' into 2.0
authorCarl Hetherington <cth@carlh.net>
Wed, 16 Jul 2014 13:30:02 +0000 (14:30 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 16 Jul 2014 13:30:02 +0000 (14:30 +0100)
1  2 
ChangeLog
src/lib/config.cc
src/lib/config.h
src/lib/kdm.cc
src/wx/config_dialog.cc

diff --combined ChangeLog
index 68383d39dff7be7c3031e88633b3da2155a5b74e,a810461116d18e82581d27e26feeea63c2d98e3b..561bbce1c06f1ce981512e41413408902d952f8a
+++ b/ChangeLog
@@@ -1,19 -1,7 +1,21 @@@
 +2014-07-15  Carl Hetherington  <cth@carlh.net>
 +
 +      * A variety of changes were made on the 2.0 branch
 +      but not documented in the ChangeLog.  Most sigificantly:
 +
 +      - DCP import
 +      - Creation of DCPs with proper XML subtitles
 +      - Import of .srt and .xml subtitles
 +      - Audio processing framework (with some basic processors).
 +
 +2014-03-07  Carl Hetherington  <cth@carlh.net>
 +
 +      * Add subtitle view.
 +
  2014-07-16  Carl Hetherington  <cth@carlh.net>
  
+       * Make KDM email subject configurable.
        * Updates to de_DE from Carsten Kurz.
  
        * Limit allowed KDM types based on Interop/SMPTE setting
@@@ -29,7 -17,6 +31,7 @@@
  2014-07-10  Carl Hetherington  <cth@carlh.net>
  
        * Version 1.72.2 released.
 +>>>>>>> origin/master
  
  2014-07-10  Carl Hetherington  <cth@carlh.net>
  
diff --combined src/lib/config.cc
index d4976676d574b5f34b93eb0b3a2d84a09f5ba88c,24f9242ec259afdfb93ff3c04eef98b0b9738ca9..71431ec0db63e18b172b7693bfc95398f128091d
@@@ -23,8 -23,8 +23,8 @@@
  #include <glib.h>
  #include <boost/filesystem.hpp>
  #include <boost/algorithm/string.hpp>
 -#include <libdcp/colour_matrix.h>
 -#include <libdcp/raw_convert.h>
 +#include <dcp/colour_matrix.h>
 +#include <dcp/raw_convert.h>
  #include <libcxml/cxml.h>
  #include "config.h"
  #include "server.h"
@@@ -32,7 -32,7 +32,7 @@@
  #include "filter.h"
  #include "ratio.h"
  #include "dcp_content_type.h"
 -#include "sound_processor.h"
 +#include "cinema_sound_processor.h"
  #include "colour_conversion.h"
  #include "cinema.h"
  #include "util.h"
@@@ -50,7 -50,7 +50,7 @@@ using boost::shared_ptr
  using boost::optional;
  using boost::algorithm::is_any_of;
  using boost::algorithm::split;
 -using libdcp::raw_convert;
 +using dcp::raw_convert;
  
  Config* Config::_instance = 0;
  
@@@ -60,7 -60,7 +60,7 @@@ Config::Config (
        , _server_port_base (6192)
        , _use_any_servers (true)
        , _tms_path (".")
 -      , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750")))
 +      , _cinema_sound_processor (CinemaSoundProcessor::from_id (N_("dolby_cp750")))
        , _allow_any_dcp_frame_rate (false)
        , _default_still_length (10)
        , _default_container (Ratio::from_id ("185"))
@@@ -79,9 -79,9 +79,9 @@@
        _allowed_dcp_frame_rates.push_back (50);
        _allowed_dcp_frame_rates.push_back (60);
  
 -      _colour_conversions.push_back (PresetColourConversion (_("sRGB"), 2.4, true, libdcp::colour_matrix::srgb_to_xyz, 2.6));
 -      _colour_conversions.push_back (PresetColourConversion (_("sRGB non-linearised"), 2.4, false, libdcp::colour_matrix::srgb_to_xyz, 2.6));
 -      _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, libdcp::colour_matrix::rec709_to_xyz, 2.6));
 +      _colour_conversions.push_back (PresetColourConversion (_("sRGB"), 2.4, true, dcp::colour_matrix::srgb_to_xyz, 2.6));
 +      _colour_conversions.push_back (PresetColourConversion (_("sRGB non-linearised"), 2.4, false, dcp::colour_matrix::srgb_to_xyz, 2.6));
 +      _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, dcp::colour_matrix::rec709_to_xyz, 2.6));
  
        reset_kdm_email ();
  }
@@@ -90,6 -90,7 +90,6 @@@ voi
  Config::read ()
  {
        if (!boost::filesystem::exists (file (false))) {
 -              read_old_metadata ();
                return;
        }
  
  
        c = f.optional_string_child ("SoundProcessor");
        if (c) {
 -              _sound_processor = SoundProcessor::from_id (c.get ());
 +              _cinema_sound_processor = CinemaSoundProcessor::from_id (c.get ());
 +      }
 +      c = f.optional_string_child ("CinemaSoundProcessor");
 +      if (c) {
 +              _cinema_sound_processor = CinemaSoundProcessor::from_id (c.get ());
        }
  
        _language = f.optional_string_child ("Language");
                /* Loading version 0 (before Rec. 709 was added as a preset).
                   Add it in.
                */
 -              _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, libdcp::colour_matrix::rec709_to_xyz, 2.6));
 +              _colour_conversions.push_back (PresetColourConversion (_("Rec. 709"), 2.2, false, dcp::colour_matrix::rec709_to_xyz, 2.6));
        }
  
        list<cxml::NodePtr> cin = f.node_children ("Cinema");
        _mail_server = f.string_child ("MailServer");
        _mail_user = f.optional_string_child("MailUser").get_value_or ("");
        _mail_password = f.optional_string_child("MailPassword").get_value_or ("");
+       _kdm_subject = f.optional_string_child ("KDMSubject").get_value_or (_("KDM delivery: $CPL_NAME"));
        _kdm_from = f.string_child ("KDMFrom");
        _kdm_cc = f.optional_string_child ("KDMCC").get_value_or ("");
        _kdm_email = f.string_child ("KDMEmail");
        _log_types = f.optional_number_child<int> ("LogTypes").get_value_or (Log::TYPE_GENERAL | Log::TYPE_WARNING | Log::TYPE_ERROR);
  }
  
 -void
 -Config::read_old_metadata ()
 -{
 -      /* XXX: this won't work with non-Latin filenames */
 -      ifstream f (file(true).string().c_str ());
 -      string line;
 -
 -      while (getline (f, line)) {
 -              if (line.empty ()) {
 -                      continue;
 -              }
 -
 -              if (line[0] == '#') {
 -                      continue;
 -              }
 -
 -              size_t const s = line.find (' ');
 -              if (s == string::npos) {
 -                      continue;
 -              }
 -              
 -              string const k = line.substr (0, s);
 -              string const v = line.substr (s + 1);
 -
 -              if (k == N_("num_local_encoding_threads")) {
 -                      _num_local_encoding_threads = atoi (v.c_str ());
 -              } else if (k == N_("default_directory")) {
 -                      _default_directory = v;
 -              } else if (k == N_("server_port")) {
 -                      _server_port_base = atoi (v.c_str ());
 -              } else if (k == N_("server")) {
 -                      vector<string> b;
 -                      split (b, v, is_any_of (" "));
 -                      if (b.size() == 2) {
 -                              _servers.push_back (b[0]);
 -                      }
 -              } else if (k == N_("tms_ip")) {
 -                      _tms_ip = v;
 -              } else if (k == N_("tms_path")) {
 -                      _tms_path = v;
 -              } else if (k == N_("tms_user")) {
 -                      _tms_user = v;
 -              } else if (k == N_("tms_password")) {
 -                      _tms_password = v;
 -              } else if (k == N_("sound_processor")) {
 -                      _sound_processor = SoundProcessor::from_id (v);
 -              } else if (k == "language") {
 -                      _language = v;
 -              } else if (k == "default_container") {
 -                      _default_container = Ratio::from_id (v);
 -              } else if (k == "default_dcp_content_type") {
 -                      _default_dcp_content_type = DCPContentType::from_isdcf_name (v);
 -              } else if (k == "dcp_metadata_issuer") {
 -                      _dcp_metadata.issuer = v;
 -              } else if (k == "dcp_metadata_creator") {
 -                      _dcp_metadata.creator = v;
 -              } else if (k == "dcp_metadata_issue_date") {
 -                      _dcp_metadata.issue_date = v;
 -              }
 -
 -              _default_isdcf_metadata.read_old_metadata (k, v);
 -      }
 -}
 -
  /** @return Filename to write configuration to */
  boost::filesystem::path
  Config::file (bool old) const
@@@ -273,8 -335,8 +274,8 @@@ Config::write () cons
        root->add_child("TMSPath")->add_child_text (_tms_path);
        root->add_child("TMSUser")->add_child_text (_tms_user);
        root->add_child("TMSPassword")->add_child_text (_tms_password);
 -      if (_sound_processor) {
 -              root->add_child("SoundProcessor")->add_child_text (_sound_processor->id ());
 +      if (_cinema_sound_processor) {
 +              root->add_child("CinemaSoundProcessor")->add_child_text (_cinema_sound_processor->id ());
        }
        if (_language) {
                root->add_child("Language")->add_child_text (_language.get());
        root->add_child("MailServer")->add_child_text (_mail_server);
        root->add_child("MailUser")->add_child_text (_mail_user);
        root->add_child("MailPassword")->add_child_text (_mail_password);
+       root->add_child("KDMSubject")->add_child_text (_kdm_subject);
        root->add_child("KDMFrom")->add_child_text (_kdm_from);
        root->add_child("KDMCC")->add_child_text (_kdm_cc);
        root->add_child("KDMEmail")->add_child_text (_kdm_email);
diff --combined src/lib/config.h
index f26e2532a1006cbe9a2e5be5f64aadeec5b90712,85e419a0a0348b53e3a19e643539832b8f3d1ce4..66ff662142133b6e4258b49c745b93759430252f
  #include <boost/shared_ptr.hpp>
  #include <boost/signals2.hpp>
  #include <boost/filesystem.hpp>
 -#include <libdcp/metadata.h>
 +#include <dcp/metadata.h>
  #include "isdcf_metadata.h"
  #include "colour_conversion.h"
 -#include "server.h"
  
  class ServerDescription;
  class Scaler;
  class Filter;
 -class SoundProcessor;
 +class CinemaSoundProcessor;
  class DCPContentType;
  class Ratio;
  class Cinema;
@@@ -103,9 -104,9 +103,9 @@@ public
                return _tms_password;
        }
  
 -      /** @return The sound processor that we are using */
 -      SoundProcessor const * sound_processor () const {
 -              return _sound_processor;
 +      /** @return The cinema sound processor that we are using */
 +      CinemaSoundProcessor const * cinema_sound_processor () const {
 +              return _cinema_sound_processor;
        }
  
        std::list<boost::shared_ptr<Cinema> > cinemas () const {
                return _default_dcp_content_type;
        }
  
 -      libdcp::XMLMetadata dcp_metadata () const {
 +      dcp::XMLMetadata dcp_metadata () const {
                return _dcp_metadata;
        }
  
                return _mail_password;
        }
  
+       std::string kdm_subject () const {
+               return _kdm_subject;
+       }
        std::string kdm_from () const {
                return _kdm_from;
        }
                changed ();
        }
  
 -      void set_dcp_metadata (libdcp::XMLMetadata m) {
 +      void set_dcp_metadata (dcp::XMLMetadata m) {
                _dcp_metadata = m;
                changed ();
        }
                changed ();
        }
  
+       void set_kdm_subject (std::string s) {
+               _kdm_subject = s;
+               changed ();
+       }
        void set_kdm_from (std::string f) {
                _kdm_from = f;
                changed ();
@@@ -371,6 -381,7 +380,6 @@@ private
        Config ();
        boost::filesystem::path file (bool) const;
        void read ();
 -      void read_old_metadata ();
        void write () const;
  
        /** number of threads to use for J2K encoding on the local machine */
        std::string _tms_user;
        /** Password to log into the TMS with */
        std::string _tms_password;
 -      /** Our sound processor */
 -      SoundProcessor const * _sound_processor;
 +      /** Our cinema sound processor */
 +      CinemaSoundProcessor const * _cinema_sound_processor;
        std::list<int> _allowed_dcp_frame_rates;
        /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
        bool _allow_any_dcp_frame_rate;
        int _default_still_length;
        Ratio const * _default_container;
        DCPContentType const * _default_dcp_content_type;
 -      libdcp::XMLMetadata _dcp_metadata;
 +      dcp::XMLMetadata _dcp_metadata;
        int _default_j2k_bandwidth;
        int _default_audio_delay;
        std::vector<PresetColourConversion> _colour_conversions;
        std::string _mail_server;
        std::string _mail_user;
        std::string _mail_password;
+       std::string _kdm_subject;
        std::string _kdm_from;
        std::string _kdm_cc;
        std::string _kdm_email;
diff --combined src/lib/kdm.cc
index dd2b756c19e79184b25cec9b95bed3e4a6540adc,49f04724ac1c07ed2bddfb050a7139999c701c6b..0593881bc696498b1ec401ae7d6537a2df300d20
@@@ -21,8 -21,7 +21,8 @@@
  #include <boost/shared_ptr.hpp>
  #include <quickmail.h>
  #include <zip.h>
 -#include <libdcp/kdm.h>
 +#include <dcp/encrypted_kdm.h>
 +#include <dcp/types.h>
  #include "kdm.h"
  #include "cinema.h"
  #include "exceptions.h"
@@@ -38,13 -37,13 +38,13 @@@ using boost::shared_ptr
  
  struct ScreenKDM
  {
 -      ScreenKDM (shared_ptr<Screen> s, libdcp::KDM k)
 +      ScreenKDM (shared_ptr<Screen> s, dcp::EncryptedKDM k)
                : screen (s)
                , kdm (k)
        {}
        
        shared_ptr<Screen> screen;
 -      libdcp::KDM kdm;
 +      dcp::EncryptedKDM kdm;
  };
  
  static string
@@@ -105,17 -104,17 +105,17 @@@ make_screen_kdms 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation
        )
  {
 -      list<libdcp::KDM> kdms = film->make_kdms (screens, cpl, from, to, formulation);
 +      list<dcp::EncryptedKDM> kdms = film->make_kdms (screens, cpl, from, to, formulation);
           
        list<ScreenKDM> screen_kdms;
        
        list<shared_ptr<Screen> >::iterator i = screens.begin ();
 -      list<libdcp::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;
@@@ -130,9 -129,9 +130,9 @@@ make_cinema_kdms 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation
        )
  {
        list<ScreenKDM> screen_kdms = make_screen_kdms (film, screens, cpl, from, to, formulation);
@@@ -176,9 -175,9 +176,9 @@@ write_kdm_files 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation,
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation,
        boost::filesystem::path directory
        )
  {
@@@ -197,9 -196,9 +197,9 @@@ write_kdm_zip_files 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation,
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation,
        boost::filesystem::path directory
        )
  {
@@@ -217,9 -216,9 +217,9 @@@ email_kdms 
        shared_ptr<const Film> film,
        list<shared_ptr<Screen> > screens,
        boost::filesystem::path cpl,
 -      boost::posix_time::ptime from,
 -      boost::posix_time::ptime to,
 -      libdcp::KDM::Formulation formulation
 +      dcp::LocalTime from,
 +      dcp::LocalTime to,
 +      dcp::Formulation formulation
        )
  {
        list<CinemaKDMs> cinema_kdms = make_cinema_kdms (film, screens, cpl, from, to, formulation);
                /* Send email */
                
                quickmail_initialize ();
-               quickmail mail = quickmail_create (Config::instance()->kdm_from().c_str(), "KDM delivery");
+               stringstream start;
+               start << from.date() << " " << from.time_of_day();
+               stringstream end;
+               end << to.date() << " " << to.time_of_day();
+               
+               string subject = Config::instance()->kdm_subject();
+               boost::algorithm::replace_all (subject, "$CPL_NAME", film->dcp_name ());
+               boost::algorithm::replace_all (subject, "$START_TIME", start.str ());
+               boost::algorithm::replace_all (subject, "$END_TIME", end.str ());
+               boost::algorithm::replace_all (subject, "$CINEMA_NAME", i->cinema->name);
+               quickmail mail = quickmail_create (Config::instance()->kdm_from().c_str(), subject.c_str ());
+               
                quickmail_add_to (mail, i->cinema->email.c_str ());
                if (!Config::instance()->kdm_cc().empty ()) {
                        quickmail_add_cc (mail, Config::instance()->kdm_cc().c_str ());
                }
+               
                string body = Config::instance()->kdm_email().c_str();
                boost::algorithm::replace_all (body, "$CPL_NAME", film->dcp_name ());
-               stringstream start;
-               start << from.date() << " " << from.time_of_day();
                boost::algorithm::replace_all (body, "$START_TIME", start.str ());
-               stringstream end;
-               end << to.date() << " " << to.time_of_day();
                boost::algorithm::replace_all (body, "$END_TIME", end.str ());
                boost::algorithm::replace_all (body, "$CINEMA_NAME", i->cinema->name);
+               
                stringstream screens;
                for (list<ScreenKDM>::const_iterator j = i->screen_kdms.begin(); j != i->screen_kdms.end(); ++j) {
                        screens << j->screen->name << ", ";
diff --combined src/wx/config_dialog.cc
index fc77b42a28903f2248ab77bad14bb16ab6c074c8,5d1b32038290549b5263b2fc0f83aac43b6db454..360e805725b753f20b42ee8f3cd339bab39b9066
  #include <wx/preferences.h>
  #include <wx/filepicker.h>
  #include <wx/spinctrl.h>
 -#include <libdcp/colour_matrix.h>
 +#include <dcp/colour_matrix.h>
  #include "lib/config.h"
  #include "lib/ratio.h"
  #include "lib/scaler.h"
  #include "lib/filter.h"
  #include "lib/dcp_content_type.h"
  #include "lib/colour_conversion.h"
 +#include "lib/log.h"
  #include "config_dialog.h"
  #include "wx_util.h"
  #include "editable_list.h"
@@@ -396,14 -395,14 +396,14 @@@ private
  
        void issuer_changed ()
        {
 -              libdcp::XMLMetadata m = Config::instance()->dcp_metadata ();
 +              dcp::XMLMetadata m = Config::instance()->dcp_metadata ();
                m.issuer = wx_to_std (_issuer->GetValue ());
                Config::instance()->set_dcp_metadata (m);
        }
        
        void creator_changed ()
        {
 -              libdcp::XMLMetadata m = Config::instance()->dcp_metadata ();
 +              dcp::XMLMetadata m = Config::instance()->dcp_metadata ();
                m.creator = wx_to_std (_creator->GetValue ());
                Config::instance()->set_dcp_metadata (m);
        }
@@@ -670,6 -669,10 +670,10 @@@ public
                font.SetPointSize (font.GetPointSize() - 1);
                plain->SetFont (font);
                table->AddSpacer (0);
+               add_label_to_sizer (table, panel, _("Subject"), true);
+               _kdm_subject = new wxTextCtrl (panel, wxID_ANY);
+               table->Add (_kdm_subject, 1, wxEXPAND | wxALL);
                
                add_label_to_sizer (table, panel, _("From address"), true);
                _kdm_from = new wxTextCtrl (panel, wxID_ANY);
                _mail_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_user_changed, this));
                _mail_password->SetValue (std_to_wx (config->mail_password ()));
                _mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::mail_password_changed, this));
+               _kdm_subject->SetValue (std_to_wx (config->kdm_subject ()));
+               _kdm_subject->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_subject_changed, this));
                _kdm_from->SetValue (std_to_wx (config->kdm_from ()));
                _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_from_changed, this));
                _kdm_cc->SetValue (std_to_wx (config->kdm_cc ()));
@@@ -718,6 -723,11 +724,11 @@@ private
        {
                Config::instance()->set_mail_password (wx_to_std (_mail_password->GetValue ()));
        }
+       void kdm_subject_changed ()
+       {
+               Config::instance()->set_kdm_subject (wx_to_std (_kdm_subject->GetValue ()));
+       }
        
        void kdm_from_changed ()
        {
        wxTextCtrl* _mail_server;
        wxTextCtrl* _mail_user;
        wxTextCtrl* _mail_password;
+       wxTextCtrl* _kdm_subject;
        wxTextCtrl* _kdm_from;
        wxTextCtrl* _kdm_cc;
        wxTextCtrl* _kdm_email;