From cc56fc111c742ed5ec072fa0bbe0b950150d40c1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 3 May 2013 00:56:16 +0100 Subject: Configurable default format and content type (#133). --- src/lib/config.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/lib/config.cc') diff --git a/src/lib/config.cc b/src/lib/config.cc index 5dce3748d..0e2e33a16 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -26,6 +26,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" @@ -45,6 +47,8 @@ Config::Config () , _reference_scaler (Scaler::from_id (N_("bicubic"))) , _tms_path (N_(".")) , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750"))) + , _default_format (0) + , _default_dcp_content_type (0) { _allowed_dcp_frame_rates.push_back (24); _allowed_dcp_frame_rates.push_back (25); @@ -96,6 +100,10 @@ Config::Config () _sound_processor = SoundProcessor::from_id (v); } else if (k == "language") { _language = v; + } else if (k == "default_format") { + _default_format = Format::from_metadata (v); + } else if (k == "default_dcp_content_type") { + _default_dcp_content_type = DCPContentType::from_dci_name (v); } _default_dci_metadata.read (k, v); @@ -154,6 +162,12 @@ Config::write () const if (_language) { f << "language " << _language.get() << "\n"; } + if (_default_format) { + f << "default_format " << _default_format->as_metadata() << "\n"; + } + if (_default_dcp_content_type) { + f << "default_dcp_content_type " << _default_dcp_content_type->dci_name() << "\n"; + } _default_dci_metadata.write (f); } -- cgit v1.2.3 From 1738f2e7336734190bed7e94ce3d691d4a9c9e4c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 4 May 2013 11:08:46 +0100 Subject: Add config options for some of the DCP XML metadata (#122). --- src/lib/config.cc | 27 ++++++++++++++++++--------- src/lib/config.h | 10 ++++++++++ src/lib/writer.cc | 6 +++++- src/tools/makedcp.cc | 15 +-------------- src/wx/config_dialog.cc | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/wx/config_dialog.h | 6 ++++++ 6 files changed, 85 insertions(+), 24 deletions(-) (limited to 'src/lib/config.cc') diff --git a/src/lib/config.cc b/src/lib/config.cc index 0e2e33a16..8c65e371a 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -104,6 +104,12 @@ Config::Config () _default_format = Format::from_metadata (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 (k, v); @@ -136,26 +142,26 @@ void Config::write () const { ofstream f (file().c_str ()); - f << N_("num_local_encoding_threads ") << _num_local_encoding_threads << N_("\n") - << N_("default_directory ") << _default_directory << N_("\n") - << N_("server_port ") << _server_port << N_("\n"); + f << "num_local_encoding_threads " << _num_local_encoding_threads << "\n" + << "default_directory " << _default_directory << "\n" + << "server_port " << _server_port << "\n"; if (_reference_scaler) { f << "reference_scaler " << _reference_scaler->id () << "\n"; } for (vector::const_iterator i = _reference_filters.begin(); i != _reference_filters.end(); ++i) { - f << N_("reference_filter ") << (*i)->id () << N_("\n"); + f << "reference_filter " << (*i)->id () << "\n"; } for (vector::const_iterator i = _servers.begin(); i != _servers.end(); ++i) { - f << N_("server ") << (*i)->as_metadata () << N_("\n"); + f << "server " << (*i)->as_metadata () << "\n"; } - f << N_("tms_ip ") << _tms_ip << N_("\n"); - f << N_("tms_path ") << _tms_path << N_("\n"); - f << N_("tms_user ") << _tms_user << N_("\n"); - f << N_("tms_password ") << _tms_password << N_("\n"); + f << "tms_ip " << _tms_ip << "\n"; + f << "tms_path " << _tms_path << "\n"; + f << "tms_user " << _tms_user << "\n"; + f << "tms_password " << _tms_password << "\n"; if (_sound_processor) { f << "sound_processor " << _sound_processor->id () << "\n"; } @@ -168,6 +174,9 @@ Config::write () const if (_default_dcp_content_type) { f << "default_dcp_content_type " << _default_dcp_content_type->dci_name() << "\n"; } + f << "dcp_metadata_issuer " << _dcp_metadata.issuer << "\n"; + f << "dcp_metadata_creator " << _dcp_metadata.creator << "\n"; + f << "dcp_metadata_issue_date " << _dcp_metadata.issue_date << "\n"; _default_dci_metadata.write (f); } diff --git a/src/lib/config.h b/src/lib/config.h index 6041045cf..a59cdcae0 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "dci_metadata.h" class ServerDescription; @@ -117,6 +118,10 @@ public: 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; @@ -187,6 +192,10 @@ public: 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; @@ -226,6 +235,7 @@ private: boost::optional _language; 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/writer.cc b/src/lib/writer.cc index ad81686d1..177e929ae 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -22,12 +22,14 @@ #include #include #include +#include #include "writer.h" #include "compose.hpp" #include "film.h" #include "format.h" #include "log.h" #include "dcp_video_frame.h" +#include "config.h" #include "i18n.h" @@ -320,7 +322,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/makedcp.cc b/src/tools/makedcp.cc index c594991a6..e73930d3c 100644 --- a/src/tools/makedcp.cc +++ b/src/tools/makedcp.cc @@ -20,7 +20,6 @@ #include #include #include -#include #include #include "format.h" #include "film.h" @@ -50,7 +49,6 @@ help (string n) << " -v, --version show DVD-o-matic version\n" << " -h, --help show this help\n" << " -d, --deps list DVD-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; 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 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 a91bfd64c..98657b666 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -53,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 (); @@ -224,6 +226,33 @@ ConfigDialog::make_tms_panel () _tms_password->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (ConfigDialog::tms_password_changed), 0, this); } +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 (); + + _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 ConfigDialog::make_ab_panel () { @@ -510,3 +539,19 @@ ConfigDialog::default_dcp_content_type_changed (wxCommandEvent &) vector 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 c926b0937..526480912 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -58,12 +58,15 @@ private: 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 (); @@ -72,6 +75,7 @@ private: wxPanel* _tms_panel; wxPanel* _ab_panel; wxPanel* _servers_panel; + wxPanel* _metadata_panel; wxCheckBox* _set_language; wxChoice* _language; wxChoice* _default_format; @@ -94,5 +98,7 @@ private: wxButton* _add_server; wxButton* _edit_server; wxButton* _remove_server; + wxTextCtrl* _issuer; + wxTextCtrl* _creator; }; -- cgit v1.2.3