2 Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 /** @file src/config.h
22 * @brief Class holding configuration.
25 #ifndef DCPOMATIC_CONFIG_H
26 #define DCPOMATIC_CONFIG_H
28 #include "isdcf_metadata.h"
32 #include <dcp/name_format.h>
33 #include <dcp/certificate_chain.h>
34 #include <dcp/encrypted_kdm.h>
35 #include <boost/shared_ptr.hpp>
36 #include <boost/signals2.hpp>
37 #include <boost/filesystem.hpp>
40 class CinemaSoundProcessor;
48 * @brief A singleton class holding configuration.
50 class Config : public State
53 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
54 int master_encoding_threads () const {
55 return _master_encoding_threads;
58 /** @return number of threads which a server should use for J2K encoding on the local machine */
59 int server_encoding_threads () const {
60 return _server_encoding_threads;
63 boost::optional<boost::filesystem::path> default_directory () const {
64 return _default_directory;
67 boost::optional<boost::filesystem::path> default_kdm_directory () const {
68 return _default_kdm_directory;
71 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
72 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
81 PLAYER_CONTENT_DIRECTORY,
82 PLAYER_PLAYLIST_DIRECTORY,
85 #ifdef DCPOMATIC_VARIANT_SWAROOP
86 PLAYER_BACKGROUND_IMAGE,
91 /** @return base port number to use for J2K encoding servers */
92 int server_port_base () const {
93 return _server_port_base;
96 void set_use_any_servers (bool u) {
98 changed (USE_ANY_SERVERS);
101 bool use_any_servers () const {
102 return _use_any_servers;
105 /** @param s New list of servers */
106 void set_servers (std::vector<std::string> s) {
111 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
112 std::vector<std::string> servers () const {
116 bool only_servers_encode () const {
117 return _only_servers_encode;
120 FileTransferProtocol tms_protocol () const {
121 return _tms_protocol;
124 /** @return The IP address of a TMS that we can copy DCPs to */
125 std::string tms_ip () const {
129 /** @return The path on a TMS that we should changed DCPs to */
130 std::string tms_path () const {
134 /** @return User name to log into the TMS with */
135 std::string tms_user () const {
139 /** @return Password to log into the TMS with */
140 std::string tms_password () const {
141 return _tms_password;
144 /** @return The cinema sound processor that we are using */
145 CinemaSoundProcessor const * cinema_sound_processor () const {
146 return _cinema_sound_processor;
149 std::list<boost::shared_ptr<Cinema> > cinemas () const {
153 std::list<int> allowed_dcp_frame_rates () const {
154 return _allowed_dcp_frame_rates;
157 bool allow_any_dcp_frame_rate () const {
158 return _allow_any_dcp_frame_rate;
161 bool allow_any_container () const {
162 return _allow_any_container;
165 ISDCFMetadata default_isdcf_metadata () const {
166 return _default_isdcf_metadata;
169 boost::optional<std::string> language () const {
173 int default_still_length () const {
174 return _default_still_length;
177 Ratio const * default_container () const {
178 return _default_container;
181 Ratio const * default_scale_to () const {
182 return _default_scale_to;
185 DCPContentType const * default_dcp_content_type () const {
186 return _default_dcp_content_type;
189 int default_dcp_audio_channels () const {
190 return _default_dcp_audio_channels;
193 std::string dcp_issuer () const {
197 std::string dcp_creator () const {
201 int default_j2k_bandwidth () const {
202 return _default_j2k_bandwidth;
205 int default_audio_delay () const {
206 return _default_audio_delay;
209 bool default_interop () const {
210 return _default_interop;
213 bool default_upload_after_make_dcp () {
214 return _default_upload_after_make_dcp;
217 void set_default_kdm_directory (boost::filesystem::path d) {
218 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
221 _default_kdm_directory = d;
225 std::string mail_server () const {
229 int mail_port () const {
233 EmailProtocol mail_protocol () const {
234 return _mail_protocol;
237 std::string mail_user () const {
241 std::string mail_password () const {
242 return _mail_password;
245 std::string kdm_subject () const {
249 std::string kdm_from () const {
253 std::vector<std::string> kdm_cc () const {
257 std::string kdm_bcc () const {
261 std::string kdm_email () const {
265 std::string notification_subject () const {
266 return _notification_subject;
269 std::string notification_from () const {
270 return _notification_from;
273 std::string notification_to () const {
274 return _notification_to;
277 std::vector<std::string> notification_cc () const {
278 return _notification_cc;
281 std::string notification_bcc () const {
282 return _notification_bcc;
285 std::string notification_email () const {
286 return _notification_email;
289 boost::shared_ptr<const dcp::CertificateChain> signer_chain () const {
290 return _signer_chain;
293 boost::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
294 return _decryption_chain;
297 bool check_for_updates () const {
298 return _check_for_updates;
301 bool check_for_test_updates () const {
302 return _check_for_test_updates;
305 int maximum_j2k_bandwidth () const {
306 return _maximum_j2k_bandwidth;
309 int log_types () const {
313 bool analyse_ebur128 () const {
314 return _analyse_ebur128;
317 bool automatic_audio_analysis () const {
318 return _automatic_audio_analysis;
321 #ifdef DCPOMATIC_WINDOWS
322 bool win32_console () const {
323 return _win32_console;
327 std::vector<boost::filesystem::path> history () const {
331 std::vector<boost::filesystem::path> player_history () const {
332 return _player_history;
335 boost::shared_ptr<DKDMGroup> dkdms () const {
339 boost::filesystem::path cinemas_file () const {
340 return _cinemas_file;
343 bool show_hints_before_make_dcp () const {
344 return _show_hints_before_make_dcp;
347 bool confirm_kdm_email () const {
348 return _confirm_kdm_email;
351 dcp::NameFormat kdm_container_name_format () const {
352 return _kdm_container_name_format;
355 dcp::NameFormat kdm_filename_format () const {
356 return _kdm_filename_format;
359 dcp::NameFormat dcp_metadata_filename_format () const {
360 return _dcp_metadata_filename_format;
363 dcp::NameFormat dcp_asset_filename_format () const {
364 return _dcp_asset_filename_format;
367 bool jump_to_selected () const {
368 return _jump_to_selected;
373 NAG_ENCRYPTED_METADATA,
374 NAG_ALTER_DECRYPTION_CHAIN,
375 NAG_BAD_SIGNER_CHAIN,
376 /* Not really a nag but it's the same idea */
378 NAG_IMPORT_DECRYPTION_CHAIN,
383 bool nagged (Nag nag) const {
387 bool sound () const {
391 std::string cover_sheet () const {
395 boost::optional<std::string> sound_output () const {
396 return _sound_output;
399 boost::optional<boost::filesystem::path> last_player_load_directory () const {
400 return _last_player_load_directory;
409 boost::optional<KDMWriteType> last_kdm_write_type () const {
410 return _last_kdm_write_type;
418 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
419 return _last_dkdm_write_type;
422 int frames_in_memory_multiplier () const {
423 return _frames_in_memory_multiplier;
426 boost::optional<int> decode_reduction () const {
427 return _decode_reduction;
430 bool default_notify () const {
431 return _default_notify;
440 bool notification (Notification n) const {
441 return _notification[n];
444 boost::optional<std::string> barco_username () const {
445 return _barco_username;
448 boost::optional<std::string> barco_password () const {
449 return _barco_password;
452 boost::optional<std::string> christie_username () const {
453 return _christie_username;
456 boost::optional<std::string> christie_password () const {
457 return _christie_password;
460 boost::optional<std::string> gdc_username () const {
461 return _gdc_username;
464 boost::optional<std::string> gdc_password () const {
465 return _gdc_password;
473 Interface interface_complexity () const {
474 return _interface_complexity;
483 PlayerMode player_mode () const {
487 int image_display () const {
488 return _image_display;
496 VideoViewType video_view_type () const {
497 return _video_view_type;
500 bool respect_kdm_validity_periods () const {
501 return _respect_kdm_validity_periods;
504 boost::optional<boost::filesystem::path> player_activity_log_file () const {
505 return _player_activity_log_file;
508 boost::optional<boost::filesystem::path> player_debug_log_file () const {
509 return _player_debug_log_file;
512 boost::optional<boost::filesystem::path> player_content_directory () const {
513 return _player_content_directory;
516 boost::optional<boost::filesystem::path> player_playlist_directory () const {
517 return _player_playlist_directory;
520 boost::optional<boost::filesystem::path> player_kdm_directory () const {
521 return _player_kdm_directory;
524 #ifdef DCPOMATIC_VARIANT_SWAROOP
525 boost::optional<boost::filesystem::path> player_background_image () const {
526 return _player_background_image;
529 std::string kdm_server_url () const {
530 return _kdm_server_url;
533 std::string player_watermark_theatre () const {
534 return _player_watermark_theatre;
537 int player_watermark_period () const {
538 return _player_watermark_period;
541 int player_watermark_duration () const {
542 return _player_watermark_duration;
545 std::vector<Monitor> required_monitors () const {
546 return _required_monitors;
549 boost::optional<boost::filesystem::path> player_lock_file () const {
550 return _player_lock_file;
556 void set_master_encoding_threads (int n) {
557 maybe_set (_master_encoding_threads, n);
560 void set_server_encoding_threads (int n) {
561 maybe_set (_server_encoding_threads, n);
564 void set_default_directory (boost::filesystem::path d) {
565 if (_default_directory && *_default_directory == d) {
568 _default_directory = d;
572 /** @param p New server port */
573 void set_server_port_base (int p) {
574 maybe_set (_server_port_base, p);
577 void set_only_servers_encode (bool o) {
578 maybe_set (_only_servers_encode, o);
581 void set_tms_protocol (FileTransferProtocol p) {
582 maybe_set (_tms_protocol, p);
585 /** @param i IP address of a TMS that we can copy DCPs to */
586 void set_tms_ip (std::string i) {
587 maybe_set (_tms_ip, i);
590 /** @param p Path on a TMS that we should changed DCPs to */
591 void set_tms_path (std::string p) {
592 maybe_set (_tms_path, p);
595 /** @param u User name to log into the TMS with */
596 void set_tms_user (std::string u) {
597 maybe_set (_tms_user, u);
600 /** @param p Password to log into the TMS with */
601 void set_tms_password (std::string p) {
602 maybe_set (_tms_password, p);
605 void add_cinema (boost::shared_ptr<Cinema> c) {
606 _cinemas.push_back (c);
610 void remove_cinema (boost::shared_ptr<Cinema> c) {
615 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
616 maybe_set (_allowed_dcp_frame_rates, r);
619 void set_allow_any_dcp_frame_rate (bool a) {
620 maybe_set (_allow_any_dcp_frame_rate, a);
623 void set_allow_any_container (bool a) {
624 maybe_set (_allow_any_container, a);
627 void set_default_isdcf_metadata (ISDCFMetadata d) {
628 maybe_set (_default_isdcf_metadata, d);
631 void set_language (std::string l) {
632 if (_language && _language.get() == l) {
639 void unset_language () {
644 _language = boost::none;
648 void set_default_still_length (int s) {
649 maybe_set (_default_still_length, s);
652 void set_default_container (Ratio const * c) {
653 maybe_set (_default_container, c);
656 void set_default_scale_to (Ratio const * c) {
657 maybe_set (_default_scale_to, c);
660 void set_default_dcp_content_type (DCPContentType const * t) {
661 maybe_set (_default_dcp_content_type, t);
664 void set_default_dcp_audio_channels (int c) {
665 maybe_set (_default_dcp_audio_channels, c);
668 void set_dcp_issuer (std::string i) {
669 maybe_set (_dcp_issuer, i);
672 void set_dcp_creator (std::string c) {
673 maybe_set (_dcp_creator, c);
676 void set_default_j2k_bandwidth (int b) {
677 maybe_set (_default_j2k_bandwidth, b);
680 void set_default_audio_delay (int d) {
681 maybe_set (_default_audio_delay, d);
684 void set_default_interop (bool i) {
685 maybe_set (_default_interop, i);
688 void set_default_upload_after_make_dcp (bool u) {
689 maybe_set (_default_upload_after_make_dcp, u);
692 void set_mail_server (std::string s) {
693 maybe_set (_mail_server, s);
696 void set_mail_port (int p) {
697 maybe_set (_mail_port, p);
700 void set_mail_protocol (EmailProtocol p) {
701 maybe_set (_mail_protocol, p);
704 void set_mail_user (std::string u) {
705 maybe_set (_mail_user, u);
708 void set_mail_password (std::string p) {
709 maybe_set (_mail_password, p);
712 void set_kdm_subject (std::string s) {
713 maybe_set (_kdm_subject, s);
716 void set_kdm_from (std::string f) {
717 maybe_set (_kdm_from, f);
720 void set_kdm_cc (std::vector<std::string> f) {
721 maybe_set (_kdm_cc, f);
724 void set_kdm_bcc (std::string f) {
725 maybe_set (_kdm_bcc, f);
728 void set_kdm_email (std::string e) {
729 maybe_set (_kdm_email, e);
732 void reset_kdm_email ();
734 void set_notification_subject (std::string s) {
735 maybe_set (_notification_subject, s);
738 void set_notification_from (std::string f) {
739 maybe_set (_notification_from, f);
742 void set_notification_to (std::string t) {
743 maybe_set (_notification_to, t);
746 void set_notification_cc (std::vector<std::string> f) {
747 maybe_set (_notification_cc, f);
750 void set_notification_bcc (std::string f) {
751 maybe_set (_notification_bcc, f);
754 void set_notification_email (std::string e) {
755 maybe_set (_notification_email, e);
758 void reset_notification_email ();
760 void set_signer_chain (boost::shared_ptr<const dcp::CertificateChain> s) {
761 maybe_set (_signer_chain, s);
764 void set_decryption_chain (boost::shared_ptr<const dcp::CertificateChain> c) {
765 maybe_set (_decryption_chain, c);
768 void set_check_for_updates (bool c) {
769 maybe_set (_check_for_updates, c);
771 set_check_for_test_updates (false);
775 void set_check_for_test_updates (bool c) {
776 maybe_set (_check_for_test_updates, c);
779 void set_maximum_j2k_bandwidth (int b) {
780 maybe_set (_maximum_j2k_bandwidth, b);
783 void set_log_types (int t) {
784 maybe_set (_log_types, t);
787 void set_analyse_ebur128 (bool a) {
788 maybe_set (_analyse_ebur128, a);
791 void set_automatic_audio_analysis (bool a) {
792 maybe_set (_automatic_audio_analysis, a);
795 #ifdef DCPOMATIC_WINDOWS
796 void set_win32_console (bool c) {
797 maybe_set (_win32_console, c);
801 void set_dkdms (boost::shared_ptr<DKDMGroup> dkdms) {
806 void set_cinemas_file (boost::filesystem::path file);
808 void set_show_hints_before_make_dcp (bool s) {
809 maybe_set (_show_hints_before_make_dcp, s);
812 void set_confirm_kdm_email (bool s) {
813 maybe_set (_confirm_kdm_email, s);
816 void set_sound (bool s) {
817 maybe_set (_sound, s, SOUND);
820 void set_sound_output (std::string o) {
821 maybe_set (_sound_output, o, SOUND_OUTPUT);
824 void set_last_player_load_directory (boost::filesystem::path d) {
825 maybe_set (_last_player_load_directory, d);
828 void set_last_kdm_write_type (KDMWriteType t) {
829 maybe_set (_last_kdm_write_type, t);
832 void set_last_dkdm_write_type (DKDMWriteType t) {
833 maybe_set (_last_dkdm_write_type, t);
836 void unset_sound_output () {
837 if (!_sound_output) {
841 _sound_output = boost::none;
845 void set_kdm_container_name_format (dcp::NameFormat n) {
846 maybe_set (_kdm_container_name_format, n);
849 void set_kdm_filename_format (dcp::NameFormat n) {
850 maybe_set (_kdm_filename_format, n);
853 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
854 maybe_set (_dcp_metadata_filename_format, n);
857 void set_dcp_asset_filename_format (dcp::NameFormat n) {
858 maybe_set (_dcp_asset_filename_format, n);
861 void set_frames_in_memory_multiplier (int m) {
862 maybe_set (_frames_in_memory_multiplier, m);
865 void set_decode_reduction (boost::optional<int> r) {
866 maybe_set (_decode_reduction, r);
869 void set_default_notify (bool n) {
870 maybe_set (_default_notify, n);
873 void clear_history () {
878 void clear_player_history () {
879 _player_history.clear ();
883 void add_to_history (boost::filesystem::path p);
884 void clean_history ();
885 void add_to_player_history (boost::filesystem::path p);
886 void clean_player_history ();
888 void set_jump_to_selected (bool j) {
889 maybe_set (_jump_to_selected, j);
892 void set_nagged (Nag nag, bool nagged) {
893 maybe_set (_nagged[nag], nagged);
896 void set_cover_sheet (std::string s) {
897 maybe_set (_cover_sheet, s);
900 void reset_cover_sheet ();
902 void set_notification (Notification n, bool v) {
903 maybe_set (_notification[n], v);
906 void set_barco_username (std::string u) {
907 maybe_set (_barco_username, u);
910 void unset_barco_username () {
911 maybe_set (_barco_username, boost::optional<std::string>());
914 void set_barco_password (std::string p) {
915 maybe_set (_barco_password, p);
918 void unset_barco_password () {
919 maybe_set (_barco_password, boost::optional<std::string>());
922 void set_christie_username (std::string u) {
923 maybe_set (_christie_username, u);
926 void unset_christie_username () {
927 maybe_set (_christie_username, boost::optional<std::string>());
930 void set_christie_password (std::string p) {
931 maybe_set (_christie_password, p);
934 void unset_christie_password () {
935 maybe_set (_christie_password, boost::optional<std::string>());
938 void set_gdc_username (std::string u) {
939 maybe_set (_gdc_username, u);
942 void unset_gdc_username () {
943 maybe_set (_gdc_username, boost::optional<std::string>());
946 void set_gdc_password (std::string p) {
947 maybe_set (_gdc_password, p);
950 void unset_gdc_password () {
951 maybe_set (_gdc_password, boost::optional<std::string>());
954 void set_interface_complexity (Interface i) {
955 maybe_set (_interface_complexity, i, INTERFACE_COMPLEXITY);
958 void set_player_mode (PlayerMode m) {
959 maybe_set (_player_mode, m);
962 void set_image_display (int n) {
963 maybe_set (_image_display, n);
966 void set_video_view_type (VideoViewType v) {
967 maybe_set (_video_view_type, v);
970 void set_respect_kdm_validity_periods (bool r) {
971 maybe_set (_respect_kdm_validity_periods, r);
974 void set_player_activity_log_file (boost::filesystem::path p) {
975 maybe_set (_player_activity_log_file, p);
978 void unset_player_activity_log_file () {
979 if (!_player_activity_log_file) {
982 _player_activity_log_file = boost::none;
986 void set_player_debug_log_file (boost::filesystem::path p) {
987 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
990 void unset_player_debug_log_file () {
991 if (!_player_debug_log_file) {
994 _player_debug_log_file = boost::none;
995 changed (PLAYER_DEBUG_LOG);
998 void set_player_content_directory (boost::filesystem::path p) {
999 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1002 void unset_player_content_directory () {
1003 if (!_player_content_directory) {
1006 _player_content_directory = boost::none;
1007 changed (PLAYER_CONTENT_DIRECTORY);
1010 void set_player_playlist_directory (boost::filesystem::path p) {
1011 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1014 void unset_player_playlist_directory () {
1015 if (!_player_playlist_directory) {
1018 _player_playlist_directory = boost::none;
1019 changed (PLAYER_PLAYLIST_DIRECTORY);
1022 void set_player_kdm_directory (boost::filesystem::path p) {
1023 maybe_set (_player_kdm_directory, p);
1026 void unset_player_kdm_directory () {
1027 if (!_player_kdm_directory) {
1030 _player_kdm_directory = boost::none;
1034 #ifdef DCPOMATIC_VARIANT_SWAROOP
1035 void set_player_background_image (boost::filesystem::path p) {
1036 maybe_set (_player_background_image, p, PLAYER_BACKGROUND_IMAGE);
1039 void unset_player_background_image () {
1040 if (!_player_background_image) {
1043 _player_background_image = boost::none;
1044 changed (PLAYER_BACKGROUND_IMAGE);
1047 void set_kdm_server_url (std::string s) {
1048 maybe_set (_kdm_server_url, s);
1051 void set_player_watermark_theatre (std::string p) {
1052 maybe_set (_player_watermark_theatre, p);
1055 void set_player_watermark_period (int minutes) {
1056 maybe_set (_player_watermark_period, minutes);
1059 void set_player_watermark_duration (int milliseconds) {
1060 maybe_set (_player_watermark_duration, milliseconds);
1063 void set_required_monitors (std::vector<Monitor> monitors) {
1064 maybe_set (_required_monitors, monitors);
1067 void set_player_lock_file (boost::filesystem::path p) {
1068 maybe_set (_player_lock_file, p);
1071 void unset_player_lock_file () {
1072 if (!_player_lock_file) {
1075 _player_lock_file = boost::none;
1080 void changed (Property p = OTHER);
1081 boost::signals2::signal<void (Property)> Changed;
1082 /** Emitted if read() failed on an existing Config file. There is nothing
1083 a listener can do about it: this is just for information.
1085 static boost::signals2::signal<void ()> FailedToLoad;
1086 /** Emitted if read() issued a warning which the user might want to know about */
1087 static boost::signals2::signal<void (std::string)> Warning;
1088 /** Emitted if there is a something wrong the contents of our config. Handler can call
1089 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1092 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1093 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1094 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1097 static boost::signals2::signal<bool (BadReason)> Bad;
1099 void write () const;
1100 void write_config () const;
1101 void write_cinemas () const;
1102 void link (boost::filesystem::path new_file) const;
1103 void copy_and_link (boost::filesystem::path new_file) const;
1104 bool have_write_permission () const;
1106 void save_template (boost::shared_ptr<const Film> film, std::string name) const;
1107 bool existing_template (std::string name) const;
1108 std::list<std::string> templates () const;
1109 boost::filesystem::path template_path (std::string name) const;
1110 void rename_template (std::string old_name, std::string new_name) const;
1111 void delete_template (std::string name) const;
1113 static Config* instance ();
1114 static void drop ();
1115 static void restore_defaults ();
1116 static bool have_existing (std::string);
1117 static boost::filesystem::path config_file ();
1122 void set_defaults ();
1123 void set_kdm_email_to_default ();
1124 void set_notification_email_to_default ();
1125 void set_cover_sheet_to_default ();
1126 void read_cinemas (cxml::Document const & f);
1127 boost::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1128 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1129 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1130 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1134 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1135 if (member == new_value) {
1143 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1144 if (member && member.get() == new_value) {
1151 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1152 int _master_encoding_threads;
1153 /** number of threads which a server should use for J2K encoding on the local machine */
1154 int _server_encoding_threads;
1155 /** default directory to put new films in */
1156 boost::optional<boost::filesystem::path> _default_directory;
1157 /** base port number to use for J2K encoding servers;
1158 * this port and the two above it will be used.
1160 int _server_port_base;
1161 /** true to broadcast on the `any' address to look for servers */
1162 bool _use_any_servers;
1163 /** J2K encoding servers that should definitely be used */
1164 std::vector<std::string> _servers;
1165 bool _only_servers_encode;
1166 FileTransferProtocol _tms_protocol;
1167 /** The IP address of a TMS that we can copy DCPs to */
1168 std::string _tms_ip;
1169 /** The path on a TMS that we should write DCPs to */
1170 std::string _tms_path;
1171 /** User name to log into the TMS with */
1172 std::string _tms_user;
1173 /** Password to log into the TMS with */
1174 std::string _tms_password;
1175 /** Our cinema sound processor */
1176 CinemaSoundProcessor const * _cinema_sound_processor;
1177 /** The list of possible DCP frame rates that DCP-o-matic will use */
1178 std::list<int> _allowed_dcp_frame_rates;
1179 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1180 bool _allow_any_dcp_frame_rate;
1181 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1182 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1183 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1185 bool _allow_any_container;
1186 /** Default ISDCF metadata for newly-created Films */
1187 ISDCFMetadata _default_isdcf_metadata;
1188 boost::optional<std::string> _language;
1189 /** Default length of still image content (seconds) */
1190 int _default_still_length;
1191 Ratio const * _default_container;
1192 Ratio const * _default_scale_to;
1193 DCPContentType const * _default_dcp_content_type;
1194 int _default_dcp_audio_channels;
1195 std::string _dcp_issuer;
1196 std::string _dcp_creator;
1197 int _default_j2k_bandwidth;
1198 int _default_audio_delay;
1199 bool _default_interop;
1200 /** Default directory to offer to write KDMs to; if it's not set,
1201 the home directory will be offered.
1203 boost::optional<boost::filesystem::path> _default_kdm_directory;
1204 bool _default_upload_after_make_dcp;
1205 std::list<boost::shared_ptr<Cinema> > _cinemas;
1206 std::string _mail_server;
1208 EmailProtocol _mail_protocol;
1209 std::string _mail_user;
1210 std::string _mail_password;
1211 std::string _kdm_subject;
1212 std::string _kdm_from;
1213 std::vector<std::string> _kdm_cc;
1214 std::string _kdm_bcc;
1215 std::string _kdm_email;
1216 std::string _notification_subject;
1217 std::string _notification_from;
1218 std::string _notification_to;
1219 std::vector<std::string> _notification_cc;
1220 std::string _notification_bcc;
1221 std::string _notification_email;
1222 boost::shared_ptr<const dcp::CertificateChain> _signer_chain;
1223 #ifdef DCPOMATIC_VARIANT_SWAROOP
1224 boost::filesystem::path _signer_chain_path;
1226 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1227 * certificate for making KDMs given to DCP-o-matic.
1229 boost::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1230 #ifdef DCPOMATIC_VARIANT_SWAROOP
1231 boost::filesystem::path _decryption_chain_path;
1233 /** true to check for updates on startup */
1234 bool _check_for_updates;
1235 bool _check_for_test_updates;
1236 /** maximum allowed J2K bandwidth in bits per second */
1237 int _maximum_j2k_bandwidth;
1239 bool _analyse_ebur128;
1240 bool _automatic_audio_analysis;
1241 #ifdef DCPOMATIC_WINDOWS
1242 bool _win32_console;
1244 std::vector<boost::filesystem::path> _history;
1245 std::vector<boost::filesystem::path> _player_history;
1246 boost::shared_ptr<DKDMGroup> _dkdms;
1247 boost::filesystem::path _cinemas_file;
1248 bool _show_hints_before_make_dcp;
1249 bool _confirm_kdm_email;
1250 dcp::NameFormat _kdm_filename_format;
1251 dcp::NameFormat _kdm_container_name_format;
1252 dcp::NameFormat _dcp_metadata_filename_format;
1253 dcp::NameFormat _dcp_asset_filename_format;
1254 bool _jump_to_selected;
1255 bool _nagged[NAG_COUNT];
1257 /** name of a specific sound output stream to use, or empty to use the default */
1258 boost::optional<std::string> _sound_output;
1259 std::string _cover_sheet;
1260 boost::optional<boost::filesystem::path> _last_player_load_directory;
1261 boost::optional<KDMWriteType> _last_kdm_write_type;
1262 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1263 int _frames_in_memory_multiplier;
1264 boost::optional<int> _decode_reduction;
1265 bool _default_notify;
1266 bool _notification[NOTIFICATION_COUNT];
1267 boost::optional<std::string> _barco_username;
1268 boost::optional<std::string> _barco_password;
1269 boost::optional<std::string> _christie_username;
1270 boost::optional<std::string> _christie_password;
1271 boost::optional<std::string> _gdc_username;
1272 boost::optional<std::string> _gdc_password;
1273 Interface _interface_complexity;
1274 PlayerMode _player_mode;
1276 VideoViewType _video_view_type;
1277 bool _respect_kdm_validity_periods;
1278 /** Log file containing things the player does (e.g. started, stopped, loaded
1279 playlist etc.) Does not contain debugging information.
1281 boost::optional<boost::filesystem::path> _player_activity_log_file;
1282 /** Log file containing debug information for the player */
1283 boost::optional<boost::filesystem::path> _player_debug_log_file;
1284 /** A directory containing DCPs whose contents are presented to the user
1285 in the dual-screen player mode. DCPs on the list can be loaded
1288 boost::optional<boost::filesystem::path> _player_content_directory;
1289 boost::optional<boost::filesystem::path> _player_playlist_directory;
1290 boost::optional<boost::filesystem::path> _player_kdm_directory;
1291 #ifdef DCPOMATIC_VARIANT_SWAROOP
1292 boost::optional<boost::filesystem::path> _player_background_image;
1293 std::string _kdm_server_url;
1294 std::string _player_watermark_theatre;
1295 /** watermark period in minutes */
1296 int _player_watermark_period;
1297 /** watermark duration in milliseconds */
1298 int _player_watermark_duration;
1299 std::vector<Monitor> _required_monitors;
1300 /** a file which, if specified, must be present for the player to work */
1301 boost::optional<boost::filesystem::path> _player_lock_file;
1304 static int const _current_version;
1306 /** Singleton instance, or 0 */
1307 static Config* _instance;