2 Copyright (C) 2012-2020 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 "audio_mapping.h"
33 #include <dcp/name_format.h>
34 #include <dcp/certificate_chain.h>
35 #include <dcp/encrypted_kdm.h>
36 #include <boost/shared_ptr.hpp>
37 #include <boost/signals2.hpp>
38 #include <boost/filesystem.hpp>
41 class CinemaSoundProcessor;
50 * @brief A singleton class holding configuration.
52 class Config : public State
55 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
56 int master_encoding_threads () const {
57 return _master_encoding_threads;
60 /** @return number of threads which a server should use for J2K encoding on the local machine */
61 int server_encoding_threads () const {
62 return _server_encoding_threads;
65 boost::optional<boost::filesystem::path> default_directory () const {
66 return _default_directory;
69 boost::optional<boost::filesystem::path> default_kdm_directory () const {
70 return _default_kdm_directory;
73 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
74 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
83 PLAYER_CONTENT_DIRECTORY,
84 PLAYER_PLAYLIST_DIRECTORY,
87 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
92 /** @return base port number to use for J2K encoding servers */
93 int server_port_base () const {
94 return _server_port_base;
97 void set_use_any_servers (bool u) {
99 changed (USE_ANY_SERVERS);
102 bool use_any_servers () const {
103 return _use_any_servers;
106 /** @param s New list of servers */
107 void set_servers (std::vector<std::string> s) {
112 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
113 std::vector<std::string> servers () const {
117 bool only_servers_encode () const {
118 return _only_servers_encode;
121 FileTransferProtocol tms_protocol () const {
122 return _tms_protocol;
125 /** @return The IP address of a TMS that we can copy DCPs to */
126 std::string tms_ip () const {
130 /** @return The path on a TMS that we should changed DCPs to */
131 std::string tms_path () const {
135 /** @return User name to log into the TMS with */
136 std::string tms_user () const {
140 /** @return Password to log into the TMS with */
141 std::string tms_password () const {
142 return _tms_password;
145 std::list<boost::shared_ptr<Cinema> > cinemas () const {
149 std::list<boost::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
150 return _dkdm_recipients;
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 bool show_experimental_audio_processors () const {
166 return _show_experimental_audio_processors;
169 ISDCFMetadata default_isdcf_metadata () const {
170 return _default_isdcf_metadata;
173 boost::optional<std::string> language () const {
177 int default_still_length () const {
178 return _default_still_length;
181 Ratio const * default_container () const {
182 return _default_container;
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 std::string dcp_company_name () const {
202 return _dcp_company_name;
205 std::string dcp_product_name () const {
206 return _dcp_product_name;
209 std::string dcp_product_version () const {
210 return _dcp_product_version;
213 std::string dcp_j2k_comment () const {
214 return _dcp_j2k_comment;
217 int default_j2k_bandwidth () const {
218 return _default_j2k_bandwidth;
221 int default_audio_delay () const {
222 return _default_audio_delay;
225 bool default_interop () const {
226 return _default_interop;
229 bool upload_after_make_dcp () {
230 return _upload_after_make_dcp;
233 void set_default_kdm_directory (boost::filesystem::path d) {
234 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
237 _default_kdm_directory = d;
241 std::string mail_server () const {
245 int mail_port () const {
249 EmailProtocol mail_protocol () const {
250 return _mail_protocol;
253 std::string mail_user () const {
257 std::string mail_password () const {
258 return _mail_password;
261 std::string kdm_subject () const {
265 std::string kdm_from () const {
269 std::vector<std::string> kdm_cc () const {
273 std::string kdm_bcc () const {
277 std::string kdm_email () const {
281 std::string notification_subject () const {
282 return _notification_subject;
285 std::string notification_from () const {
286 return _notification_from;
289 std::string notification_to () const {
290 return _notification_to;
293 std::vector<std::string> notification_cc () const {
294 return _notification_cc;
297 std::string notification_bcc () const {
298 return _notification_bcc;
301 std::string notification_email () const {
302 return _notification_email;
305 boost::shared_ptr<const dcp::CertificateChain> signer_chain () const {
306 return _signer_chain;
309 boost::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
310 return _decryption_chain;
313 bool check_for_updates () const {
314 return _check_for_updates;
317 bool check_for_test_updates () const {
318 return _check_for_test_updates;
321 int maximum_j2k_bandwidth () const {
322 return _maximum_j2k_bandwidth;
325 int log_types () const {
329 bool analyse_ebur128 () const {
330 return _analyse_ebur128;
333 bool automatic_audio_analysis () const {
334 return _automatic_audio_analysis;
337 #ifdef DCPOMATIC_WINDOWS
338 bool win32_console () const {
339 return _win32_console;
343 std::vector<boost::filesystem::path> history () const {
347 std::vector<boost::filesystem::path> player_history () const {
348 return _player_history;
351 boost::shared_ptr<DKDMGroup> dkdms () const {
355 boost::filesystem::path cinemas_file () const {
356 return _cinemas_file;
359 boost::filesystem::path dkdm_recipients_file () const {
360 return _dkdm_recipients_file;
363 bool show_hints_before_make_dcp () const {
364 return _show_hints_before_make_dcp;
367 bool confirm_kdm_email () const {
368 return _confirm_kdm_email;
371 dcp::NameFormat kdm_container_name_format () const {
372 return _kdm_container_name_format;
375 dcp::NameFormat kdm_filename_format () const {
376 return _kdm_filename_format;
379 dcp::NameFormat dkdm_filename_format () const {
380 return _dkdm_filename_format;
383 dcp::NameFormat dcp_metadata_filename_format () const {
384 return _dcp_metadata_filename_format;
387 dcp::NameFormat dcp_asset_filename_format () const {
388 return _dcp_asset_filename_format;
391 bool jump_to_selected () const {
392 return _jump_to_selected;
397 NAG_ENCRYPTED_METADATA,
398 NAG_ALTER_DECRYPTION_CHAIN,
399 NAG_BAD_SIGNER_CHAIN,
400 NAG_IMPORT_DECRYPTION_CHAIN,
406 bool nagged (Nag nag) const {
410 bool sound () const {
414 std::string cover_sheet () const {
418 boost::optional<std::string> sound_output () const {
419 return _sound_output;
422 boost::optional<boost::filesystem::path> last_player_load_directory () const {
423 return _last_player_load_directory;
432 boost::optional<KDMWriteType> last_kdm_write_type () const {
433 return _last_kdm_write_type;
441 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
442 return _last_dkdm_write_type;
445 int frames_in_memory_multiplier () const {
446 return _frames_in_memory_multiplier;
449 boost::optional<int> decode_reduction () const {
450 return _decode_reduction;
453 bool default_notify () const {
454 return _default_notify;
463 bool notification (Notification n) const {
464 return _notification[n];
467 boost::optional<std::string> barco_username () const {
468 return _barco_username;
471 boost::optional<std::string> barco_password () const {
472 return _barco_password;
475 boost::optional<std::string> christie_username () const {
476 return _christie_username;
479 boost::optional<std::string> christie_password () const {
480 return _christie_password;
483 boost::optional<std::string> gdc_username () const {
484 return _gdc_username;
487 boost::optional<std::string> gdc_password () const {
488 return _gdc_password;
492 PLAYER_MODE_WINDOW, ///< one window containing image and controls
493 PLAYER_MODE_FULL, ///< just the image filling the screen
494 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
497 PlayerMode player_mode () const {
501 int image_display () const {
502 return _image_display;
510 VideoViewType video_view_type () const {
511 return _video_view_type;
514 bool respect_kdm_validity_periods () const {
515 return _respect_kdm_validity_periods;
518 boost::optional<boost::filesystem::path> player_activity_log_file () const {
519 return _player_activity_log_file;
522 boost::optional<boost::filesystem::path> player_debug_log_file () const {
523 return _player_debug_log_file;
526 boost::optional<boost::filesystem::path> player_content_directory () const {
527 return _player_content_directory;
530 boost::optional<boost::filesystem::path> player_playlist_directory () const {
531 return _player_playlist_directory;
534 boost::optional<boost::filesystem::path> player_kdm_directory () const {
535 return _player_kdm_directory;
538 AudioMapping audio_mapping (int output_channels);
542 void set_master_encoding_threads (int n) {
543 maybe_set (_master_encoding_threads, n);
546 void set_server_encoding_threads (int n) {
547 maybe_set (_server_encoding_threads, n);
550 void set_default_directory (boost::filesystem::path d) {
551 if (_default_directory && *_default_directory == d) {
554 _default_directory = d;
558 /** @param p New server port */
559 void set_server_port_base (int p) {
560 maybe_set (_server_port_base, p);
563 void set_only_servers_encode (bool o) {
564 maybe_set (_only_servers_encode, o);
567 void set_tms_protocol (FileTransferProtocol p) {
568 maybe_set (_tms_protocol, p);
571 /** @param i IP address of a TMS that we can copy DCPs to */
572 void set_tms_ip (std::string i) {
573 maybe_set (_tms_ip, i);
576 /** @param p Path on a TMS that we should changed DCPs to */
577 void set_tms_path (std::string p) {
578 maybe_set (_tms_path, p);
581 /** @param u User name to log into the TMS with */
582 void set_tms_user (std::string u) {
583 maybe_set (_tms_user, u);
586 /** @param p Password to log into the TMS with */
587 void set_tms_password (std::string p) {
588 maybe_set (_tms_password, p);
591 void add_cinema (boost::shared_ptr<Cinema> c) {
592 _cinemas.push_back (c);
596 void remove_cinema (boost::shared_ptr<Cinema> c) {
601 void add_dkdm_recipient (boost::shared_ptr<DKDMRecipient> c) {
602 _dkdm_recipients.push_back (c);
603 changed (DKDM_RECIPIENTS);
606 void remove_dkdm_recipient (boost::shared_ptr<DKDMRecipient> c) {
607 _dkdm_recipients.remove (c);
608 changed (DKDM_RECIPIENTS);
611 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
612 maybe_set (_allowed_dcp_frame_rates, r);
615 void set_allow_any_dcp_frame_rate (bool a) {
616 maybe_set (_allow_any_dcp_frame_rate, a);
619 void set_allow_any_container (bool a) {
620 maybe_set (_allow_any_container, a);
623 void set_show_experimental_audio_processors (bool e) {
624 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
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_dcp_content_type (DCPContentType const * t) {
657 maybe_set (_default_dcp_content_type, t);
660 void set_default_dcp_audio_channels (int c) {
661 maybe_set (_default_dcp_audio_channels, c);
664 void set_dcp_issuer (std::string i) {
665 maybe_set (_dcp_issuer, i);
668 void set_dcp_creator (std::string c) {
669 maybe_set (_dcp_creator, c);
672 void set_dcp_company_name (std::string c) {
673 maybe_set (_dcp_company_name, c);
676 void set_dcp_product_name (std::string c) {
677 maybe_set (_dcp_product_name, c);
680 void set_dcp_product_version (std::string c) {
681 maybe_set (_dcp_product_version, c);
684 void set_dcp_j2k_comment (std::string c) {
685 maybe_set (_dcp_j2k_comment, c);
688 void set_default_j2k_bandwidth (int b) {
689 maybe_set (_default_j2k_bandwidth, b);
692 void set_default_audio_delay (int d) {
693 maybe_set (_default_audio_delay, d);
696 void set_default_interop (bool i) {
697 maybe_set (_default_interop, i);
700 void set_upload_after_make_dcp (bool u) {
701 maybe_set (_upload_after_make_dcp, u);
704 void set_mail_server (std::string s) {
705 maybe_set (_mail_server, s);
708 void set_mail_port (int p) {
709 maybe_set (_mail_port, p);
712 void set_mail_protocol (EmailProtocol p) {
713 maybe_set (_mail_protocol, p);
716 void set_mail_user (std::string u) {
717 maybe_set (_mail_user, u);
720 void set_mail_password (std::string p) {
721 maybe_set (_mail_password, p);
724 void set_kdm_subject (std::string s) {
725 maybe_set (_kdm_subject, s);
728 void set_kdm_from (std::string f) {
729 maybe_set (_kdm_from, f);
732 void set_kdm_cc (std::vector<std::string> f) {
733 maybe_set (_kdm_cc, f);
736 void set_kdm_bcc (std::string f) {
737 maybe_set (_kdm_bcc, f);
740 void set_kdm_email (std::string e) {
741 maybe_set (_kdm_email, e);
744 void reset_kdm_email ();
746 void set_notification_subject (std::string s) {
747 maybe_set (_notification_subject, s);
750 void set_notification_from (std::string f) {
751 maybe_set (_notification_from, f);
754 void set_notification_to (std::string t) {
755 maybe_set (_notification_to, t);
758 void set_notification_cc (std::vector<std::string> f) {
759 maybe_set (_notification_cc, f);
762 void set_notification_bcc (std::string f) {
763 maybe_set (_notification_bcc, f);
766 void set_notification_email (std::string e) {
767 maybe_set (_notification_email, e);
770 void reset_notification_email ();
772 void set_signer_chain (boost::shared_ptr<const dcp::CertificateChain> s) {
773 maybe_set (_signer_chain, s);
776 void set_decryption_chain (boost::shared_ptr<const dcp::CertificateChain> c) {
777 maybe_set (_decryption_chain, c);
780 void set_check_for_updates (bool c) {
781 maybe_set (_check_for_updates, c);
783 set_check_for_test_updates (false);
787 void set_check_for_test_updates (bool c) {
788 maybe_set (_check_for_test_updates, c);
791 void set_maximum_j2k_bandwidth (int b) {
792 maybe_set (_maximum_j2k_bandwidth, b);
795 void set_log_types (int t) {
796 maybe_set (_log_types, t);
799 void set_analyse_ebur128 (bool a) {
800 maybe_set (_analyse_ebur128, a);
803 void set_automatic_audio_analysis (bool a) {
804 maybe_set (_automatic_audio_analysis, a);
807 #ifdef DCPOMATIC_WINDOWS
808 void set_win32_console (bool c) {
809 maybe_set (_win32_console, c);
813 void set_dkdms (boost::shared_ptr<DKDMGroup> dkdms) {
818 void set_cinemas_file (boost::filesystem::path file);
820 void set_dkdm_recipients_file (boost::filesystem::path file);
822 void set_show_hints_before_make_dcp (bool s) {
823 maybe_set (_show_hints_before_make_dcp, s);
826 void set_confirm_kdm_email (bool s) {
827 maybe_set (_confirm_kdm_email, s);
830 void set_sound (bool s) {
831 maybe_set (_sound, s, SOUND);
834 void set_sound_output (std::string o) {
835 maybe_set (_sound_output, o, SOUND_OUTPUT);
838 void set_last_player_load_directory (boost::filesystem::path d) {
839 maybe_set (_last_player_load_directory, d);
842 void set_last_kdm_write_type (KDMWriteType t) {
843 maybe_set (_last_kdm_write_type, t);
846 void set_last_dkdm_write_type (DKDMWriteType t) {
847 maybe_set (_last_dkdm_write_type, t);
850 void unset_sound_output () {
851 if (!_sound_output) {
855 _sound_output = boost::none;
859 void set_kdm_container_name_format (dcp::NameFormat n) {
860 maybe_set (_kdm_container_name_format, n);
863 void set_kdm_filename_format (dcp::NameFormat n) {
864 maybe_set (_kdm_filename_format, n);
867 void set_dkdm_filename_format (dcp::NameFormat n) {
868 maybe_set (_dkdm_filename_format, n);
871 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
872 maybe_set (_dcp_metadata_filename_format, n);
875 void set_dcp_asset_filename_format (dcp::NameFormat n) {
876 maybe_set (_dcp_asset_filename_format, n);
879 void set_frames_in_memory_multiplier (int m) {
880 maybe_set (_frames_in_memory_multiplier, m);
883 void set_decode_reduction (boost::optional<int> r) {
884 maybe_set (_decode_reduction, r);
887 void set_default_notify (bool n) {
888 maybe_set (_default_notify, n);
891 void clear_history () {
896 void clear_player_history () {
897 _player_history.clear ();
901 void add_to_history (boost::filesystem::path p);
902 void clean_history ();
903 void add_to_player_history (boost::filesystem::path p);
904 void clean_player_history ();
906 void set_jump_to_selected (bool j) {
907 maybe_set (_jump_to_selected, j);
910 void set_nagged (Nag nag, bool nagged) {
911 maybe_set (_nagged[nag], nagged);
914 void set_cover_sheet (std::string s) {
915 maybe_set (_cover_sheet, s);
918 void reset_cover_sheet ();
920 void set_notification (Notification n, bool v) {
921 maybe_set (_notification[n], v);
924 void set_barco_username (std::string u) {
925 maybe_set (_barco_username, u);
928 void unset_barco_username () {
929 maybe_set (_barco_username, boost::optional<std::string>());
932 void set_barco_password (std::string p) {
933 maybe_set (_barco_password, p);
936 void unset_barco_password () {
937 maybe_set (_barco_password, boost::optional<std::string>());
940 void set_christie_username (std::string u) {
941 maybe_set (_christie_username, u);
944 void unset_christie_username () {
945 maybe_set (_christie_username, boost::optional<std::string>());
948 void set_christie_password (std::string p) {
949 maybe_set (_christie_password, p);
952 void unset_christie_password () {
953 maybe_set (_christie_password, boost::optional<std::string>());
956 void set_gdc_username (std::string u) {
957 maybe_set (_gdc_username, u);
960 void unset_gdc_username () {
961 maybe_set (_gdc_username, boost::optional<std::string>());
964 void set_gdc_password (std::string p) {
965 maybe_set (_gdc_password, p);
968 void unset_gdc_password () {
969 maybe_set (_gdc_password, boost::optional<std::string>());
972 void set_player_mode (PlayerMode m) {
973 maybe_set (_player_mode, m);
976 void set_image_display (int n) {
977 maybe_set (_image_display, n);
980 void set_video_view_type (VideoViewType v) {
981 maybe_set (_video_view_type, v);
984 void set_respect_kdm_validity_periods (bool r) {
985 maybe_set (_respect_kdm_validity_periods, r);
988 void set_player_activity_log_file (boost::filesystem::path p) {
989 maybe_set (_player_activity_log_file, p);
992 void unset_player_activity_log_file () {
993 if (!_player_activity_log_file) {
996 _player_activity_log_file = boost::none;
1000 void set_player_debug_log_file (boost::filesystem::path p) {
1001 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1004 void unset_player_debug_log_file () {
1005 if (!_player_debug_log_file) {
1008 _player_debug_log_file = boost::none;
1009 changed (PLAYER_DEBUG_LOG);
1012 void set_player_content_directory (boost::filesystem::path p) {
1013 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1016 void unset_player_content_directory () {
1017 if (!_player_content_directory) {
1020 _player_content_directory = boost::none;
1021 changed (PLAYER_CONTENT_DIRECTORY);
1024 void set_player_playlist_directory (boost::filesystem::path p) {
1025 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1028 void unset_player_playlist_directory () {
1029 if (!_player_playlist_directory) {
1032 _player_playlist_directory = boost::none;
1033 changed (PLAYER_PLAYLIST_DIRECTORY);
1036 void set_player_kdm_directory (boost::filesystem::path p) {
1037 maybe_set (_player_kdm_directory, p);
1040 void unset_player_kdm_directory () {
1041 if (!_player_kdm_directory) {
1044 _player_kdm_directory = boost::none;
1048 void set_audio_mapping (AudioMapping m);
1049 void set_audio_mapping_to_default ();
1051 void changed (Property p = OTHER);
1052 boost::signals2::signal<void (Property)> Changed;
1053 /** Emitted if read() failed on an existing Config file. There is nothing
1054 a listener can do about it: this is just for information.
1056 static boost::signals2::signal<void ()> FailedToLoad;
1057 /** Emitted if read() issued a warning which the user might want to know about */
1058 static boost::signals2::signal<void (std::string)> Warning;
1059 /** Emitted if there is a something wrong the contents of our config. Handler can call
1060 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1063 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1064 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1065 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1068 static boost::signals2::signal<bool (BadReason)> Bad;
1070 void write () const;
1071 void write_config () const;
1072 void write_cinemas () const;
1073 void write_dkdm_recipients () const;
1074 void link (boost::filesystem::path new_file) const;
1075 void copy_and_link (boost::filesystem::path new_file) const;
1076 bool have_write_permission () const;
1078 void save_template (boost::shared_ptr<const Film> film, std::string name) const;
1079 bool existing_template (std::string name) const;
1080 std::list<std::string> templates () const;
1081 boost::filesystem::path template_path (std::string name) const;
1082 void rename_template (std::string old_name, std::string new_name) const;
1083 void delete_template (std::string name) const;
1085 static Config* instance ();
1086 static void drop ();
1087 static void restore_defaults ();
1088 static bool have_existing (std::string);
1089 static boost::filesystem::path config_file ();
1094 void set_defaults ();
1095 void set_kdm_email_to_default ();
1096 void set_notification_email_to_default ();
1097 void set_cover_sheet_to_default ();
1098 void read_cinemas (cxml::Document const & f);
1099 void read_dkdm_recipients (cxml::Document const & f);
1100 boost::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1101 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1102 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1103 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1107 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1108 if (member == new_value) {
1116 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1117 if (member && member.get() == new_value) {
1124 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1125 int _master_encoding_threads;
1126 /** number of threads which a server should use for J2K encoding on the local machine */
1127 int _server_encoding_threads;
1128 /** default directory to put new films in */
1129 boost::optional<boost::filesystem::path> _default_directory;
1130 /** base port number to use for J2K encoding servers;
1131 * this port and the two above it will be used.
1133 int _server_port_base;
1134 /** true to broadcast on the `any' address to look for servers */
1135 bool _use_any_servers;
1136 /** J2K encoding servers that should definitely be used */
1137 std::vector<std::string> _servers;
1138 bool _only_servers_encode;
1139 FileTransferProtocol _tms_protocol;
1140 /** The IP address of a TMS that we can copy DCPs to */
1141 std::string _tms_ip;
1142 /** The path on a TMS that we should write DCPs to */
1143 std::string _tms_path;
1144 /** User name to log into the TMS with */
1145 std::string _tms_user;
1146 /** Password to log into the TMS with */
1147 std::string _tms_password;
1148 /** The list of possible DCP frame rates that DCP-o-matic will use */
1149 std::list<int> _allowed_dcp_frame_rates;
1150 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1151 bool _allow_any_dcp_frame_rate;
1152 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1153 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1154 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1156 bool _allow_any_container;
1157 /** Offer the upmixers in the audio processor settings */
1158 bool _show_experimental_audio_processors;
1159 /** Default ISDCF metadata for newly-created Films */
1160 ISDCFMetadata _default_isdcf_metadata;
1161 boost::optional<std::string> _language;
1162 /** Default length of still image content (seconds) */
1163 int _default_still_length;
1164 Ratio const * _default_container;
1165 DCPContentType const * _default_dcp_content_type;
1166 int _default_dcp_audio_channels;
1167 std::string _dcp_issuer;
1168 std::string _dcp_creator;
1169 std::string _dcp_company_name;
1170 std::string _dcp_product_name;
1171 std::string _dcp_product_version;
1172 std::string _dcp_j2k_comment;
1173 int _default_j2k_bandwidth;
1174 int _default_audio_delay;
1175 bool _default_interop;
1176 /** Default directory to offer to write KDMs to; if it's not set,
1177 the home directory will be offered.
1179 boost::optional<boost::filesystem::path> _default_kdm_directory;
1180 bool _upload_after_make_dcp;
1181 std::list<boost::shared_ptr<Cinema> > _cinemas;
1182 std::list<boost::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1183 std::string _mail_server;
1185 EmailProtocol _mail_protocol;
1186 std::string _mail_user;
1187 std::string _mail_password;
1188 std::string _kdm_subject;
1189 std::string _kdm_from;
1190 std::vector<std::string> _kdm_cc;
1191 std::string _kdm_bcc;
1192 std::string _kdm_email;
1193 std::string _notification_subject;
1194 std::string _notification_from;
1195 std::string _notification_to;
1196 std::vector<std::string> _notification_cc;
1197 std::string _notification_bcc;
1198 std::string _notification_email;
1199 boost::shared_ptr<const dcp::CertificateChain> _signer_chain;
1200 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1201 * certificate for making KDMs given to DCP-o-matic.
1203 boost::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1204 /** true to check for updates on startup */
1205 bool _check_for_updates;
1206 bool _check_for_test_updates;
1207 /** maximum allowed J2K bandwidth in bits per second */
1208 int _maximum_j2k_bandwidth;
1210 bool _analyse_ebur128;
1211 bool _automatic_audio_analysis;
1212 #ifdef DCPOMATIC_WINDOWS
1213 bool _win32_console;
1215 std::vector<boost::filesystem::path> _history;
1216 std::vector<boost::filesystem::path> _player_history;
1217 boost::shared_ptr<DKDMGroup> _dkdms;
1218 boost::filesystem::path _cinemas_file;
1219 boost::filesystem::path _dkdm_recipients_file;
1220 bool _show_hints_before_make_dcp;
1221 bool _confirm_kdm_email;
1222 dcp::NameFormat _kdm_filename_format;
1223 dcp::NameFormat _dkdm_filename_format;
1224 dcp::NameFormat _kdm_container_name_format;
1225 dcp::NameFormat _dcp_metadata_filename_format;
1226 dcp::NameFormat _dcp_asset_filename_format;
1227 bool _jump_to_selected;
1228 bool _nagged[NAG_COUNT];
1230 /** name of a specific sound output stream to use, or empty to use the default */
1231 boost::optional<std::string> _sound_output;
1232 std::string _cover_sheet;
1233 boost::optional<boost::filesystem::path> _last_player_load_directory;
1234 boost::optional<KDMWriteType> _last_kdm_write_type;
1235 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1236 int _frames_in_memory_multiplier;
1237 boost::optional<int> _decode_reduction;
1238 bool _default_notify;
1239 bool _notification[NOTIFICATION_COUNT];
1240 boost::optional<std::string> _barco_username;
1241 boost::optional<std::string> _barco_password;
1242 boost::optional<std::string> _christie_username;
1243 boost::optional<std::string> _christie_password;
1244 boost::optional<std::string> _gdc_username;
1245 boost::optional<std::string> _gdc_password;
1246 PlayerMode _player_mode;
1248 VideoViewType _video_view_type;
1249 bool _respect_kdm_validity_periods;
1250 /** Log file containing things the player does (e.g. started, stopped, loaded
1251 playlist etc.) Does not contain debugging information.
1253 boost::optional<boost::filesystem::path> _player_activity_log_file;
1254 /** Log file containing debug information for the player */
1255 boost::optional<boost::filesystem::path> _player_debug_log_file;
1256 /** A directory containing DCPs whose contents are presented to the user
1257 in the dual-screen player mode. DCPs on the list can be loaded
1260 boost::optional<boost::filesystem::path> _player_content_directory;
1261 boost::optional<boost::filesystem::path> _player_playlist_directory;
1262 boost::optional<boost::filesystem::path> _player_kdm_directory;
1263 boost::optional<AudioMapping> _audio_mapping;
1265 static int const _current_version;
1267 /** Singleton instance, or 0 */
1268 static Config* _instance;