X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fconfig.cc;h=e0fbcc703f58042948cb3a1dc83aa62d58f09fe3;hb=a8b5ac47b89927eb2495dba71393a8a073967560;hp=3beb0aea62327c14bae36e4132344fa61550f0cd;hpb=92cafb6fc686a041354da2eabde6bcb2f6846e1d;p=dcpomatic.git diff --git a/src/lib/config.cc b/src/lib/config.cc index 3beb0aea6..e0fbcc703 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -27,7 +27,7 @@ #include "server.h" #include "scaler.h" #include "filter.h" -#include "format.h" +#include "ratio.h" #include "dcp_content_type.h" #include "sound_processor.h" @@ -38,6 +38,7 @@ using std::ifstream; using std::string; using std::ofstream; using std::list; +using std::max; using boost::shared_ptr; using boost::lexical_cast; using boost::optional; @@ -46,13 +47,12 @@ Config* Config::_instance = 0; /** Construct default configuration */ Config::Config () - : _num_local_encoding_threads (2) + : _num_local_encoding_threads (max (2U, boost::thread::hardware_concurrency())) , _server_port (6192) - , _reference_scaler (Scaler::from_id (N_("bicubic"))) , _tms_path (N_(".")) , _sound_processor (SoundProcessor::from_id (N_("dolby_cp750"))) , _default_still_length (10) - , _default_format (0) + , _default_container (Ratio::from_id ("185")) , _default_dcp_content_type (0) { _allowed_dcp_frame_rates.push_back (24); @@ -77,15 +77,6 @@ Config::read () _num_local_encoding_threads = f.number_child ("NumLocalEncodingThreads"); _default_directory = f.string_child ("DefaultDirectory"); _server_port = f.number_child ("ServerPort"); - c = f.optional_string_child ("ReferenceScaler"); - if (c) { - _reference_scaler = Scaler::from_id (c.get ()); - } - - list > filters = f.node_children ("ReferenceFilter"); - for (list >::iterator i = filters.begin(); i != filters.end(); ++i) { - _reference_filters.push_back (Filter::from_id ((*i)->content ())); - } list > servers = f.node_children ("Server"); for (list >::iterator i = servers.begin(); i != servers.end(); ++i) { @@ -104,9 +95,9 @@ Config::read () _language = f.optional_string_child ("Language"); - c = f.optional_string_child ("DefaultFormat"); + c = f.optional_string_child ("DefaultContainer"); if (c) { - _default_format = Format::from_id (c.get ()); + _default_container = Ratio::from_id (c.get ()); } c = f.optional_string_child ("DefaultDCPContentType"); @@ -149,10 +140,6 @@ Config::read_old_metadata () _default_directory = v; } else if (k == N_("server_port")) { _server_port = atoi (v.c_str ()); - } else if (k == N_("reference_scaler")) { - _reference_scaler = Scaler::from_id (v); - } else if (k == N_("reference_filter")) { - _reference_filters.push_back (Filter::from_id (v)); } else if (k == N_("server")) { _servers.push_back (ServerDescription::create_from_metadata (v)); } else if (k == N_("tms_ip")) { @@ -167,8 +154,8 @@ 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_container") { + _default_container = Ratio::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") { @@ -189,6 +176,8 @@ Config::file (bool old) const { boost::filesystem::path p; p /= g_get_user_config_dir (); + boost::system::error_code ec; + boost::filesystem::create_directory (p, ec); if (old) { p /= ".dvdomatic"; } else { @@ -225,13 +214,6 @@ Config::write () const root->add_child("NumLocalEncodingThreads")->add_child_text (lexical_cast (_num_local_encoding_threads)); root->add_child("DefaultDirectory")->add_child_text (_default_directory); root->add_child("ServerPort")->add_child_text (lexical_cast (_server_port)); - if (_reference_scaler) { - root->add_child("ReferenceScaler")->add_child_text (_reference_scaler->id ()); - } - - for (vector::const_iterator i = _reference_filters.begin(); i != _reference_filters.end(); ++i) { - root->add_child("ReferenceFilter")->add_child_text ((*i)->id ()); - } for (vector::const_iterator i = _servers.begin(); i != _servers.end(); ++i) { (*i)->as_xml (root->add_child ("Server")); @@ -247,8 +229,8 @@ 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_container) { + root->add_child("DefaultContainer")->add_child_text (_default_container->id ()); } if (_default_dcp_content_type) { root->add_child("DefaultDCPContentType")->add_child_text (_default_dcp_content_type->dci_name ());