diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-04 15:59:31 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-04 15:59:31 +0100 |
| commit | cd4a82d90677cec80e891ac190000cb70767446f (patch) | |
| tree | 835776cf87239fb13b2da994c2d4285b03d0bea0 /src | |
| parent | 2cc2dc2aeaec62a4983991170fc5368e10d21748 (diff) | |
| parent | 1738f2e7336734190bed7e94ce3d691d4a9c9e4c (diff) | |
Merge master.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/config.cc | 36 | ||||
| -rw-r--r-- | src/lib/config.h | 30 | ||||
| -rw-r--r-- | src/lib/film.cc | 4 | ||||
| -rw-r--r-- | src/lib/format.cc | 17 | ||||
| -rw-r--r-- | src/lib/format.h | 3 | ||||
| -rw-r--r-- | src/lib/writer.cc | 6 | ||||
| -rw-r--r-- | src/tools/dcpomatic_cli.cc | 15 | ||||
| -rw-r--r-- | src/wx/config_dialog.cc | 96 | ||||
| -rw-r--r-- | src/wx/config_dialog.h | 10 |
9 files changed, 174 insertions, 43 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 4f90581f6..b6f464717 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -27,6 +27,8 @@ #include "server.h" #include "scaler.h" #include "filter.h" +#include "format.h" +#include "dcp_content_type.h" #include "sound_processor.h" #include "i18n.h" @@ -50,6 +52,8 @@ Config::Config () , _tms_path (N_(".")) , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750"))) , _default_still_length (10) + , _default_format (0) + , _default_dcp_content_type (0) { _allowed_dcp_frame_rates.push_back (24); _allowed_dcp_frame_rates.push_back (25); @@ -95,6 +99,20 @@ Config::Config () } _language = f.optional_string_child ("Language"); + + c = f.optional_string_child ("DefaultFormat"); + if (c) { + _default_format = Format::from_id (c.get ()); + } + + c = f.optional_string_child ("DefaultDCPContentType"); + if (c) { + _default_dcp_content_type = DCPContentType::from_dci_name (c.get ()); + } + + _dcp_metadata.issuer = f.optional_string_child ("DCPMetadataIssuer").get_value_or (""); + _dcp_metadata.creator = f.optional_string_child ("DCPMetadataCreator").get_value_or (""); + _default_dci_metadata = DCIMetadata (f.node_child ("DCIMetadata")); _default_still_length = f.optional_number_child<int>("DefaultStillLength").get_value_or (10); } @@ -145,6 +163,16 @@ Config::read_old_metadata () _sound_processor = SoundProcessor::from_id (v); } else if (k == "language") { _language = v; + } else if (k == "default_format") { + _default_format = Format::from_id (v); + } else if (k == "default_dcp_content_type") { + _default_dcp_content_type = DCPContentType::from_dci_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_dci_metadata.read_old_metadata (k, v); @@ -208,6 +236,14 @@ Config::write () const if (_language) { root->add_child("Language")->add_child_text (_language.get()); } + if (_default_format) { + root->add_child("DefaultFormat")->add_child_text (_default_format->id ()); + } + if (_default_dcp_content_type) { + root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->dci_name ()); + } + root->add_child("DCPMetadataIssuer")->add_child_text (_dcp_metadata.issuer); + root->add_child("DCPMetadataCreator")->add_child_text (_dcp_metadata.creator); _default_dci_metadata.as_xml (root->add_child ("DCIMetadata")); diff --git a/src/lib/config.h b/src/lib/config.h index 91926750b..05005e590 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -27,12 +27,15 @@ #include <vector> #include <boost/shared_ptr.hpp> #include <boost/signals2.hpp> +#include <libdcp/metadata.h> #include "dci_metadata.h" class ServerDescription; class Scaler; class Filter; class SoundProcessor; +class Format; +class DCPContentType; /** @class Config * @brief A singleton class holding configuration. @@ -111,6 +114,18 @@ public: return _default_still_length; } + Format const * default_format () const { + return _default_format; + } + + DCPContentType const * default_dcp_content_type () const { + return _default_dcp_content_type; + } + + libdcp::XMLMetadata dcp_metadata () const { + return _dcp_metadata; + } + /** @param n New number of local encoding threads */ void set_num_local_encoding_threads (int n) { _num_local_encoding_threads = n; @@ -178,6 +193,18 @@ public: _default_still_length = s; } + void set_default_format (Format const * f) { + _default_format = f; + } + + void set_default_dcp_content_type (DCPContentType const * t) { + _default_dcp_content_type = t; + } + + void set_dcp_metadata (libdcp::XMLMetadata m) { + _dcp_metadata = m; + } + void write () const; static Config* instance (); @@ -216,6 +243,9 @@ private: DCIMetadata _default_dci_metadata; boost::optional<std::string> _language; int _default_still_length; + Format const * _default_format; + DCPContentType const * _default_dcp_content_type; + libdcp::XMLMetadata _dcp_metadata; /** Singleton instance, or 0 */ static Config* _instance; diff --git a/src/lib/film.cc b/src/lib/film.cc index 5481bd012..8fed87122 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -93,8 +93,8 @@ Film::Film (string d, bool must_exist) : _playlist (new Playlist) , _use_dci_name (true) , _trust_content_headers (true) - , _dcp_content_type (0) - , _format (Format::from_id ("185")) + , _dcp_content_type (Config::instance()->default_dcp_content_type ()) + , _format (Config::instance()->default_format ()) , _scaler (Scaler::from_id ("bicubic")) , _trim_start (0) , _trim_end (0) diff --git a/src/lib/format.cc b/src/lib/format.cc index a83d53ebd..f5026c0da 100644 --- a/src/lib/format.cc +++ b/src/lib/format.cc @@ -60,13 +60,6 @@ FixedFormat::name () const return s.str (); } -/** @return Identifier for this format as metadata for a Film's metadata file */ -string -Format::as_metadata () const -{ - return _id; -} - /** Fill our _formats vector with all available formats */ void Format::setup_formats () @@ -165,16 +158,6 @@ Format::from_id (string i) return *j; } - -/** @param m Metadata, as returned from as_metadata(). - * @return Matching Format, or 0. - */ -Format const * -Format::from_metadata (string m) -{ - return from_id (m); -} - /** @return All available formats */ vector<Format const *> Format::all () diff --git a/src/lib/format.h b/src/lib/format.h index f240c89fc..d45a3a10a 100644 --- a/src/lib/format.h +++ b/src/lib/format.h @@ -67,10 +67,7 @@ public: return _dci_name; } - std::string as_metadata () const; - static Format const * from_nickname (std::string n); - static Format const * from_metadata (std::string m); static Format const * from_id (std::string i); static std::vector<Format const *> all (); static void setup_formats (); diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 8e771a5e2..b545848cb 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -23,6 +23,7 @@ #include <libdcp/picture_frame.h> #include <libdcp/reel.h> #include <libdcp/dcp.h> +#include <libdcp/cpl.h> #include "writer.h" #include "compose.hpp" #include "film.h" @@ -32,6 +33,7 @@ #include "dcp_content_type.h" #include "player.h" #include "audio_mapping.h" +#include "config.h" #include "i18n.h" @@ -322,7 +324,9 @@ Writer::finish () ) )); - dcp.write_xml (); + libdcp::XMLMetadata meta = Config::instance()->dcp_metadata (); + meta.set_issue_date_now (); + dcp.write_xml (meta); _film->log()->log (String::compose (N_("Wrote %1 FULL, %2 FAKE, %3 REPEAT; %4 pushed to disk"), _full_written, _fake_written, _repeat_written, _pushed_to_disk)); } diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 86c3cf4b1..d4a4210de 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -20,7 +20,6 @@ #include <iostream> #include <iomanip> #include <getopt.h> -#include <libdcp/test_mode.h> #include <libdcp/version.h> #include "format.h" #include "film.h" @@ -50,7 +49,6 @@ help (string n) << " -v, --version show DCP-o-matic version\n" << " -h, --help show this help\n" << " -d, --deps list DCP-o-matic dependency details and quit\n" - << " -t, --test run in test mode (repeatable UUID generation, timestamps etc.)\n" << " -n, --no-progress do not print progress to stdout\n" << " -r, --no-remote do not use any remote servers\n" << "\n" @@ -61,7 +59,6 @@ int main (int argc, char* argv[]) { string film_dir; - bool test_mode = false; bool progress = true; bool no_remote = false; int log_level = 0; @@ -72,14 +69,13 @@ main (int argc, char* argv[]) { "version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h'}, { "deps", no_argument, 0, 'd'}, - { "test", no_argument, 0, 't'}, { "no-progress", no_argument, 0, 'n'}, { "no-remote", no_argument, 0, 'r'}, { "log-level", required_argument, 0, 'l' }, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vhdtnrl:", long_options, &option_index); + int c = getopt_long (argc, argv, "vhdnrl:", long_options, &option_index); if (c == -1) { break; @@ -95,9 +91,6 @@ main (int argc, char* argv[]) case 'd': cout << dependency_version_summary () << "\n"; exit (EXIT_SUCCESS); - case 't': - test_mode = true; - break; case 'n': progress = false; break; @@ -130,11 +123,6 @@ main (int argc, char* argv[]) } cout << "\n"; - if (test_mode) { - libdcp::enable_test_mode (); - cout << dependency_version_summary() << "\n"; - } - shared_ptr<Film> film; try { film.reset (new Film (film_dir, true)); @@ -150,7 +138,6 @@ main (int argc, char* argv[]) cout << "A/B "; } cout << "DCP for " << film->name() << "\n"; - cout << "Test mode: " << (test_mode ? "yes" : "no") << "\n"; // cout << "Content: " << film->content() << "\n"; pair<string, string> const f = Filter::ffmpeg_strings (film->filters ()); cout << "Filters: " << f.first << " " << f.second << "\n"; diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index e1fc7a20f..50b8990b1 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -31,6 +31,7 @@ #include "lib/format.h" #include "lib/scaler.h" #include "lib/filter.h" +#include "lib/dcp_content_type.h" #include "config_dialog.h" #include "wx_util.h" #include "filter_dialog.h" @@ -52,6 +53,8 @@ ConfigDialog::ConfigDialog (wxWindow* parent) _notebook->AddPage (_misc_panel, _("Miscellaneous"), true); make_servers_panel (); _notebook->AddPage (_servers_panel, _("Encoding servers"), false); + make_metadata_panel (); + _notebook->AddPage (_metadata_panel, _("Metadata"), false); make_tms_panel (); _notebook->AddPage (_tms_panel, _("TMS"), false); make_ab_panel (); @@ -124,6 +127,16 @@ ConfigDialog::make_misc_panel () table->Add (_default_dci_metadata_button); table->AddSpacer (1); + add_label_to_sizer (table, _misc_panel, _("Default format")); + _default_format = new wxChoice (_misc_panel, wxID_ANY); + table->Add (_default_format); + table->AddSpacer (1); + + add_label_to_sizer (table, _misc_panel, _("Default content type")); + _default_dcp_content_type = new wxChoice (_misc_panel, wxID_ANY); + table->Add (_default_dcp_content_type); + table->AddSpacer (1); + Config* config = Config::instance (); _set_language->SetValue (config->language ()); @@ -158,6 +171,29 @@ ConfigDialog::make_misc_panel () _default_dci_metadata_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_default_dci_metadata_clicked), 0, this); + vector<Format const *> fmt = Format::all (); + int n = 0; + for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) { + _default_format->Append (std_to_wx ((*i)->name ())); + if (*i == config->default_format ()) { + _default_format->SetSelection (n); + } + ++n; + } + + _default_format->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_format_changed), 0, this); + + vector<DCPContentType const *> const ct = DCPContentType::all (); + n = 0; + for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) { + _default_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); + if (*i == config->default_dcp_content_type ()) { + _default_dcp_content_type->SetSelection (n); + } + ++n; + } + + _default_dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::default_dcp_content_type_changed), 0, this); } void @@ -230,15 +266,33 @@ ConfigDialog::make_ab_panel () table->Add (s, 1, wxEXPAND); table->AddSpacer (0); } +} + +void +ConfigDialog::make_metadata_panel () +{ + _metadata_panel = new wxPanel (_notebook); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + _metadata_panel->SetSizer (s); + + wxFlexGridSizer* table = new wxFlexGridSizer (2, 6, 6); + table->AddGrowableCol (1, 1); + s->Add (table, 1, wxALL | wxEXPAND, 8); + + add_label_to_sizer (table, _metadata_panel, _("Issuer")); + _issuer = new wxTextCtrl (_metadata_panel, wxID_ANY); + table->Add (_issuer, 1, wxEXPAND); + + add_label_to_sizer (table, _metadata_panel, _("Creator")); + _creator = new wxTextCtrl (_metadata_panel, wxID_ANY); + table->Add (_creator, 1, wxEXPAND); Config* config = Config::instance (); - - _reference_scaler->SetSelection (Scaler::as_index (config->reference_scaler ())); - _reference_scaler->Connect (wxID_ANY, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler (ConfigDialog::reference_scaler_changed), 0, this); - pair<string, string> p = Filter::ffmpeg_strings (config->reference_filters ()); - _reference_filters->SetLabel (std_to_wx (p.first) + N_(" ") + std_to_wx (p.second)); - _reference_filters_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ConfigDialog::edit_reference_filters_clicked), 0, this); + _issuer->SetValue (std_to_wx (config->dcp_metadata().issuer)); + _issuer->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::issuer_changed), 0, this); + _creator->SetValue (std_to_wx (config->dcp_metadata().creator)); + _creator->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::creator_changed), 0, this); } void @@ -477,3 +531,33 @@ ConfigDialog::default_still_length_changed (wxCommandEvent &) { Config::instance()->set_default_still_length (_default_still_length->GetValue ()); } + +void +ConfigDialog::default_format_changed (wxCommandEvent &) +{ + vector<Format const *> fmt = Format::all (); + Config::instance()->set_default_format (fmt[_default_format->GetSelection()]); +} + +void +ConfigDialog::default_dcp_content_type_changed (wxCommandEvent &) +{ + vector<DCPContentType const *> ct = DCPContentType::all (); + Config::instance()->set_default_dcp_content_type (ct[_default_dcp_content_type->GetSelection()]); +} + +void +ConfigDialog::issuer_changed (wxCommandEvent &) +{ + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.issuer = wx_to_std (_issuer->GetValue ()); + Config::instance()->set_dcp_metadata (m); +} + +void +ConfigDialog::creator_changed (wxCommandEvent &) +{ + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.creator = wx_to_std (_creator->GetValue ()); + Config::instance()->set_dcp_metadata (m); +} diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index 852925e1d..5df1a634f 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -57,12 +57,17 @@ private: void edit_server_clicked (wxCommandEvent &); void remove_server_clicked (wxCommandEvent &); void server_selection_changed (wxListEvent &); + void default_format_changed (wxCommandEvent &); + void default_dcp_content_type_changed (wxCommandEvent &); + void issuer_changed (wxCommandEvent &); + void creator_changed (wxCommandEvent &); void add_server_to_control (ServerDescription *); void setup_language_sensitivity (); void make_misc_panel (); void make_tms_panel (); + void make_metadata_panel (); void make_ab_panel (); void make_servers_panel (); @@ -71,8 +76,11 @@ private: wxPanel* _tms_panel; wxPanel* _ab_panel; wxPanel* _servers_panel; + wxPanel* _metadata_panel; wxCheckBox* _set_language; wxChoice* _language; + wxChoice* _default_format; + wxChoice* _default_dcp_content_type; wxTextCtrl* _tms_ip; wxTextCtrl* _tms_path; wxTextCtrl* _tms_user; @@ -92,5 +100,7 @@ private: wxButton* _add_server; wxButton* _edit_server; wxButton* _remove_server; + wxTextCtrl* _issuer; + wxTextCtrl* _creator; }; |
