diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-08-19 00:21:43 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-08-19 00:21:43 +0100 |
| commit | c450fb19ea21dba0a6cade81e829262e7078e9df (patch) | |
| tree | c6876bb2b4d4ac52223848dc47b58f75dbe49744 /src/lib | |
| parent | be0899b93837bf8929282d85aa90f5390ba17755 (diff) | |
Add only-servers-encode option for debugging / optimisation / testing of servers.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 3 | ||||
| -rw-r--r-- | src/lib/config.h | 9 | ||||
| -rw-r--r-- | src/lib/encoder.cc | 6 | ||||
| -rw-r--r-- | src/lib/film.cc | 6 |
4 files changed, 21 insertions, 3 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 5f59d8e6c..211637ede 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -69,6 +69,7 @@ Config::set_defaults () _server_port_base = 6192; _use_any_servers = true; _servers.clear (); + _only_servers_encode = false; _tms_protocol = PROTOCOL_SCP; _tms_ip = ""; _tms_path = "."; @@ -155,6 +156,7 @@ Config::read () } } + _only_servers_encode = f.optional_bool_child ("OnlyServersEncode").get_value_or (false); _tms_protocol = static_cast<Protocol> (f.optional_number_child<int> ("TMSProtocol").get_value_or (static_cast<int> (PROTOCOL_SCP))); _tms_ip = f.string_child ("TMSIP"); _tms_path = f.string_child ("TMSPath"); @@ -322,6 +324,7 @@ Config::write () const root->add_child("Server")->add_child_text (*i); } + root->add_child("OnlyServersEncode")->add_child_text (_only_servers_encode ? "1" : "0"); root->add_child("TMSProtocol")->add_child_text (raw_convert<string> (_tms_protocol)); root->add_child("TMSIP")->add_child_text (_tms_ip); root->add_child("TMSPath")->add_child_text (_tms_path); diff --git a/src/lib/config.h b/src/lib/config.h index 40b655342..0839ea994 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -90,6 +90,10 @@ public: return _servers; } + bool only_servers_encode () const { + return _only_servers_encode; + } + Protocol tms_protocol () const { return _tms_protocol; } @@ -251,6 +255,10 @@ public: maybe_set (_server_port_base, p); } + void set_only_servers_encode (bool o) { + maybe_set (_only_servers_encode, o); + } + void set_tms_protocol (Protocol p) { maybe_set (_tms_protocol, p); } @@ -455,6 +463,7 @@ private: bool _use_any_servers; /** J2K encoding servers that should definitely be used */ std::vector<std::string> _servers; + bool _only_servers_encode; Protocol _tms_protocol; /** The IP address of a TMS that we can copy DCPs to */ std::string _tms_ip; diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc index 09788d3fa..917f313a2 100644 --- a/src/lib/encoder.cc +++ b/src/lib/encoder.cc @@ -89,8 +89,10 @@ Encoder::add_worker_threads (ServerDescription d) void Encoder::begin () { - for (int i = 0; i < Config::instance()->num_local_encoding_threads (); ++i) { - _threads.push_back (new boost::thread (boost::bind (&Encoder::encoder_thread, this, optional<ServerDescription> ()))); + if (!Config::instance()->only_servers_encode ()) { + for (int i = 0; i < Config::instance()->num_local_encoding_threads (); ++i) { + _threads.push_back (new boost::thread (boost::bind (&Encoder::encoder_thread, this, optional<ServerDescription> ()))); + } } _writer->set_encoder_threads (_threads.size ()); diff --git a/src/lib/film.cc b/src/lib/film.cc index 9066b7c5a..8cd9f9548 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -266,7 +266,11 @@ Film::make_dcp () LOG_GENERAL ("Content: %1", i->technical_summary()); } LOG_GENERAL ("DCP video rate %1 fps", video_frame_rate()); - LOG_GENERAL ("%1 threads", Config::instance()->num_local_encoding_threads()); + if (Config::instance()->only_servers_encode ()) { + LOG_GENERAL_NC ("0 threads: ONLY SERVERS SET TO ENCODE"); + } else { + LOG_GENERAL ("%1 threads", Config::instance()->num_local_encoding_threads()); + } LOG_GENERAL ("J2K bandwidth %1", j2k_bandwidth()); if (container() == 0) { |
