Bump libdcp for new method.
authorCarl Hetherington <cth@carlh.net>
Wed, 24 Aug 2016 10:16:24 +0000 (11:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 24 Aug 2016 10:16:24 +0000 (11:16 +0100)
23 files changed:
cscript
src/lib/atmos_mxf_content.cc
src/lib/atmos_mxf_content.h
src/lib/config.cc
src/lib/config.h
src/lib/content.cc
src/lib/content.h
src/lib/dcp_content.cc
src/lib/dcp_content.h
src/lib/ffmpeg_content.cc
src/lib/ffmpeg_content.h
src/lib/film.cc
src/lib/film.h
src/lib/image_content.cc
src/lib/image_content.h
src/lib/playlist.cc
src/lib/playlist.h
src/lib/text_subtitle_content.cc
src/lib/text_subtitle_content.h
src/tools/dcpomatic.cc
src/wx/new_film_dialog.cc
src/wx/new_film_dialog.h
src/wx/wscript

diff --git a/cscript b/cscript
index e4a68a53fa97f62306780c705449b74c02edb467..1377813986330e2511d82af0e94c3a4d54d5d735 100644 (file)
--- a/cscript
+++ b/cscript
@@ -237,7 +237,7 @@ def dependencies(target):
         ffmpeg_options = {}
 
     return (('ffmpeg-cdist', '1d4a1a4', ffmpeg_options),
-            ('libdcp', 'c178a9d'),
+            ('libdcp', '04def4c'),
             ('libsub', '067c21c'))
 
 def configure_options(target):
index f8cc05178ef2d4349580237d462bd39dfafcfdbc..2fd9ead068cf3f9130afcd0d9efe9ec486277e19 100644 (file)
@@ -79,10 +79,10 @@ AtmosMXFContent::summary () const
 }
 
 void
-AtmosMXFContent::as_xml (xmlpp::Node* node) const
+AtmosMXFContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
        node->add_child("Type")->add_child_text ("AtmosMXF");
-       Content::as_xml (node);
+       Content::as_xml (node, with_paths);
 }
 
 DCPTime
index 10c969a7da595dd514db36f9b7bcb51f355690d3..0f5225c2ec7fa8ad871862b05d10399177a48a43 100644 (file)
@@ -32,7 +32,7 @@ public:
 
        void examine (boost::shared_ptr<Job> job);
        std::string summary () const;
-       void as_xml (xmlpp::Node* node) const;
+       void as_xml (xmlpp::Node* node, bool with_path) const;
        DCPTime full_length () const;
 
        static bool valid_mxf (boost::filesystem::path path);
index 4184a7d1d53aab035368ffef2220156b33bb26f4..383ffdbd64598299d59565d6ecfbf34932b2085b 100644 (file)
@@ -588,3 +588,11 @@ Config::set_cinemas_file (boost::filesystem::path file)
 
        changed (OTHER);
 }
+
+void
+Config::save_template (shared_ptr<const Film> film, string name) const
+{
+       boost::filesystem::create_directories (path ("templates"));
+       shared_ptr<xmlpp::Document> doc = film->metadata (false);
+       doc->write_to_file_formatted (path("templates") / tidy_for_filename (name));
+}
index a988cda6b7f11b687303ac255dd97b337aa1c7b0..3df5c3795e7d4666835a5a5bf3efcf4c98107bee 100644 (file)
@@ -514,6 +514,8 @@ public:
 
        void write () const;
 
+       void save_template (boost::shared_ptr<const Film> film, std::string name) const;
+
        static Config* instance ();
        static void drop ();
        static void restore_defaults ();
index 9083635f242eaea3f5aefe5445c1d25ccb6b8921..a27032e9c135efaed177a39b3594d91a3937e6a9 100644 (file)
@@ -135,12 +135,14 @@ Content::Content (shared_ptr<const Film> film, vector<shared_ptr<Content> > c)
 }
 
 void
-Content::as_xml (xmlpp::Node* node) const
+Content::as_xml (xmlpp::Node* node, bool with_paths) const
 {
        boost::mutex::scoped_lock lm (_mutex);
 
-       for (vector<boost::filesystem::path>::const_iterator i = _paths.begin(); i != _paths.end(); ++i) {
-               node->add_child("Path")->add_child_text (i->string ());
+       if (with_paths) {
+               for (vector<boost::filesystem::path>::const_iterator i = _paths.begin(); i != _paths.end(); ++i) {
+                       node->add_child("Path")->add_child_text (i->string ());
+               }
        }
        node->add_child("Digest")->add_child_text (_digest);
        node->add_child("Position")->add_child_text (raw_convert<string> (_position.get ()));
index f8b5493c0eb400d4e32c995d83ce8733e90903e4..e126c994b24a3adb6aab129b0b8eafa264b61d2c 100644 (file)
@@ -86,7 +86,7 @@ public:
         */
        virtual std::string technical_summary () const;
 
-       virtual void as_xml (xmlpp::Node *) const;
+       virtual void as_xml (xmlpp::Node *, bool with_paths) const;
        virtual DCPTime full_length () const = 0;
        virtual std::string identifier () const;
        /** @return points at which to split this content when
index 03e6f1aaa5415e64f85cfdb5cbfc93eca72046bc..5cacc824a0899977492ac3801e37ab9a193daaea 100644 (file)
@@ -192,7 +192,7 @@ DCPContent::technical_summary () const
 }
 
 void
-DCPContent::as_xml (xmlpp::Node* node) const
+DCPContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
        node->add_child("Type")->add_child_text ("DCP");
 
index f3a8236a2d4c0c77194640d4ec463c67a9bb2bc1..79c35d0e8773d8262fa3c75c81467015552e6c68 100644 (file)
@@ -62,7 +62,7 @@ public:
        void examine (boost::shared_ptr<Job>);
        std::string summary () const;
        std::string technical_summary () const;
-       void as_xml (xmlpp::Node *) const;
+       void as_xml (xmlpp::Node *, bool with_paths) const;
        std::string identifier () const;
 
        void set_default_colour_conversion ();
index b5c5ce0a8a45e64da5d52aae6a4aa3aaf482fb91..bc913a9ae280169dfba3e0ed7ac7fb7131149703 100644 (file)
@@ -181,10 +181,10 @@ FFmpegContent::FFmpegContent (shared_ptr<const Film> film, vector<shared_ptr<Con
 }
 
 void
-FFmpegContent::as_xml (xmlpp::Node* node) const
+FFmpegContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
        node->add_child("Type")->add_child_text ("FFmpeg");
-       Content::as_xml (node);
+       Content::as_xml (node, with_paths);
 
        if (video) {
                video->as_xml (node);
index 666322669c071015bc5d9d864727adeeb72c5a07..b341aa01293df06946de6ecfe6f542697c6fc7b0 100644 (file)
@@ -57,7 +57,7 @@ public:
        void examine (boost::shared_ptr<Job>);
        std::string summary () const;
        std::string technical_summary () const;
-       void as_xml (xmlpp::Node *) const;
+       void as_xml (xmlpp::Node *, bool with_paths) const;
        DCPTime full_length () const;
 
        std::string identifier () const;
index edb9112177ef7362fdc5da2585a7565552c1772a..31c47540fce81eef2f275414ef40e74d44934bc8 100644 (file)
@@ -329,7 +329,7 @@ Film::send_dcp_to_tms ()
 }
 
 shared_ptr<xmlpp::Document>
-Film::metadata () const
+Film::metadata (bool with_content_paths) const
 {
        shared_ptr<xmlpp::Document> doc (new xmlpp::Document);
        xmlpp::Element* root = doc->create_root_node ("Metadata");
@@ -364,7 +364,7 @@ Film::metadata () const
        root->add_child("ReelType")->add_child_text (raw_convert<string> (static_cast<int> (_reel_type)));
        root->add_child("ReelLength")->add_child_text (raw_convert<string> (_reel_length));
        root->add_child("UploadAfterMakeDCP")->add_child_text (_upload_after_make_dcp ? "1" : "0");
-       _playlist->as_xml (root->add_child ("Playlist"));
+       _playlist->as_xml (root->add_child ("Playlist"), with_content_paths);
 
        return doc;
 }
index 82d1f78c043fe21329a0c80a1d74ff0e4921a1ad..abe5c214fcaf400b70ecddcea3e09244f832dffe 100644 (file)
@@ -93,7 +93,7 @@ public:
 
        std::list<std::string> read_metadata ();
        void write_metadata () const;
-       boost::shared_ptr<xmlpp::Document> metadata () const;
+       boost::shared_ptr<xmlpp::Document> metadata (bool with_content_paths = true) const;
 
        std::string isdcf_name (bool if_created_now) const;
        std::string dcp_name (bool if_created_now = false) const;
index 825f6da25aab1267bffe75f8fba442585c4a44e6..b27483978c157f8ca86b934c8b37d5e6e5bd9e58 100644 (file)
@@ -100,10 +100,10 @@ ImageContent::technical_summary () const
 }
 
 void
-ImageContent::as_xml (xmlpp::Node* node) const
+ImageContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
        node->add_child("Type")->add_child_text ("Image");
-       Content::as_xml (node);
+       Content::as_xml (node, with_paths);
 
        if (video) {
                video->as_xml (node);
index edcbec6ddb04122cc3211797d24edf40757510e2..660d2ef9fc21883e09918ddedee29009ae7c5a4b 100644 (file)
@@ -36,7 +36,7 @@ public:
        void examine (boost::shared_ptr<Job>);
        std::string summary () const;
        std::string technical_summary () const;
-       void as_xml (xmlpp::Node *) const;
+       void as_xml (xmlpp::Node *, bool with_paths) const;
        DCPTime full_length () const;
 
        std::string identifier () const;
index a8b5a26ebbc0c4e91a9385d2aa67b5a724cf9bb2..a30dde633cde3120bc29cdc2b762e3c723f802de 100644 (file)
@@ -175,10 +175,10 @@ Playlist::set_from_xml (shared_ptr<const Film> film, cxml::ConstNodePtr node, in
 
 /** @param node <Playlist> node */
 void
-Playlist::as_xml (xmlpp::Node* node)
+Playlist::as_xml (xmlpp::Node* node, bool with_content_paths)
 {
        BOOST_FOREACH (shared_ptr<Content> i, _content) {
-               i->as_xml (node->add_child ("Content"));
+               i->as_xml (node->add_child ("Content"), with_content_paths);
        }
 }
 
index e84b51a73e84c91372fb132ca05e59de258ddba4..0a5c087dea67ed076f0833e584ef2c5b3359a823 100644 (file)
@@ -45,7 +45,7 @@ public:
        Playlist ();
        ~Playlist ();
 
-       void as_xml (xmlpp::Node *);
+       void as_xml (xmlpp::Node *, bool with_content_paths);
        void set_from_xml (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int, std::list<std::string> &);
 
        void add (boost::shared_ptr<Content>);
index 63144766a50cffe172a671ca24b64a9dfe9c9eb6..08722a065d0f66bdfdce8e907cf0c4603b4075fa 100644 (file)
@@ -75,10 +75,10 @@ TextSubtitleContent::technical_summary () const
 }
 
 void
-TextSubtitleContent::as_xml (xmlpp::Node* node) const
+TextSubtitleContent::as_xml (xmlpp::Node* node, bool with_paths) const
 {
        node->add_child("Type")->add_child_text ("TextSubtitle");
-       Content::as_xml (node);
+       Content::as_xml (node, with_paths);
 
        if (subtitle) {
                subtitle->as_xml (node);
index 3b9d396f610dd2f56f7d5b069f099d23734d9371..fd0bad12a310957ff23e657d4cfe2e9e313278c4 100644 (file)
@@ -38,7 +38,7 @@ public:
        void examine (boost::shared_ptr<Job>);
        std::string summary () const;
        std::string technical_summary () const;
-       void as_xml (xmlpp::Node *) const;
+       void as_xml (xmlpp::Node *, bool with_paths) const;
        DCPTime full_length () const;
 
 private:
index d4695f1fa08b04475dd4210a3ff7ee40c5b02601..1fccb992a1e60e88bf49335c85924068073e9a88 100644 (file)
@@ -143,6 +143,7 @@ enum {
        ID_file_new = 1,
        ID_file_open,
        ID_file_save,
+       ID_file_save_as_template,
        ID_file_history,
        /* Allow spare IDs after _history for the recent files list */
        ID_content_scale_to_fit_width = 100,
@@ -210,6 +211,7 @@ public:
                Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_new, this),                ID_file_new);
                Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_open, this),               ID_file_open);
                Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_save, this),               ID_file_save);
+               Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_save_as_template, this),   ID_file_save_as_template);
                Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_history, this, _1),        ID_file_history, ID_file_history + HISTORY_SIZE);
                Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::file_exit, this),               wxID_EXIT);
                Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&DOMFrame::edit_preferences, this),        wxID_PREFERENCES);
@@ -339,7 +341,7 @@ private:
                SetTitle (std_to_wx (s));
        }
 
-       void file_new ()
+       void file_new (bool from_template)
        {
                NewFilmDialog* d = new NewFilmDialog (this);
                int const r = d->ShowModal ();
@@ -366,7 +368,7 @@ private:
                        }
 
                        if (maybe_save_then_delete_film ()) {
-                               new_film (d->get_path ());
+                               new_film (d->get_path(), d->template_name());
                        }
                }
 
@@ -404,6 +406,22 @@ private:
                _film->write_metadata ();
        }
 
+       void file_save_as_template ()
+       {
+               SaveTemplateDialog* td = new SaveTemplateDialog (this);
+               int const r = d->ShowModal ();
+               if (r == wxID_OK) {
+                       bool ok = true;
+                       if (Config::instance()->existing_template (r->name ())) {
+                               ok = confirm_dialog (td, _("There is already a template with this name.  Do you want to overwrite it?"));
+                       }
+                       if (ok) {
+                               Config::instance()->save_template (_film, r->name ());
+                       }
+               }
+               d->Destroy ();
+       }
+
        void file_history (wxCommandEvent& event)
        {
                vector<boost::filesystem::path> history = Config::instance()->history ();
@@ -826,6 +844,8 @@ private:
                add_item (_file_menu, _("&Open...\tCtrl-O"), ID_file_open, ALWAYS);
                _file_menu->AppendSeparator ();
                add_item (_file_menu, _("&Save\tCtrl-S"), ID_file_save, NEEDS_FILM);
+               _file_menu->AppendSeparator ();
+               add_item (_file_menu, _("&Save as template"), ID_file_save_as_template, NEEDS_FILM);
 
                _history_position = _file_menu->GetMenuItems().GetCount();
 
index 04b9e10578889d8f43b59f50f1d178dfd193d9ce..4883810d06cc63379c294a328ddaccecd45eae5e 100644 (file)
@@ -46,6 +46,10 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent)
        _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
 #endif
 
+       _use_template = new wxCheckButton (this, wxID_ANY, _("From template"));
+       add (_use_template);
+       _template_name = new wxChoice (this, wxID_ANY);
+
        if (!_directory) {
                _directory = Config::instance()->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir()));
        }
@@ -54,10 +58,23 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent)
        add (_folder);
 
        _name->SetFocus ();
+       _template_name->Enable (false);
+
+       BOOST_FOREACH (string i, Config::instance()->template_names ()) {
+               _template_name->Append (std_to_wx (i));
+       }
+
+       _use_template->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, bind (&NewFilmDialog::use_template_clicked, this));
 
        layout ();
 }
 
+void
+NewFilmDialog::use_template_clicked ()
+{
+       _template_name->Enable (_use_template->GetValue ());
+}
+
 NewFilmDialog::~NewFilmDialog ()
 {
        _directory = wx_to_std (_folder->GetPath ());
@@ -71,3 +88,13 @@ NewFilmDialog::get_path () const
        p /= wx_to_std (_name->GetValue ());
        return p;
 }
+
+optional<string>
+NewFilmDialog::template_name () const
+{
+       if (!_use_template->GetValue ()) {
+               return optional<string> ();
+       }
+
+       return wx_to_std (_template_name->GetValue ());
+}
index 6dc83d815b546528ee54c7ae2706a32024fc036a..4096b4303b8b86987b48ce07522c16eb5a976115 100644 (file)
@@ -31,7 +31,8 @@ public:
        NewFilmDialog (wxWindow *);
        ~NewFilmDialog ();
 
-       boost::filesystem::path get_path () const;
+       boost::filesystem::path path () const;
+       boost::optional<std::string> template_name () const;
 
 private:
        wxTextCtrl* _name;
@@ -40,5 +41,7 @@ private:
 #else
        wxDirPickerCtrl* _folder;
 #endif
+       wxCheckButton* _use_template;
+       wxChoice* _template_name;
        static boost::optional<boost::filesystem::path> _directory;
 };
index ee77e6c20b5c9eba1e3a840d1c79437145d66622..1f9aed6b3c4c79aebaf453630ce9ad36e73bb1fe 100644 (file)
@@ -75,6 +75,7 @@ sources = """
           repeat_dialog.cc
           report_problem_dialog.cc
           rgba_colour_picker.cc
+          save_template_dialog.cc
           screen_dialog.cc
           screens_panel.cc
           self_dkdm_dialog.cc