+
+ _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));
+
+ reset_kdm_email ();
+}
+
+void
+Config::read ()
+{
+ if (!boost::filesystem::exists (file (false))) {
+ read_old_metadata ();
+ return;
+ }
+
+ cxml::Document f ("Config");
+ f.read_file (file (false));
+ optional<string> c;
+
+ optional<int> version = f.optional_number_child<int> ("Version");
+
+ _num_local_encoding_threads = f.number_child<int> ("NumLocalEncodingThreads");
+ _default_directory = f.string_child ("DefaultDirectory");
+
+ boost::optional<int> b = f.optional_number_child<int> ("ServerPort");
+ if (!b) {
+ b = f.optional_number_child<int> ("ServerPortBase");
+ }
+ _server_port_base = b.get ();
+
+ boost::optional<bool> u = f.optional_bool_child ("UseAnyServers");
+ _use_any_servers = u.get_value_or (true);
+
+ list<cxml::NodePtr> servers = f.node_children ("Server");
+ for (list<cxml::NodePtr>::iterator i = servers.begin(); i != servers.end(); ++i) {
+ if ((*i)->node_children("HostName").size() == 1) {
+ _servers.push_back ((*i)->string_child ("HostName"));
+ } else {
+ _servers.push_back ((*i)->content ());
+ }
+ }
+
+ _tms_ip = f.string_child ("TMSIP");
+ _tms_path = f.string_child ("TMSPath");
+ _tms_user = f.string_child ("TMSUser");
+ _tms_password = f.string_child ("TMSPassword");
+
+ c = f.optional_string_child ("SoundProcessor");
+ if (c) {
+ _sound_processor = SoundProcessor::from_id (c.get ());
+ }
+
+ _language = f.optional_string_child ("Language");
+
+ c = f.optional_string_child ("DefaultScale");
+ if (c) {
+ _default_scale = Ratio::from_id (c.get ());
+ }
+
+ c = f.optional_string_child ("DefaultContainer");
+ if (c) {
+ _default_container = Ratio::from_id (c.get ());
+ }
+
+ c = f.optional_string_child ("DefaultDCPContentType");
+ if (c) {
+ _default_dcp_content_type = DCPContentType::from_isdcf_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 ("");
+
+ if (version && version.get() >= 2) {
+ _default_isdcf_metadata = ISDCFMetadata (f.node_child ("ISDCFMetadata"));
+ } else {
+ _default_isdcf_metadata = ISDCFMetadata (f.node_child ("DCIMetadata"));
+ }
+
+ _default_still_length = f.optional_number_child<int>("DefaultStillLength").get_value_or (10);
+ _default_j2k_bandwidth = f.optional_number_child<int>("DefaultJ2KBandwidth").get_value_or (200000000);
+ _default_audio_delay = f.optional_number_child<int>("DefaultAudioDelay").get_value_or (0);
+
+ list<cxml::NodePtr> cc = f.node_children ("ColourConversion");
+
+ if (!cc.empty ()) {
+ _colour_conversions.clear ();
+ }