Merge master into direct-mxf.
[dcpomatic.git] / src / lib / config.cc
index 7c52dc17047775bc5498f91d2a03d3698147fee0..c165859b01bd25b3d7e1d768c86f8bca71af8c85 100644 (file)
@@ -25,7 +25,6 @@
 #include "config.h"
 #include "server.h"
 #include "scaler.h"
-#include "screen.h"
 #include "filter.h"
 #include "sound_processor.h"
 
@@ -41,12 +40,14 @@ Config* Config::_instance = 0;
 Config::Config ()
        : _num_local_encoding_threads (2)
        , _server_port (6192)
-       , _colour_lut_index (0)
-       , _j2k_bandwidth (250000000)
        , _reference_scaler (Scaler::from_id ("bicubic"))
        , _tms_path (".")
        , _sound_processor (SoundProcessor::from_id ("dolby_cp750"))
 {
+       _allowed_dcp_frame_rates.push_back (24);
+       _allowed_dcp_frame_rates.push_back (25);
+       _allowed_dcp_frame_rates.push_back (30);
+       
        ifstream f (file().c_str ());
        string line;
        while (getline (f, line)) {
@@ -72,18 +73,12 @@ Config::Config ()
                        _default_directory = v;
                } else if (k == "server_port") {
                        _server_port = atoi (v.c_str ());
-               } else if (k == "colour_lut_index") {
-                       _colour_lut_index = atoi (v.c_str ());
-               } else if (k == "j2k_bandwidth") {
-                       _j2k_bandwidth = atoi (v.c_str ());
                } else if (k == "reference_scaler") {
                        _reference_scaler = Scaler::from_id (v);
                } else if (k == "reference_filter") {
                        _reference_filters.push_back (Filter::from_id (v));
                } else if (k == "server") {
                        _servers.push_back (ServerDescription::create_from_metadata (v));
-               } else if (k == "screen") {
-                       _screens.push_back (Screen::create_from_metadata (v));
                } else if (k == "tms_ip") {
                        _tms_ip = v;
                } else if (k == "tms_path") {
@@ -95,6 +90,8 @@ Config::Config ()
                } else if (k == "sound_processor") {
                        _sound_processor = SoundProcessor::from_id (v);
                }
+
+               _default_dci_metadata.read (k, v);
        }
 }
 
@@ -127,8 +124,6 @@ Config::write () const
        f << "num_local_encoding_threads " << _num_local_encoding_threads << "\n"
          << "default_directory " << _default_directory << "\n"
          << "server_port " << _server_port << "\n"
-         << "colour_lut_index " << _colour_lut_index << "\n"
-         << "j2k_bandwidth " << _j2k_bandwidth << "\n"
          << "reference_scaler " << _reference_scaler->id () << "\n";
 
        for (vector<Filter const *>::const_iterator i = _reference_filters.begin(); i != _reference_filters.end(); ++i) {
@@ -139,15 +134,13 @@ Config::write () const
                f << "server " << (*i)->as_metadata () << "\n";
        }
 
-       for (vector<shared_ptr<Screen> >::const_iterator i = _screens.begin(); i != _screens.end(); ++i) {
-               f << "screen " << (*i)->as_metadata () << "\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";
-       f << "sound_processor " << _sound_processor->id ();
+       f << "sound_processor " << _sound_processor->id () << "\n";
+
+       _default_dci_metadata.write (f);
 }
 
 string