summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/config.cc14
-rw-r--r--src/lib/config.h79
2 files changed, 60 insertions, 33 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 30f85850d..eda56416d 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -70,6 +70,7 @@ Config::Config ()
)
, _check_for_updates (false)
, _check_for_test_updates (false)
+ , _maximum_j2k_bandwidth (250000000)
{
_allowed_dcp_frame_rates.push_back (24);
_allowed_dcp_frame_rates.push_back (25);
@@ -185,6 +186,8 @@ Config::read ()
_check_for_updates = f.optional_bool_child("CheckForUpdates").get_value_or (false);
_check_for_test_updates = f.optional_bool_child("CheckForTestUpdates").get_value_or (false);
+
+ _maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
}
void
@@ -362,6 +365,8 @@ Config::write () const
root->add_child("CheckForUpdates")->add_child_text (_check_for_updates ? "1" : "0");
root->add_child("CheckForTestUpdates")->add_child_text (_check_for_test_updates ? "1" : "0");
+ root->add_child("MaximumJ2KBandwidth")->add_child_text (lexical_cast<string> (_maximum_j2k_bandwidth));
+
doc.write_to_file_formatted (file(false).string ());
}
@@ -387,3 +392,10 @@ Config::drop ()
delete _instance;
_instance = 0;
}
+
+void
+Config::changed ()
+{
+ write ();
+ Changed ();
+}
diff --git a/src/lib/config.h b/src/lib/config.h
index b9e8d6b02..a40e3680a 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -66,7 +66,7 @@ public:
void set_use_any_servers (bool u) {
_use_any_servers = u;
- write ();
+ changed ();
}
bool use_any_servers () const {
@@ -76,7 +76,7 @@ public:
/** @param s New list of servers */
void set_servers (std::vector<std::string> s) {
_servers = s;
- write ();
+ changed ();
}
/** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
@@ -89,7 +89,7 @@ public:
return _tms_ip;
}
- /** @return The path on a TMS that we should write DCPs to */
+ /** @return The path on a TMS that we should changed DCPs to */
std::string tms_path () const {
return _tms_path;
}
@@ -180,150 +180,162 @@ public:
bool check_for_test_updates () const {
return _check_for_test_updates;
}
+
+ int maximum_j2k_bandwidth () const {
+ return _maximum_j2k_bandwidth;
+ }
/** @param n New number of local encoding threads */
void set_num_local_encoding_threads (int n) {
_num_local_encoding_threads = n;
- write ();
+ changed ();
}
void set_default_directory (boost::filesystem::path d) {
_default_directory = d;
- write ();
+ changed ();
}
/** @param p New server port */
void set_server_port_base (int p) {
_server_port_base = p;
- write ();
+ changed ();
}
/** @param i IP address of a TMS that we can copy DCPs to */
void set_tms_ip (std::string i) {
_tms_ip = i;
- write ();
+ changed ();
}
- /** @param p Path on a TMS that we should write DCPs to */
+ /** @param p Path on a TMS that we should changed DCPs to */
void set_tms_path (std::string p) {
_tms_path = p;
- write ();
+ changed ();
}
/** @param u User name to log into the TMS with */
void set_tms_user (std::string u) {
_tms_user = u;
- write ();
+ changed ();
}
/** @param p Password to log into the TMS with */
void set_tms_password (std::string p) {
_tms_password = p;
- write ();
+ changed ();
}
void add_cinema (boost::shared_ptr<Cinema> c) {
_cinemas.push_back (c);
+ changed ();
}
void remove_cinema (boost::shared_ptr<Cinema> c) {
_cinemas.remove (c);
+ changed ();
}
void set_allowed_dcp_frame_rates (std::list<int> const & r) {
_allowed_dcp_frame_rates = r;
- write ();
+ changed ();
}
void set_default_dci_metadata (DCIMetadata d) {
_default_dci_metadata = d;
- write ();
+ changed ();
}
void set_language (std::string l) {
_language = l;
- write ();
+ changed ();
}
void unset_language () {
_language = boost::none;
- write ();
+ changed ();
}
void set_default_still_length (int s) {
_default_still_length = s;
- write ();
+ changed ();
}
void set_default_container (Ratio const * c) {
_default_container = c;
- write ();
+ changed ();
}
void set_default_dcp_content_type (DCPContentType const * t) {
_default_dcp_content_type = t;
- write ();
+ changed ();
}
void set_dcp_metadata (libdcp::XMLMetadata m) {
_dcp_metadata = m;
- write ();
+ changed ();
}
void set_default_j2k_bandwidth (int b) {
_default_j2k_bandwidth = b;
- write ();
+ changed ();
}
void set_default_audio_delay (int d) {
_default_audio_delay = d;
- write ();
+ changed ();
}
void set_colour_conversions (std::vector<PresetColourConversion> const & c) {
_colour_conversions = c;
- write ();
+ changed ();
}
void set_mail_server (std::string s) {
_mail_server = s;
- write ();
+ changed ();
}
void set_mail_user (std::string u) {
_mail_user = u;
- write ();
+ changed ();
}
void set_mail_password (std::string p) {
_mail_password = p;
- write ();
+ changed ();
}
void set_kdm_from (std::string f) {
_kdm_from = f;
- write ();
+ changed ();
}
void set_kdm_email (std::string e) {
_kdm_email = e;
- write ();
+ changed ();
}
void set_check_for_updates (bool c) {
_check_for_updates = c;
- write ();
+ changed ();
}
void set_check_for_test_updates (bool c) {
_check_for_test_updates = c;
- write ();
+ changed ();
}
-
- void write () const;
+ void set_maximum_j2k_bandwidth (int b) {
+ _maximum_j2k_bandwidth = b;
+ changed ();
+ }
+
boost::filesystem::path signer_chain_directory () const;
+ void changed ();
+ boost::signals2::signal<void ()> Changed;
+
static Config* instance ();
static void drop ();
@@ -332,6 +344,7 @@ private:
boost::filesystem::path file (bool) const;
void read ();
void read_old_metadata ();
+ void write () const;
/** number of threads to use for J2K encoding on the local machine */
int _num_local_encoding_threads;
@@ -375,6 +388,8 @@ private:
/** true to check for updates on startup */
bool _check_for_updates;
bool _check_for_test_updates;
+ /** maximum allowed J2K bandwidth in bits per second */
+ int _maximum_j2k_bandwidth;
/** Singleton instance, or 0 */
static Config* _instance;