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
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 <dcp/language_tag.h>
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<std::shared_ptr<Cinema> > cinemas () const {
149 std::list<std::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 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
306 return _signer_chain;
309 std::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 std::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);
540 int minimum_frame_size () const {
541 return _minimum_frame_size;
544 std::vector<dcp::LanguageTag> custom_languages () const {
545 return _custom_languages;
550 void set_master_encoding_threads (int n) {
551 maybe_set (_master_encoding_threads, n);
554 void set_server_encoding_threads (int n) {
555 maybe_set (_server_encoding_threads, n);
558 void set_default_directory (boost::filesystem::path d) {
559 if (_default_directory && *_default_directory == d) {
562 _default_directory = d;
566 /** @param p New server port */
567 void set_server_port_base (int p) {
568 maybe_set (_server_port_base, p);
571 void set_only_servers_encode (bool o) {
572 maybe_set (_only_servers_encode, o);
575 void set_tms_protocol (FileTransferProtocol p) {
576 maybe_set (_tms_protocol, p);
579 /** @param i IP address of a TMS that we can copy DCPs to */
580 void set_tms_ip (std::string i) {
581 maybe_set (_tms_ip, i);
584 /** @param p Path on a TMS that we should changed DCPs to */
585 void set_tms_path (std::string p) {
586 maybe_set (_tms_path, p);
589 /** @param u User name to log into the TMS with */
590 void set_tms_user (std::string u) {
591 maybe_set (_tms_user, u);
594 /** @param p Password to log into the TMS with */
595 void set_tms_password (std::string p) {
596 maybe_set (_tms_password, p);
599 void add_cinema (std::shared_ptr<Cinema> c) {
600 _cinemas.push_back (c);
604 void remove_cinema (std::shared_ptr<Cinema> c) {
609 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
610 _dkdm_recipients.push_back (c);
611 changed (DKDM_RECIPIENTS);
614 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
615 _dkdm_recipients.remove (c);
616 changed (DKDM_RECIPIENTS);
619 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
620 maybe_set (_allowed_dcp_frame_rates, r);
623 void set_allow_any_dcp_frame_rate (bool a) {
624 maybe_set (_allow_any_dcp_frame_rate, a);
627 void set_allow_any_container (bool a) {
628 maybe_set (_allow_any_container, a);
631 void set_show_experimental_audio_processors (bool e) {
632 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
635 void set_default_isdcf_metadata (ISDCFMetadata d) {
636 maybe_set (_default_isdcf_metadata, d);
639 void set_language (std::string l) {
640 if (_language && _language.get() == l) {
647 void unset_language () {
652 _language = boost::none;
656 void set_default_still_length (int s) {
657 maybe_set (_default_still_length, s);
660 void set_default_container (Ratio const * c) {
661 maybe_set (_default_container, c);
664 void set_default_dcp_content_type (DCPContentType const * t) {
665 maybe_set (_default_dcp_content_type, t);
668 void set_default_dcp_audio_channels (int c) {
669 maybe_set (_default_dcp_audio_channels, c);
672 void set_dcp_issuer (std::string i) {
673 maybe_set (_dcp_issuer, i);
676 void set_dcp_creator (std::string c) {
677 maybe_set (_dcp_creator, c);
680 void set_dcp_company_name (std::string c) {
681 maybe_set (_dcp_company_name, c);
684 void set_dcp_product_name (std::string c) {
685 maybe_set (_dcp_product_name, c);
688 void set_dcp_product_version (std::string c) {
689 maybe_set (_dcp_product_version, c);
692 void set_dcp_j2k_comment (std::string c) {
693 maybe_set (_dcp_j2k_comment, c);
696 void set_default_j2k_bandwidth (int b) {
697 maybe_set (_default_j2k_bandwidth, b);
700 void set_default_audio_delay (int d) {
701 maybe_set (_default_audio_delay, d);
704 void set_default_interop (bool i) {
705 maybe_set (_default_interop, i);
708 void set_upload_after_make_dcp (bool u) {
709 maybe_set (_upload_after_make_dcp, u);
712 void set_mail_server (std::string s) {
713 maybe_set (_mail_server, s);
716 void set_mail_port (int p) {
717 maybe_set (_mail_port, p);
720 void set_mail_protocol (EmailProtocol p) {
721 maybe_set (_mail_protocol, p);
724 void set_mail_user (std::string u) {
725 maybe_set (_mail_user, u);
728 void set_mail_password (std::string p) {
729 maybe_set (_mail_password, p);
732 void set_kdm_subject (std::string s) {
733 maybe_set (_kdm_subject, s);
736 void set_kdm_from (std::string f) {
737 maybe_set (_kdm_from, f);
740 void set_kdm_cc (std::vector<std::string> f) {
741 maybe_set (_kdm_cc, f);
744 void set_kdm_bcc (std::string f) {
745 maybe_set (_kdm_bcc, f);
748 void set_kdm_email (std::string e) {
749 maybe_set (_kdm_email, e);
752 void reset_kdm_email ();
754 void set_notification_subject (std::string s) {
755 maybe_set (_notification_subject, s);
758 void set_notification_from (std::string f) {
759 maybe_set (_notification_from, f);
762 void set_notification_to (std::string t) {
763 maybe_set (_notification_to, t);
766 void set_notification_cc (std::vector<std::string> f) {
767 maybe_set (_notification_cc, f);
770 void set_notification_bcc (std::string f) {
771 maybe_set (_notification_bcc, f);
774 void set_notification_email (std::string e) {
775 maybe_set (_notification_email, e);
778 void reset_notification_email ();
780 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
781 maybe_set (_signer_chain, s);
784 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
785 maybe_set (_decryption_chain, c);
788 void set_check_for_updates (bool c) {
789 maybe_set (_check_for_updates, c);
791 set_check_for_test_updates (false);
795 void set_check_for_test_updates (bool c) {
796 maybe_set (_check_for_test_updates, c);
799 void set_maximum_j2k_bandwidth (int b) {
800 maybe_set (_maximum_j2k_bandwidth, b);
803 void set_log_types (int t) {
804 maybe_set (_log_types, t);
807 void set_analyse_ebur128 (bool a) {
808 maybe_set (_analyse_ebur128, a);
811 void set_automatic_audio_analysis (bool a) {
812 maybe_set (_automatic_audio_analysis, a);
815 #ifdef DCPOMATIC_WINDOWS
816 void set_win32_console (bool c) {
817 maybe_set (_win32_console, c);
821 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
826 void set_cinemas_file (boost::filesystem::path file);
828 void set_dkdm_recipients_file (boost::filesystem::path file);
830 void set_show_hints_before_make_dcp (bool s) {
831 maybe_set (_show_hints_before_make_dcp, s);
834 void set_confirm_kdm_email (bool s) {
835 maybe_set (_confirm_kdm_email, s);
838 void set_sound (bool s) {
839 maybe_set (_sound, s, SOUND);
842 void set_sound_output (std::string o) {
843 maybe_set (_sound_output, o, SOUND_OUTPUT);
846 void set_last_player_load_directory (boost::filesystem::path d) {
847 maybe_set (_last_player_load_directory, d);
850 void set_last_kdm_write_type (KDMWriteType t) {
851 maybe_set (_last_kdm_write_type, t);
854 void set_last_dkdm_write_type (DKDMWriteType t) {
855 maybe_set (_last_dkdm_write_type, t);
858 void unset_sound_output () {
859 if (!_sound_output) {
863 _sound_output = boost::none;
867 void set_kdm_container_name_format (dcp::NameFormat n) {
868 maybe_set (_kdm_container_name_format, n);
871 void set_kdm_filename_format (dcp::NameFormat n) {
872 maybe_set (_kdm_filename_format, n);
875 void set_dkdm_filename_format (dcp::NameFormat n) {
876 maybe_set (_dkdm_filename_format, n);
879 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
880 maybe_set (_dcp_metadata_filename_format, n);
883 void set_dcp_asset_filename_format (dcp::NameFormat n) {
884 maybe_set (_dcp_asset_filename_format, n);
887 void set_frames_in_memory_multiplier (int m) {
888 maybe_set (_frames_in_memory_multiplier, m);
891 void set_decode_reduction (boost::optional<int> r) {
892 maybe_set (_decode_reduction, r);
895 void set_default_notify (bool n) {
896 maybe_set (_default_notify, n);
899 void clear_history () {
904 void clear_player_history () {
905 _player_history.clear ();
909 void add_to_history (boost::filesystem::path p);
910 void clean_history ();
911 void add_to_player_history (boost::filesystem::path p);
912 void clean_player_history ();
914 void set_jump_to_selected (bool j) {
915 maybe_set (_jump_to_selected, j);
918 void set_nagged (Nag nag, bool nagged) {
919 maybe_set (_nagged[nag], nagged);
922 void set_cover_sheet (std::string s) {
923 maybe_set (_cover_sheet, s);
926 void reset_cover_sheet ();
928 void set_notification (Notification n, bool v) {
929 maybe_set (_notification[n], v);
932 void set_barco_username (std::string u) {
933 maybe_set (_barco_username, u);
936 void unset_barco_username () {
937 maybe_set (_barco_username, boost::optional<std::string>());
940 void set_barco_password (std::string p) {
941 maybe_set (_barco_password, p);
944 void unset_barco_password () {
945 maybe_set (_barco_password, boost::optional<std::string>());
948 void set_christie_username (std::string u) {
949 maybe_set (_christie_username, u);
952 void unset_christie_username () {
953 maybe_set (_christie_username, boost::optional<std::string>());
956 void set_christie_password (std::string p) {
957 maybe_set (_christie_password, p);
960 void unset_christie_password () {
961 maybe_set (_christie_password, boost::optional<std::string>());
964 void set_gdc_username (std::string u) {
965 maybe_set (_gdc_username, u);
968 void unset_gdc_username () {
969 maybe_set (_gdc_username, boost::optional<std::string>());
972 void set_gdc_password (std::string p) {
973 maybe_set (_gdc_password, p);
976 void unset_gdc_password () {
977 maybe_set (_gdc_password, boost::optional<std::string>());
980 void set_player_mode (PlayerMode m) {
981 maybe_set (_player_mode, m);
984 void set_image_display (int n) {
985 maybe_set (_image_display, n);
988 void set_video_view_type (VideoViewType v) {
989 maybe_set (_video_view_type, v);
992 void set_respect_kdm_validity_periods (bool r) {
993 maybe_set (_respect_kdm_validity_periods, r);
996 void set_player_activity_log_file (boost::filesystem::path p) {
997 maybe_set (_player_activity_log_file, p);
1000 void unset_player_activity_log_file () {
1001 if (!_player_activity_log_file) {
1004 _player_activity_log_file = boost::none;
1008 void set_player_debug_log_file (boost::filesystem::path p) {
1009 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1012 void unset_player_debug_log_file () {
1013 if (!_player_debug_log_file) {
1016 _player_debug_log_file = boost::none;
1017 changed (PLAYER_DEBUG_LOG);
1020 void set_player_content_directory (boost::filesystem::path p) {
1021 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1024 void unset_player_content_directory () {
1025 if (!_player_content_directory) {
1028 _player_content_directory = boost::none;
1029 changed (PLAYER_CONTENT_DIRECTORY);
1032 void set_player_playlist_directory (boost::filesystem::path p) {
1033 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1036 void unset_player_playlist_directory () {
1037 if (!_player_playlist_directory) {
1040 _player_playlist_directory = boost::none;
1041 changed (PLAYER_PLAYLIST_DIRECTORY);
1044 void set_player_kdm_directory (boost::filesystem::path p) {
1045 maybe_set (_player_kdm_directory, p);
1048 void unset_player_kdm_directory () {
1049 if (!_player_kdm_directory) {
1052 _player_kdm_directory = boost::none;
1056 void set_audio_mapping (AudioMapping m);
1057 void set_audio_mapping_to_default ();
1059 void set_minimum_frame_size (int size) {
1060 maybe_set (_minimum_frame_size, size);
1063 void add_custom_language (dcp::LanguageTag tag);
1065 void changed (Property p = OTHER);
1066 boost::signals2::signal<void (Property)> Changed;
1067 /** Emitted if read() failed on an existing Config file. There is nothing
1068 a listener can do about it: this is just for information.
1070 static boost::signals2::signal<void ()> FailedToLoad;
1071 /** Emitted if read() issued a warning which the user might want to know about */
1072 static boost::signals2::signal<void (std::string)> Warning;
1073 /** Emitted if there is a something wrong the contents of our config. Handler can call
1074 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1077 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1078 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1079 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1082 static boost::signals2::signal<bool (BadReason)> Bad;
1084 void write () const;
1085 void write_config () const;
1086 void write_cinemas () const;
1087 void write_dkdm_recipients () const;
1088 void link (boost::filesystem::path new_file) const;
1089 void copy_and_link (boost::filesystem::path new_file) const;
1090 bool have_write_permission () const;
1092 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1093 bool existing_template (std::string name) const;
1094 std::list<std::string> templates () const;
1095 boost::filesystem::path template_path (std::string name) const;
1096 void rename_template (std::string old_name, std::string new_name) const;
1097 void delete_template (std::string name) const;
1099 static Config* instance ();
1100 static void drop ();
1101 static void restore_defaults ();
1102 static bool have_existing (std::string);
1103 static boost::filesystem::path config_file ();
1108 void set_defaults ();
1109 void set_kdm_email_to_default ();
1110 void set_notification_email_to_default ();
1111 void set_cover_sheet_to_default ();
1112 void read_cinemas (cxml::Document const & f);
1113 void read_dkdm_recipients (cxml::Document const & f);
1114 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1115 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1116 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1117 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1121 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1122 if (member == new_value) {
1130 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1131 if (member && member.get() == new_value) {
1138 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1139 int _master_encoding_threads;
1140 /** number of threads which a server should use for J2K encoding on the local machine */
1141 int _server_encoding_threads;
1142 /** default directory to put new films in */
1143 boost::optional<boost::filesystem::path> _default_directory;
1144 /** base port number to use for J2K encoding servers;
1145 * this port and the two above it will be used.
1147 int _server_port_base;
1148 /** true to broadcast on the `any' address to look for servers */
1149 bool _use_any_servers;
1150 /** J2K encoding servers that should definitely be used */
1151 std::vector<std::string> _servers;
1152 bool _only_servers_encode;
1153 FileTransferProtocol _tms_protocol;
1154 /** The IP address of a TMS that we can copy DCPs to */
1155 std::string _tms_ip;
1156 /** The path on a TMS that we should write DCPs to */
1157 std::string _tms_path;
1158 /** User name to log into the TMS with */
1159 std::string _tms_user;
1160 /** Password to log into the TMS with */
1161 std::string _tms_password;
1162 /** The list of possible DCP frame rates that DCP-o-matic will use */
1163 std::list<int> _allowed_dcp_frame_rates;
1164 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1165 bool _allow_any_dcp_frame_rate;
1166 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1167 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1168 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1170 bool _allow_any_container;
1171 /** Offer the upmixers in the audio processor settings */
1172 bool _show_experimental_audio_processors;
1173 /** Default ISDCF metadata for newly-created Films */
1174 ISDCFMetadata _default_isdcf_metadata;
1175 boost::optional<std::string> _language;
1176 /** Default length of still image content (seconds) */
1177 int _default_still_length;
1178 Ratio const * _default_container;
1179 DCPContentType const * _default_dcp_content_type;
1180 int _default_dcp_audio_channels;
1181 std::string _dcp_issuer;
1182 std::string _dcp_creator;
1183 std::string _dcp_company_name;
1184 std::string _dcp_product_name;
1185 std::string _dcp_product_version;
1186 std::string _dcp_j2k_comment;
1187 int _default_j2k_bandwidth;
1188 int _default_audio_delay;
1189 bool _default_interop;
1190 /** Default directory to offer to write KDMs to; if it's not set,
1191 the home directory will be offered.
1193 boost::optional<boost::filesystem::path> _default_kdm_directory;
1194 bool _upload_after_make_dcp;
1195 std::list<std::shared_ptr<Cinema> > _cinemas;
1196 std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1197 std::string _mail_server;
1199 EmailProtocol _mail_protocol;
1200 std::string _mail_user;
1201 std::string _mail_password;
1202 std::string _kdm_subject;
1203 std::string _kdm_from;
1204 std::vector<std::string> _kdm_cc;
1205 std::string _kdm_bcc;
1206 std::string _kdm_email;
1207 std::string _notification_subject;
1208 std::string _notification_from;
1209 std::string _notification_to;
1210 std::vector<std::string> _notification_cc;
1211 std::string _notification_bcc;
1212 std::string _notification_email;
1213 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1214 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1215 * certificate for making KDMs given to DCP-o-matic.
1217 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1218 /** true to check for updates on startup */
1219 bool _check_for_updates;
1220 bool _check_for_test_updates;
1221 /** maximum allowed J2K bandwidth in bits per second */
1222 int _maximum_j2k_bandwidth;
1224 bool _analyse_ebur128;
1225 bool _automatic_audio_analysis;
1226 #ifdef DCPOMATIC_WINDOWS
1227 bool _win32_console;
1229 std::vector<boost::filesystem::path> _history;
1230 std::vector<boost::filesystem::path> _player_history;
1231 std::shared_ptr<DKDMGroup> _dkdms;
1232 boost::filesystem::path _cinemas_file;
1233 boost::filesystem::path _dkdm_recipients_file;
1234 bool _show_hints_before_make_dcp;
1235 bool _confirm_kdm_email;
1236 dcp::NameFormat _kdm_filename_format;
1237 dcp::NameFormat _dkdm_filename_format;
1238 dcp::NameFormat _kdm_container_name_format;
1239 dcp::NameFormat _dcp_metadata_filename_format;
1240 dcp::NameFormat _dcp_asset_filename_format;
1241 bool _jump_to_selected;
1242 bool _nagged[NAG_COUNT];
1244 /** name of a specific sound output stream to use, or empty to use the default */
1245 boost::optional<std::string> _sound_output;
1246 std::string _cover_sheet;
1247 boost::optional<boost::filesystem::path> _last_player_load_directory;
1248 boost::optional<KDMWriteType> _last_kdm_write_type;
1249 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1250 int _frames_in_memory_multiplier;
1251 boost::optional<int> _decode_reduction;
1252 bool _default_notify;
1253 bool _notification[NOTIFICATION_COUNT];
1254 boost::optional<std::string> _barco_username;
1255 boost::optional<std::string> _barco_password;
1256 boost::optional<std::string> _christie_username;
1257 boost::optional<std::string> _christie_password;
1258 boost::optional<std::string> _gdc_username;
1259 boost::optional<std::string> _gdc_password;
1260 PlayerMode _player_mode;
1262 VideoViewType _video_view_type;
1263 bool _respect_kdm_validity_periods;
1264 /** Log file containing things the player does (e.g. started, stopped, loaded
1265 playlist etc.) Does not contain debugging information.
1267 boost::optional<boost::filesystem::path> _player_activity_log_file;
1268 /** Log file containing debug information for the player */
1269 boost::optional<boost::filesystem::path> _player_debug_log_file;
1270 /** A directory containing DCPs whose contents are presented to the user
1271 in the dual-screen player mode. DCPs on the list can be loaded
1274 boost::optional<boost::filesystem::path> _player_content_directory;
1275 boost::optional<boost::filesystem::path> _player_playlist_directory;
1276 boost::optional<boost::filesystem::path> _player_kdm_directory;
1277 boost::optional<AudioMapping> _audio_mapping;
1278 int _minimum_frame_size;
1279 std::vector<dcp::LanguageTag> _custom_languages;
1281 static int const _current_version;
1283 /** Singleton instance, or 0 */
1284 static Config* _instance;