2 Copyright (C) 2012-2021 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
31 #include "audio_mapping.h"
32 #include <dcp/name_format.h>
33 #include <dcp/certificate_chain.h>
34 #include <dcp/encrypted_kdm.h>
35 #include <dcp/language_tag.h>
36 #include <boost/signals2.hpp>
37 #include <boost/filesystem.hpp>
40 class CinemaSoundProcessor;
49 * @brief A singleton class holding configuration.
51 class Config : public State
54 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
55 int master_encoding_threads () const {
56 return _master_encoding_threads;
59 /** @return number of threads which a server should use for J2K encoding on the local machine */
60 int server_encoding_threads () const {
61 return _server_encoding_threads;
64 boost::optional<boost::filesystem::path> default_directory () const {
65 return _default_directory;
68 boost::optional<boost::filesystem::path> default_kdm_directory () const {
69 return _default_kdm_directory;
72 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
73 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
82 PLAYER_CONTENT_DIRECTORY,
83 PLAYER_PLAYLIST_DIRECTORY,
86 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
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 std::list<std::shared_ptr<Cinema> > cinemas () const {
148 std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
149 return _dkdm_recipients;
152 std::list<int> allowed_dcp_frame_rates () const {
153 return _allowed_dcp_frame_rates;
156 bool allow_any_dcp_frame_rate () const {
157 return _allow_any_dcp_frame_rate;
160 bool allow_any_container () const {
161 return _allow_any_container;
164 bool show_experimental_audio_processors () const {
165 return _show_experimental_audio_processors;
168 boost::optional<std::string> language () const {
172 int default_still_length () const {
173 return _default_still_length;
176 Ratio const * default_container () const {
177 return _default_container;
180 DCPContentType const * default_dcp_content_type () const {
181 return _default_dcp_content_type;
184 int default_dcp_audio_channels () const {
185 return _default_dcp_audio_channels;
188 std::string dcp_issuer () const {
192 std::string dcp_creator () const {
196 std::string dcp_company_name () const {
197 return _dcp_company_name;
200 std::string dcp_product_name () const {
201 return _dcp_product_name;
204 std::string dcp_product_version () const {
205 return _dcp_product_version;
208 std::string dcp_j2k_comment () const {
209 return _dcp_j2k_comment;
212 int default_j2k_bandwidth () const {
213 return _default_j2k_bandwidth;
216 int default_audio_delay () const {
217 return _default_audio_delay;
220 bool default_interop () const {
221 return _default_interop;
224 bool upload_after_make_dcp () {
225 return _upload_after_make_dcp;
228 void set_default_kdm_directory (boost::filesystem::path d) {
229 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
232 _default_kdm_directory = d;
236 std::string mail_server () const {
240 int mail_port () const {
244 EmailProtocol mail_protocol () const {
245 return _mail_protocol;
248 std::string mail_user () const {
252 std::string mail_password () const {
253 return _mail_password;
256 std::string kdm_subject () const {
260 std::string kdm_from () const {
264 std::vector<std::string> kdm_cc () const {
268 std::string kdm_bcc () const {
272 std::string kdm_email () const {
276 std::string notification_subject () const {
277 return _notification_subject;
280 std::string notification_from () const {
281 return _notification_from;
284 std::string notification_to () const {
285 return _notification_to;
288 std::vector<std::string> notification_cc () const {
289 return _notification_cc;
292 std::string notification_bcc () const {
293 return _notification_bcc;
296 std::string notification_email () const {
297 return _notification_email;
300 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
301 return _signer_chain;
304 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
305 return _decryption_chain;
308 bool check_for_updates () const {
309 return _check_for_updates;
312 bool check_for_test_updates () const {
313 return _check_for_test_updates;
316 int maximum_j2k_bandwidth () const {
317 return _maximum_j2k_bandwidth;
320 int log_types () const {
324 bool analyse_ebur128 () const {
325 return _analyse_ebur128;
328 bool automatic_audio_analysis () const {
329 return _automatic_audio_analysis;
332 #ifdef DCPOMATIC_WINDOWS
333 bool win32_console () const {
334 return _win32_console;
338 std::vector<boost::filesystem::path> history () const {
342 std::vector<boost::filesystem::path> player_history () const {
343 return _player_history;
346 std::shared_ptr<DKDMGroup> dkdms () const {
350 boost::filesystem::path cinemas_file () const {
351 return _cinemas_file;
354 boost::filesystem::path dkdm_recipients_file () const {
355 return _dkdm_recipients_file;
358 bool show_hints_before_make_dcp () const {
359 return _show_hints_before_make_dcp;
362 bool confirm_kdm_email () const {
363 return _confirm_kdm_email;
366 dcp::NameFormat kdm_container_name_format () const {
367 return _kdm_container_name_format;
370 dcp::NameFormat kdm_filename_format () const {
371 return _kdm_filename_format;
374 dcp::NameFormat dkdm_filename_format () const {
375 return _dkdm_filename_format;
378 dcp::NameFormat dcp_metadata_filename_format () const {
379 return _dcp_metadata_filename_format;
382 dcp::NameFormat dcp_asset_filename_format () const {
383 return _dcp_asset_filename_format;
386 bool jump_to_selected () const {
387 return _jump_to_selected;
390 /* This could be an enum class but we use the enum a lot to index _nagged
391 * so it means a lot of casts.
395 NAG_ENCRYPTED_METADATA,
396 NAG_ALTER_DECRYPTION_CHAIN,
397 NAG_BAD_SIGNER_CHAIN,
398 NAG_IMPORT_DECRYPTION_CHAIN,
401 NAG_TOO_MANY_DROPPED_FRAMES,
405 bool nagged (Nag nag) const {
409 bool sound () const {
413 std::string cover_sheet () const {
417 boost::optional<std::string> sound_output () const {
418 return _sound_output;
421 boost::optional<boost::filesystem::path> last_player_load_directory () const {
422 return _last_player_load_directory;
431 boost::optional<KDMWriteType> last_kdm_write_type () const {
432 return _last_kdm_write_type;
440 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
441 return _last_dkdm_write_type;
444 int frames_in_memory_multiplier () const {
445 return _frames_in_memory_multiplier;
448 boost::optional<int> decode_reduction () const {
449 return _decode_reduction;
452 bool default_notify () const {
453 return _default_notify;
462 bool notification (Notification n) const {
463 return _notification[n];
466 boost::optional<std::string> barco_username () const {
467 return _barco_username;
470 boost::optional<std::string> barco_password () const {
471 return _barco_password;
474 boost::optional<std::string> christie_username () const {
475 return _christie_username;
478 boost::optional<std::string> christie_password () const {
479 return _christie_password;
482 boost::optional<std::string> gdc_username () const {
483 return _gdc_username;
486 boost::optional<std::string> gdc_password () const {
487 return _gdc_password;
491 PLAYER_MODE_WINDOW, ///< one window containing image and controls
492 PLAYER_MODE_FULL, ///< just the image filling the screen
493 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
496 PlayerMode player_mode () const {
500 int image_display () const {
501 return _image_display;
509 VideoViewType video_view_type () const {
510 return _video_view_type;
513 bool respect_kdm_validity_periods () const {
514 return _respect_kdm_validity_periods;
517 boost::optional<boost::filesystem::path> player_activity_log_file () const {
518 return _player_activity_log_file;
521 boost::optional<boost::filesystem::path> player_debug_log_file () const {
522 return _player_debug_log_file;
525 boost::optional<boost::filesystem::path> player_content_directory () const {
526 return _player_content_directory;
529 boost::optional<boost::filesystem::path> player_playlist_directory () const {
530 return _player_playlist_directory;
533 boost::optional<boost::filesystem::path> player_kdm_directory () const {
534 return _player_kdm_directory;
537 AudioMapping audio_mapping (int output_channels);
539 std::vector<dcp::LanguageTag> custom_languages () const {
540 return _custom_languages;
545 void set_master_encoding_threads (int n) {
546 maybe_set (_master_encoding_threads, n);
549 void set_server_encoding_threads (int n) {
550 maybe_set (_server_encoding_threads, n);
553 void set_default_directory (boost::filesystem::path d) {
554 if (_default_directory && *_default_directory == d) {
557 _default_directory = d;
561 /** @param p New server port */
562 void set_server_port_base (int p) {
563 maybe_set (_server_port_base, p);
566 void set_only_servers_encode (bool o) {
567 maybe_set (_only_servers_encode, o);
570 void set_tms_protocol (FileTransferProtocol p) {
571 maybe_set (_tms_protocol, p);
574 /** @param i IP address of a TMS that we can copy DCPs to */
575 void set_tms_ip (std::string i) {
576 maybe_set (_tms_ip, i);
579 /** @param p Path on a TMS that we should changed DCPs to */
580 void set_tms_path (std::string p) {
581 maybe_set (_tms_path, p);
584 /** @param u User name to log into the TMS with */
585 void set_tms_user (std::string u) {
586 maybe_set (_tms_user, u);
589 /** @param p Password to log into the TMS with */
590 void set_tms_password (std::string p) {
591 maybe_set (_tms_password, p);
594 void add_cinema (std::shared_ptr<Cinema> c) {
595 _cinemas.push_back (c);
599 void remove_cinema (std::shared_ptr<Cinema> c) {
604 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
605 _dkdm_recipients.push_back (c);
606 changed (DKDM_RECIPIENTS);
609 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
610 _dkdm_recipients.remove (c);
611 changed (DKDM_RECIPIENTS);
614 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
615 maybe_set (_allowed_dcp_frame_rates, r);
618 void set_allow_any_dcp_frame_rate (bool a) {
619 maybe_set (_allow_any_dcp_frame_rate, a);
622 void set_allow_any_container (bool a) {
623 maybe_set (_allow_any_container, a);
626 void set_show_experimental_audio_processors (bool e) {
627 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
630 void set_language (std::string l) {
631 if (_language && _language.get() == l) {
638 void unset_language () {
643 _language = boost::none;
647 void set_default_still_length (int s) {
648 maybe_set (_default_still_length, s);
651 void set_default_container (Ratio const * c) {
652 maybe_set (_default_container, c);
655 void set_default_dcp_content_type (DCPContentType const * t) {
656 maybe_set (_default_dcp_content_type, t);
659 void set_default_dcp_audio_channels (int c) {
660 maybe_set (_default_dcp_audio_channels, c);
663 void set_dcp_issuer (std::string i) {
664 maybe_set (_dcp_issuer, i);
667 void set_dcp_creator (std::string c) {
668 maybe_set (_dcp_creator, c);
671 void set_dcp_company_name (std::string c) {
672 maybe_set (_dcp_company_name, c);
675 void set_dcp_product_name (std::string c) {
676 maybe_set (_dcp_product_name, c);
679 void set_dcp_product_version (std::string c) {
680 maybe_set (_dcp_product_version, c);
683 void set_dcp_j2k_comment (std::string c) {
684 maybe_set (_dcp_j2k_comment, c);
687 void set_default_j2k_bandwidth (int b) {
688 maybe_set (_default_j2k_bandwidth, b);
691 void set_default_audio_delay (int d) {
692 maybe_set (_default_audio_delay, d);
695 void set_default_interop (bool i) {
696 maybe_set (_default_interop, i);
699 void set_upload_after_make_dcp (bool u) {
700 maybe_set (_upload_after_make_dcp, u);
703 void set_mail_server (std::string s) {
704 maybe_set (_mail_server, s);
707 void set_mail_port (int p) {
708 maybe_set (_mail_port, p);
711 void set_mail_protocol (EmailProtocol p) {
712 maybe_set (_mail_protocol, p);
715 void set_mail_user (std::string u) {
716 maybe_set (_mail_user, u);
719 void set_mail_password (std::string p) {
720 maybe_set (_mail_password, p);
723 void set_kdm_subject (std::string s) {
724 maybe_set (_kdm_subject, s);
727 void set_kdm_from (std::string f) {
728 maybe_set (_kdm_from, f);
731 void set_kdm_cc (std::vector<std::string> f) {
732 maybe_set (_kdm_cc, f);
735 void set_kdm_bcc (std::string f) {
736 maybe_set (_kdm_bcc, f);
739 void set_kdm_email (std::string e) {
740 maybe_set (_kdm_email, e);
743 void reset_kdm_email ();
745 void set_notification_subject (std::string s) {
746 maybe_set (_notification_subject, s);
749 void set_notification_from (std::string f) {
750 maybe_set (_notification_from, f);
753 void set_notification_to (std::string t) {
754 maybe_set (_notification_to, t);
757 void set_notification_cc (std::vector<std::string> f) {
758 maybe_set (_notification_cc, f);
761 void set_notification_bcc (std::string f) {
762 maybe_set (_notification_bcc, f);
765 void set_notification_email (std::string e) {
766 maybe_set (_notification_email, e);
769 void reset_notification_email ();
771 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
772 maybe_set (_signer_chain, s);
775 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
776 maybe_set (_decryption_chain, c);
779 void set_check_for_updates (bool c) {
780 maybe_set (_check_for_updates, c);
782 set_check_for_test_updates (false);
786 void set_check_for_test_updates (bool c) {
787 maybe_set (_check_for_test_updates, c);
790 void set_maximum_j2k_bandwidth (int b) {
791 maybe_set (_maximum_j2k_bandwidth, b);
794 void set_log_types (int t) {
795 maybe_set (_log_types, t);
798 void set_analyse_ebur128 (bool a) {
799 maybe_set (_analyse_ebur128, a);
802 void set_automatic_audio_analysis (bool a) {
803 maybe_set (_automatic_audio_analysis, a);
806 #ifdef DCPOMATIC_WINDOWS
807 void set_win32_console (bool c) {
808 maybe_set (_win32_console, c);
812 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
817 void set_cinemas_file (boost::filesystem::path file);
819 void set_dkdm_recipients_file (boost::filesystem::path file);
821 void set_show_hints_before_make_dcp (bool s) {
822 maybe_set (_show_hints_before_make_dcp, s);
825 void set_confirm_kdm_email (bool s) {
826 maybe_set (_confirm_kdm_email, s);
829 void set_sound (bool s) {
830 maybe_set (_sound, s, SOUND);
833 void set_sound_output (std::string o) {
834 maybe_set (_sound_output, o, SOUND_OUTPUT);
837 void set_last_player_load_directory (boost::filesystem::path d) {
838 maybe_set (_last_player_load_directory, d);
841 void set_last_kdm_write_type (KDMWriteType t) {
842 maybe_set (_last_kdm_write_type, t);
845 void set_last_dkdm_write_type (DKDMWriteType t) {
846 maybe_set (_last_dkdm_write_type, t);
849 void unset_sound_output () {
850 if (!_sound_output) {
854 _sound_output = boost::none;
858 void set_kdm_container_name_format (dcp::NameFormat n) {
859 maybe_set (_kdm_container_name_format, n);
862 void set_kdm_filename_format (dcp::NameFormat n) {
863 maybe_set (_kdm_filename_format, n);
866 void set_dkdm_filename_format (dcp::NameFormat n) {
867 maybe_set (_dkdm_filename_format, n);
870 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
871 maybe_set (_dcp_metadata_filename_format, n);
874 void set_dcp_asset_filename_format (dcp::NameFormat n) {
875 maybe_set (_dcp_asset_filename_format, n);
878 void set_frames_in_memory_multiplier (int m) {
879 maybe_set (_frames_in_memory_multiplier, m);
882 void set_decode_reduction (boost::optional<int> r) {
883 maybe_set (_decode_reduction, r);
886 void set_default_notify (bool n) {
887 maybe_set (_default_notify, n);
890 void clear_history () {
895 void clear_player_history () {
896 _player_history.clear ();
900 void add_to_history (boost::filesystem::path p);
901 void clean_history ();
902 void add_to_player_history (boost::filesystem::path p);
903 void clean_player_history ();
905 void set_jump_to_selected (bool j) {
906 maybe_set (_jump_to_selected, j);
909 void set_nagged (Nag nag, bool nagged) {
910 maybe_set (_nagged[nag], nagged);
913 void set_cover_sheet (std::string s) {
914 maybe_set (_cover_sheet, s);
917 void reset_cover_sheet ();
919 void set_notification (Notification n, bool v) {
920 maybe_set (_notification[n], v);
923 void set_barco_username (std::string u) {
924 maybe_set (_barco_username, u);
927 void unset_barco_username () {
928 maybe_set (_barco_username, boost::optional<std::string>());
931 void set_barco_password (std::string p) {
932 maybe_set (_barco_password, p);
935 void unset_barco_password () {
936 maybe_set (_barco_password, boost::optional<std::string>());
939 void set_christie_username (std::string u) {
940 maybe_set (_christie_username, u);
943 void unset_christie_username () {
944 maybe_set (_christie_username, boost::optional<std::string>());
947 void set_christie_password (std::string p) {
948 maybe_set (_christie_password, p);
951 void unset_christie_password () {
952 maybe_set (_christie_password, boost::optional<std::string>());
955 void set_gdc_username (std::string u) {
956 maybe_set (_gdc_username, u);
959 void unset_gdc_username () {
960 maybe_set (_gdc_username, boost::optional<std::string>());
963 void set_gdc_password (std::string p) {
964 maybe_set (_gdc_password, p);
967 void unset_gdc_password () {
968 maybe_set (_gdc_password, boost::optional<std::string>());
971 void set_player_mode (PlayerMode m) {
972 maybe_set (_player_mode, m);
975 void set_image_display (int n) {
976 maybe_set (_image_display, n);
979 void set_video_view_type (VideoViewType v) {
980 maybe_set (_video_view_type, v);
983 void set_respect_kdm_validity_periods (bool r) {
984 maybe_set (_respect_kdm_validity_periods, r);
987 void set_player_activity_log_file (boost::filesystem::path p) {
988 maybe_set (_player_activity_log_file, p);
991 void unset_player_activity_log_file () {
992 if (!_player_activity_log_file) {
995 _player_activity_log_file = boost::none;
999 void set_player_debug_log_file (boost::filesystem::path p) {
1000 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1003 void unset_player_debug_log_file () {
1004 if (!_player_debug_log_file) {
1007 _player_debug_log_file = boost::none;
1008 changed (PLAYER_DEBUG_LOG);
1011 void set_player_content_directory (boost::filesystem::path p) {
1012 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1015 void unset_player_content_directory () {
1016 if (!_player_content_directory) {
1019 _player_content_directory = boost::none;
1020 changed (PLAYER_CONTENT_DIRECTORY);
1023 void set_player_playlist_directory (boost::filesystem::path p) {
1024 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1027 void unset_player_playlist_directory () {
1028 if (!_player_playlist_directory) {
1031 _player_playlist_directory = boost::none;
1032 changed (PLAYER_PLAYLIST_DIRECTORY);
1035 void set_player_kdm_directory (boost::filesystem::path p) {
1036 maybe_set (_player_kdm_directory, p);
1039 void unset_player_kdm_directory () {
1040 if (!_player_kdm_directory) {
1043 _player_kdm_directory = boost::none;
1047 void set_audio_mapping (AudioMapping m);
1048 void set_audio_mapping_to_default ();
1050 void add_custom_language (dcp::LanguageTag tag);
1052 void changed (Property p = OTHER);
1053 boost::signals2::signal<void (Property)> Changed;
1054 /** Emitted if read() failed on an existing Config file. There is nothing
1055 a listener can do about it: this is just for information.
1057 static boost::signals2::signal<void ()> FailedToLoad;
1058 /** Emitted if read() issued a warning which the user might want to know about */
1059 static boost::signals2::signal<void (std::string)> Warning;
1060 /** Emitted if there is a something wrong the contents of our config. Handler can call
1061 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1064 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1065 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1066 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1069 static boost::signals2::signal<bool (BadReason)> Bad;
1071 void write () const;
1072 void write_config () const;
1073 void write_cinemas () const;
1074 void write_dkdm_recipients () const;
1075 void link (boost::filesystem::path new_file) const;
1076 void copy_and_link (boost::filesystem::path new_file) const;
1077 bool have_write_permission () const;
1079 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1080 bool existing_template (std::string name) const;
1081 std::list<std::string> templates () const;
1082 boost::filesystem::path template_path (std::string name) const;
1083 void rename_template (std::string old_name, std::string new_name) const;
1084 void delete_template (std::string name) const;
1086 static Config* instance ();
1087 static void drop ();
1088 static void restore_defaults ();
1089 static bool have_existing (std::string);
1090 static boost::filesystem::path config_file ();
1095 void set_defaults ();
1096 void set_kdm_email_to_default ();
1097 void set_notification_email_to_default ();
1098 void set_cover_sheet_to_default ();
1099 void read_cinemas (cxml::Document const & f);
1100 void read_dkdm_recipients (cxml::Document const & f);
1101 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1102 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1103 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1104 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1108 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1109 if (member == new_value) {
1117 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1118 if (member && member.get() == new_value) {
1125 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1126 int _master_encoding_threads;
1127 /** number of threads which a server should use for J2K encoding on the local machine */
1128 int _server_encoding_threads;
1129 /** default directory to put new films in */
1130 boost::optional<boost::filesystem::path> _default_directory;
1131 /** base port number to use for J2K encoding servers;
1132 * this port and the two above it will be used.
1134 int _server_port_base;
1135 /** true to broadcast on the `any' address to look for servers */
1136 bool _use_any_servers;
1137 /** J2K encoding servers that should definitely be used */
1138 std::vector<std::string> _servers;
1139 bool _only_servers_encode;
1140 FileTransferProtocol _tms_protocol;
1141 /** The IP address of a TMS that we can copy DCPs to */
1142 std::string _tms_ip;
1143 /** The path on a TMS that we should write DCPs to */
1144 std::string _tms_path;
1145 /** User name to log into the TMS with */
1146 std::string _tms_user;
1147 /** Password to log into the TMS with */
1148 std::string _tms_password;
1149 /** The list of possible DCP frame rates that DCP-o-matic will use */
1150 std::list<int> _allowed_dcp_frame_rates;
1151 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1152 bool _allow_any_dcp_frame_rate;
1153 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1154 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1155 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1157 bool _allow_any_container;
1158 /** Offer the upmixers in the audio processor settings */
1159 bool _show_experimental_audio_processors;
1160 boost::optional<std::string> _language;
1161 /** Default length of still image content (seconds) */
1162 int _default_still_length;
1163 Ratio const * _default_container;
1164 DCPContentType const * _default_dcp_content_type;
1165 int _default_dcp_audio_channels;
1166 std::string _dcp_issuer;
1167 std::string _dcp_creator;
1168 std::string _dcp_company_name;
1169 std::string _dcp_product_name;
1170 std::string _dcp_product_version;
1171 std::string _dcp_j2k_comment;
1172 int _default_j2k_bandwidth;
1173 int _default_audio_delay;
1174 bool _default_interop;
1175 /** Default directory to offer to write KDMs to; if it's not set,
1176 the home directory will be offered.
1178 boost::optional<boost::filesystem::path> _default_kdm_directory;
1179 bool _upload_after_make_dcp;
1180 std::list<std::shared_ptr<Cinema> > _cinemas;
1181 std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1182 std::string _mail_server;
1184 EmailProtocol _mail_protocol;
1185 std::string _mail_user;
1186 std::string _mail_password;
1187 std::string _kdm_subject;
1188 std::string _kdm_from;
1189 std::vector<std::string> _kdm_cc;
1190 std::string _kdm_bcc;
1191 std::string _kdm_email;
1192 std::string _notification_subject;
1193 std::string _notification_from;
1194 std::string _notification_to;
1195 std::vector<std::string> _notification_cc;
1196 std::string _notification_bcc;
1197 std::string _notification_email;
1198 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1199 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1200 * certificate for making KDMs given to DCP-o-matic.
1202 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1203 /** true to check for updates on startup */
1204 bool _check_for_updates;
1205 bool _check_for_test_updates;
1206 /** maximum allowed J2K bandwidth in bits per second */
1207 int _maximum_j2k_bandwidth;
1209 bool _analyse_ebur128;
1210 bool _automatic_audio_analysis;
1211 #ifdef DCPOMATIC_WINDOWS
1212 bool _win32_console;
1214 std::vector<boost::filesystem::path> _history;
1215 std::vector<boost::filesystem::path> _player_history;
1216 std::shared_ptr<DKDMGroup> _dkdms;
1217 boost::filesystem::path _cinemas_file;
1218 boost::filesystem::path _dkdm_recipients_file;
1219 bool _show_hints_before_make_dcp;
1220 bool _confirm_kdm_email;
1221 dcp::NameFormat _kdm_filename_format;
1222 dcp::NameFormat _dkdm_filename_format;
1223 dcp::NameFormat _kdm_container_name_format;
1224 dcp::NameFormat _dcp_metadata_filename_format;
1225 dcp::NameFormat _dcp_asset_filename_format;
1226 bool _jump_to_selected;
1227 bool _nagged[NAG_COUNT];
1229 /** name of a specific sound output stream to use, or empty to use the default */
1230 boost::optional<std::string> _sound_output;
1231 std::string _cover_sheet;
1232 boost::optional<boost::filesystem::path> _last_player_load_directory;
1233 boost::optional<KDMWriteType> _last_kdm_write_type;
1234 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1235 int _frames_in_memory_multiplier;
1236 boost::optional<int> _decode_reduction;
1237 bool _default_notify;
1238 bool _notification[NOTIFICATION_COUNT];
1239 boost::optional<std::string> _barco_username;
1240 boost::optional<std::string> _barco_password;
1241 boost::optional<std::string> _christie_username;
1242 boost::optional<std::string> _christie_password;
1243 boost::optional<std::string> _gdc_username;
1244 boost::optional<std::string> _gdc_password;
1245 PlayerMode _player_mode;
1247 VideoViewType _video_view_type;
1248 bool _respect_kdm_validity_periods;
1249 /** Log file containing things the player does (e.g. started, stopped, loaded
1250 playlist etc.) Does not contain debugging information.
1252 boost::optional<boost::filesystem::path> _player_activity_log_file;
1253 /** Log file containing debug information for the player */
1254 boost::optional<boost::filesystem::path> _player_debug_log_file;
1255 /** A directory containing DCPs whose contents are presented to the user
1256 in the dual-screen player mode. DCPs on the list can be loaded
1259 boost::optional<boost::filesystem::path> _player_content_directory;
1260 boost::optional<boost::filesystem::path> _player_playlist_directory;
1261 boost::optional<boost::filesystem::path> _player_kdm_directory;
1262 boost::optional<AudioMapping> _audio_mapping;
1263 std::vector<dcp::LanguageTag> _custom_languages;
1265 static int const _current_version;
1267 /** Singleton instance, or 0 */
1268 static Config* _instance;