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;
84 PLAYER_CONTENT_DIRECTORY,
85 PLAYER_PLAYLIST_DIRECTORY,
88 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
90 #ifdef DCPOMATIC_VARIANT_SWAROOP
91 PLAYER_BACKGROUND_IMAGE,
96 /** @return base port number to use for J2K encoding servers */
97 int server_port_base () const {
98 return _server_port_base;
101 void set_use_any_servers (bool u) {
102 _use_any_servers = u;
103 changed (USE_ANY_SERVERS);
106 bool use_any_servers () const {
107 return _use_any_servers;
110 /** @param s New list of servers */
111 void set_servers (std::vector<std::string> s) {
116 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
117 std::vector<std::string> servers () const {
121 bool only_servers_encode () const {
122 return _only_servers_encode;
125 FileTransferProtocol tms_protocol () const {
126 return _tms_protocol;
129 /** @return The IP address of a TMS that we can copy DCPs to */
130 std::string tms_ip () const {
134 /** @return The path on a TMS that we should changed DCPs to */
135 std::string tms_path () const {
139 /** @return User name to log into the TMS with */
140 std::string tms_user () const {
144 /** @return Password to log into the TMS with */
145 std::string tms_password () const {
146 return _tms_password;
149 std::list<boost::shared_ptr<Cinema> > cinemas () const {
153 std::list<boost::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
154 return _dkdm_recipients;
157 std::list<int> allowed_dcp_frame_rates () const {
158 return _allowed_dcp_frame_rates;
161 bool allow_any_dcp_frame_rate () const {
162 return _allow_any_dcp_frame_rate;
165 bool allow_any_container () const {
166 return _allow_any_container;
169 bool show_experimental_audio_processors () const {
170 return _show_experimental_audio_processors;
173 ISDCFMetadata default_isdcf_metadata () const {
174 return _default_isdcf_metadata;
177 boost::optional<std::string> language () const {
181 int default_still_length () const {
182 return _default_still_length;
185 Ratio const * default_container () const {
186 return _default_container;
189 Ratio const * default_scale_to () const {
190 return _default_scale_to;
193 DCPContentType const * default_dcp_content_type () const {
194 return _default_dcp_content_type;
197 int default_dcp_audio_channels () const {
198 return _default_dcp_audio_channels;
201 std::string dcp_issuer () const {
205 std::string dcp_creator () const {
209 int default_j2k_bandwidth () const {
210 return _default_j2k_bandwidth;
213 int default_audio_delay () const {
214 return _default_audio_delay;
217 bool default_interop () const {
218 return _default_interop;
221 bool default_upload_after_make_dcp () {
222 return _default_upload_after_make_dcp;
225 void set_default_kdm_directory (boost::filesystem::path d) {
226 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
229 _default_kdm_directory = d;
233 std::string mail_server () const {
237 int mail_port () const {
241 EmailProtocol mail_protocol () const {
242 return _mail_protocol;
245 std::string mail_user () const {
249 std::string mail_password () const {
250 return _mail_password;
253 std::string kdm_subject () const {
257 std::string kdm_from () const {
261 std::vector<std::string> kdm_cc () const {
265 std::string kdm_bcc () const {
269 std::string kdm_email () const {
273 std::string notification_subject () const {
274 return _notification_subject;
277 std::string notification_from () const {
278 return _notification_from;
281 std::string notification_to () const {
282 return _notification_to;
285 std::vector<std::string> notification_cc () const {
286 return _notification_cc;
289 std::string notification_bcc () const {
290 return _notification_bcc;
293 std::string notification_email () const {
294 return _notification_email;
297 boost::shared_ptr<const dcp::CertificateChain> signer_chain () const {
298 return _signer_chain;
301 boost::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
302 return _decryption_chain;
305 bool check_for_updates () const {
306 return _check_for_updates;
309 bool check_for_test_updates () const {
310 return _check_for_test_updates;
313 int maximum_j2k_bandwidth () const {
314 return _maximum_j2k_bandwidth;
317 int log_types () const {
321 bool analyse_ebur128 () const {
322 return _analyse_ebur128;
325 bool automatic_audio_analysis () const {
326 return _automatic_audio_analysis;
329 #ifdef DCPOMATIC_WINDOWS
330 bool win32_console () const {
331 return _win32_console;
335 std::vector<boost::filesystem::path> history () const {
339 std::vector<boost::filesystem::path> player_history () const {
340 return _player_history;
343 boost::shared_ptr<DKDMGroup> dkdms () const {
347 boost::filesystem::path cinemas_file () const {
348 return _cinemas_file;
351 boost::filesystem::path dkdm_recipients_file () const {
352 return _dkdm_recipients_file;
355 bool show_hints_before_make_dcp () const {
356 return _show_hints_before_make_dcp;
359 bool confirm_kdm_email () const {
360 return _confirm_kdm_email;
363 dcp::NameFormat kdm_container_name_format () const {
364 return _kdm_container_name_format;
367 dcp::NameFormat kdm_filename_format () const {
368 return _kdm_filename_format;
371 dcp::NameFormat dkdm_filename_format () const {
372 return _dkdm_filename_format;
375 dcp::NameFormat dcp_metadata_filename_format () const {
376 return _dcp_metadata_filename_format;
379 dcp::NameFormat dcp_asset_filename_format () const {
380 return _dcp_asset_filename_format;
383 bool jump_to_selected () const {
384 return _jump_to_selected;
389 NAG_ENCRYPTED_METADATA,
390 NAG_ALTER_DECRYPTION_CHAIN,
391 NAG_BAD_SIGNER_CHAIN,
392 /* Not really a nag but it's the same idea */
394 NAG_IMPORT_DECRYPTION_CHAIN,
400 bool nagged (Nag nag) const {
404 bool sound () const {
408 std::string cover_sheet () const {
412 boost::optional<std::string> sound_output () const {
413 return _sound_output;
416 boost::optional<boost::filesystem::path> last_player_load_directory () const {
417 return _last_player_load_directory;
426 boost::optional<KDMWriteType> last_kdm_write_type () const {
427 return _last_kdm_write_type;
435 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
436 return _last_dkdm_write_type;
439 int frames_in_memory_multiplier () const {
440 return _frames_in_memory_multiplier;
443 boost::optional<int> decode_reduction () const {
444 return _decode_reduction;
447 bool default_notify () const {
448 return _default_notify;
457 bool notification (Notification n) const {
458 return _notification[n];
461 boost::optional<std::string> barco_username () const {
462 return _barco_username;
465 boost::optional<std::string> barco_password () const {
466 return _barco_password;
469 boost::optional<std::string> christie_username () const {
470 return _christie_username;
473 boost::optional<std::string> christie_password () const {
474 return _christie_password;
477 boost::optional<std::string> gdc_username () const {
478 return _gdc_username;
481 boost::optional<std::string> gdc_password () const {
482 return _gdc_password;
490 Interface interface_complexity () const {
491 return _interface_complexity;
495 PLAYER_MODE_WINDOW, ///< one window containing image and controls
496 PLAYER_MODE_FULL, ///< just the image filling the screen
497 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
500 PlayerMode player_mode () const {
504 int image_display () const {
505 return _image_display;
513 VideoViewType video_view_type () const {
514 return _video_view_type;
517 bool respect_kdm_validity_periods () const {
518 return _respect_kdm_validity_periods;
521 boost::optional<boost::filesystem::path> player_activity_log_file () const {
522 return _player_activity_log_file;
525 boost::optional<boost::filesystem::path> player_debug_log_file () const {
526 return _player_debug_log_file;
529 boost::optional<boost::filesystem::path> player_content_directory () const {
530 return _player_content_directory;
533 boost::optional<boost::filesystem::path> player_playlist_directory () const {
534 return _player_playlist_directory;
537 boost::optional<boost::filesystem::path> player_kdm_directory () const {
538 return _player_kdm_directory;
541 AudioMapping audio_mapping (int output_channels);
543 #ifdef DCPOMATIC_VARIANT_SWAROOP
544 boost::optional<boost::filesystem::path> player_background_image () const {
545 return _player_background_image;
548 std::string kdm_server_url () const {
549 return _kdm_server_url;
552 std::string player_watermark_theatre () const {
553 return _player_watermark_theatre;
556 int player_watermark_period () const {
557 return _player_watermark_period;
560 int player_watermark_duration () const {
561 return _player_watermark_duration;
564 std::vector<Monitor> required_monitors () const {
565 return _required_monitors;
568 boost::optional<boost::filesystem::path> player_lock_file () const {
569 return _player_lock_file;
575 void set_master_encoding_threads (int n) {
576 maybe_set (_master_encoding_threads, n);
579 void set_server_encoding_threads (int n) {
580 maybe_set (_server_encoding_threads, n);
583 void set_default_directory (boost::filesystem::path d) {
584 if (_default_directory && *_default_directory == d) {
587 _default_directory = d;
591 /** @param p New server port */
592 void set_server_port_base (int p) {
593 maybe_set (_server_port_base, p);
596 void set_only_servers_encode (bool o) {
597 maybe_set (_only_servers_encode, o);
600 void set_tms_protocol (FileTransferProtocol p) {
601 maybe_set (_tms_protocol, p);
604 /** @param i IP address of a TMS that we can copy DCPs to */
605 void set_tms_ip (std::string i) {
606 maybe_set (_tms_ip, i);
609 /** @param p Path on a TMS that we should changed DCPs to */
610 void set_tms_path (std::string p) {
611 maybe_set (_tms_path, p);
614 /** @param u User name to log into the TMS with */
615 void set_tms_user (std::string u) {
616 maybe_set (_tms_user, u);
619 /** @param p Password to log into the TMS with */
620 void set_tms_password (std::string p) {
621 maybe_set (_tms_password, p);
624 void add_cinema (boost::shared_ptr<Cinema> c) {
625 _cinemas.push_back (c);
629 void remove_cinema (boost::shared_ptr<Cinema> c) {
634 void add_dkdm_recipient (boost::shared_ptr<DKDMRecipient> c) {
635 _dkdm_recipients.push_back (c);
636 changed (DKDM_RECIPIENTS);
639 void remove_dkdm_recipient (boost::shared_ptr<DKDMRecipient> c) {
640 _dkdm_recipients.remove (c);
641 changed (DKDM_RECIPIENTS);
644 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
645 maybe_set (_allowed_dcp_frame_rates, r);
648 void set_allow_any_dcp_frame_rate (bool a) {
649 maybe_set (_allow_any_dcp_frame_rate, a);
652 void set_allow_any_container (bool a) {
653 maybe_set (_allow_any_container, a);
656 void set_show_experimental_audio_processors (bool e) {
657 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
660 void set_default_isdcf_metadata (ISDCFMetadata d) {
661 maybe_set (_default_isdcf_metadata, d);
664 void set_language (std::string l) {
665 if (_language && _language.get() == l) {
672 void unset_language () {
677 _language = boost::none;
681 void set_default_still_length (int s) {
682 maybe_set (_default_still_length, s);
685 void set_default_container (Ratio const * c) {
686 maybe_set (_default_container, c);
689 void set_default_scale_to (Ratio const * c) {
690 maybe_set (_default_scale_to, c);
693 void set_default_dcp_content_type (DCPContentType const * t) {
694 maybe_set (_default_dcp_content_type, t);
697 void set_default_dcp_audio_channels (int c) {
698 maybe_set (_default_dcp_audio_channels, c);
701 void set_dcp_issuer (std::string i) {
702 maybe_set (_dcp_issuer, i);
705 void set_dcp_creator (std::string c) {
706 maybe_set (_dcp_creator, c);
709 void set_default_j2k_bandwidth (int b) {
710 maybe_set (_default_j2k_bandwidth, b);
713 void set_default_audio_delay (int d) {
714 maybe_set (_default_audio_delay, d);
717 void set_default_interop (bool i) {
718 maybe_set (_default_interop, i);
721 void set_default_upload_after_make_dcp (bool u) {
722 maybe_set (_default_upload_after_make_dcp, u);
725 void set_mail_server (std::string s) {
726 maybe_set (_mail_server, s);
729 void set_mail_port (int p) {
730 maybe_set (_mail_port, p);
733 void set_mail_protocol (EmailProtocol p) {
734 maybe_set (_mail_protocol, p);
737 void set_mail_user (std::string u) {
738 maybe_set (_mail_user, u);
741 void set_mail_password (std::string p) {
742 maybe_set (_mail_password, p);
745 void set_kdm_subject (std::string s) {
746 maybe_set (_kdm_subject, s);
749 void set_kdm_from (std::string f) {
750 maybe_set (_kdm_from, f);
753 void set_kdm_cc (std::vector<std::string> f) {
754 maybe_set (_kdm_cc, f);
757 void set_kdm_bcc (std::string f) {
758 maybe_set (_kdm_bcc, f);
761 void set_kdm_email (std::string e) {
762 maybe_set (_kdm_email, e);
765 void reset_kdm_email ();
767 void set_notification_subject (std::string s) {
768 maybe_set (_notification_subject, s);
771 void set_notification_from (std::string f) {
772 maybe_set (_notification_from, f);
775 void set_notification_to (std::string t) {
776 maybe_set (_notification_to, t);
779 void set_notification_cc (std::vector<std::string> f) {
780 maybe_set (_notification_cc, f);
783 void set_notification_bcc (std::string f) {
784 maybe_set (_notification_bcc, f);
787 void set_notification_email (std::string e) {
788 maybe_set (_notification_email, e);
791 void reset_notification_email ();
793 void set_signer_chain (boost::shared_ptr<const dcp::CertificateChain> s) {
794 maybe_set (_signer_chain, s);
797 void set_decryption_chain (boost::shared_ptr<const dcp::CertificateChain> c) {
798 maybe_set (_decryption_chain, c);
801 void set_check_for_updates (bool c) {
802 maybe_set (_check_for_updates, c);
804 set_check_for_test_updates (false);
808 void set_check_for_test_updates (bool c) {
809 maybe_set (_check_for_test_updates, c);
812 void set_maximum_j2k_bandwidth (int b) {
813 maybe_set (_maximum_j2k_bandwidth, b);
816 void set_log_types (int t) {
817 maybe_set (_log_types, t);
820 void set_analyse_ebur128 (bool a) {
821 maybe_set (_analyse_ebur128, a);
824 void set_automatic_audio_analysis (bool a) {
825 maybe_set (_automatic_audio_analysis, a);
828 #ifdef DCPOMATIC_WINDOWS
829 void set_win32_console (bool c) {
830 maybe_set (_win32_console, c);
834 void set_dkdms (boost::shared_ptr<DKDMGroup> dkdms) {
839 void set_cinemas_file (boost::filesystem::path file);
841 void set_dkdm_recipients_file (boost::filesystem::path file);
843 void set_show_hints_before_make_dcp (bool s) {
844 maybe_set (_show_hints_before_make_dcp, s);
847 void set_confirm_kdm_email (bool s) {
848 maybe_set (_confirm_kdm_email, s);
851 void set_sound (bool s) {
852 maybe_set (_sound, s, SOUND);
855 void set_sound_output (std::string o) {
856 maybe_set (_sound_output, o, SOUND_OUTPUT);
859 void set_last_player_load_directory (boost::filesystem::path d) {
860 maybe_set (_last_player_load_directory, d);
863 void set_last_kdm_write_type (KDMWriteType t) {
864 maybe_set (_last_kdm_write_type, t);
867 void set_last_dkdm_write_type (DKDMWriteType t) {
868 maybe_set (_last_dkdm_write_type, t);
871 void unset_sound_output () {
872 if (!_sound_output) {
876 _sound_output = boost::none;
880 void set_kdm_container_name_format (dcp::NameFormat n) {
881 maybe_set (_kdm_container_name_format, n);
884 void set_kdm_filename_format (dcp::NameFormat n) {
885 maybe_set (_kdm_filename_format, n);
888 void set_dkdm_filename_format (dcp::NameFormat n) {
889 maybe_set (_dkdm_filename_format, n);
892 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
893 maybe_set (_dcp_metadata_filename_format, n);
896 void set_dcp_asset_filename_format (dcp::NameFormat n) {
897 maybe_set (_dcp_asset_filename_format, n);
900 void set_frames_in_memory_multiplier (int m) {
901 maybe_set (_frames_in_memory_multiplier, m);
904 void set_decode_reduction (boost::optional<int> r) {
905 maybe_set (_decode_reduction, r);
908 void set_default_notify (bool n) {
909 maybe_set (_default_notify, n);
912 void clear_history () {
917 void clear_player_history () {
918 _player_history.clear ();
922 void add_to_history (boost::filesystem::path p);
923 void clean_history ();
924 void add_to_player_history (boost::filesystem::path p);
925 void clean_player_history ();
927 void set_jump_to_selected (bool j) {
928 maybe_set (_jump_to_selected, j);
931 void set_nagged (Nag nag, bool nagged) {
932 maybe_set (_nagged[nag], nagged);
935 void set_cover_sheet (std::string s) {
936 maybe_set (_cover_sheet, s);
939 void reset_cover_sheet ();
941 void set_notification (Notification n, bool v) {
942 maybe_set (_notification[n], v);
945 void set_barco_username (std::string u) {
946 maybe_set (_barco_username, u);
949 void unset_barco_username () {
950 maybe_set (_barco_username, boost::optional<std::string>());
953 void set_barco_password (std::string p) {
954 maybe_set (_barco_password, p);
957 void unset_barco_password () {
958 maybe_set (_barco_password, boost::optional<std::string>());
961 void set_christie_username (std::string u) {
962 maybe_set (_christie_username, u);
965 void unset_christie_username () {
966 maybe_set (_christie_username, boost::optional<std::string>());
969 void set_christie_password (std::string p) {
970 maybe_set (_christie_password, p);
973 void unset_christie_password () {
974 maybe_set (_christie_password, boost::optional<std::string>());
977 void set_gdc_username (std::string u) {
978 maybe_set (_gdc_username, u);
981 void unset_gdc_username () {
982 maybe_set (_gdc_username, boost::optional<std::string>());
985 void set_gdc_password (std::string p) {
986 maybe_set (_gdc_password, p);
989 void unset_gdc_password () {
990 maybe_set (_gdc_password, boost::optional<std::string>());
993 void set_interface_complexity (Interface i) {
994 maybe_set (_interface_complexity, i, INTERFACE_COMPLEXITY);
997 void set_player_mode (PlayerMode m) {
998 maybe_set (_player_mode, m);
1001 void set_image_display (int n) {
1002 maybe_set (_image_display, n);
1005 void set_video_view_type (VideoViewType v) {
1006 maybe_set (_video_view_type, v);
1009 void set_respect_kdm_validity_periods (bool r) {
1010 maybe_set (_respect_kdm_validity_periods, r);
1013 void set_player_activity_log_file (boost::filesystem::path p) {
1014 maybe_set (_player_activity_log_file, p);
1017 void unset_player_activity_log_file () {
1018 if (!_player_activity_log_file) {
1021 _player_activity_log_file = boost::none;
1025 void set_player_debug_log_file (boost::filesystem::path p) {
1026 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1029 void unset_player_debug_log_file () {
1030 if (!_player_debug_log_file) {
1033 _player_debug_log_file = boost::none;
1034 changed (PLAYER_DEBUG_LOG);
1037 void set_player_content_directory (boost::filesystem::path p) {
1038 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1041 void unset_player_content_directory () {
1042 if (!_player_content_directory) {
1045 _player_content_directory = boost::none;
1046 changed (PLAYER_CONTENT_DIRECTORY);
1049 void set_player_playlist_directory (boost::filesystem::path p) {
1050 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1053 void unset_player_playlist_directory () {
1054 if (!_player_playlist_directory) {
1057 _player_playlist_directory = boost::none;
1058 changed (PLAYER_PLAYLIST_DIRECTORY);
1061 void set_player_kdm_directory (boost::filesystem::path p) {
1062 maybe_set (_player_kdm_directory, p);
1065 void unset_player_kdm_directory () {
1066 if (!_player_kdm_directory) {
1069 _player_kdm_directory = boost::none;
1073 void set_audio_mapping (AudioMapping m);
1074 void set_audio_mapping_to_default ();
1076 #ifdef DCPOMATIC_VARIANT_SWAROOP
1077 void set_player_background_image (boost::filesystem::path p) {
1078 maybe_set (_player_background_image, p, PLAYER_BACKGROUND_IMAGE);
1081 void unset_player_background_image () {
1082 if (!_player_background_image) {
1085 _player_background_image = boost::none;
1086 changed (PLAYER_BACKGROUND_IMAGE);
1089 void set_kdm_server_url (std::string s) {
1090 maybe_set (_kdm_server_url, s);
1093 void set_player_watermark_theatre (std::string p) {
1094 maybe_set (_player_watermark_theatre, p);
1097 void set_player_watermark_period (int minutes) {
1098 maybe_set (_player_watermark_period, minutes);
1101 void set_player_watermark_duration (int milliseconds) {
1102 maybe_set (_player_watermark_duration, milliseconds);
1105 void set_required_monitors (std::vector<Monitor> monitors) {
1106 maybe_set (_required_monitors, monitors);
1109 void set_player_lock_file (boost::filesystem::path p) {
1110 maybe_set (_player_lock_file, p);
1113 void unset_player_lock_file () {
1114 if (!_player_lock_file) {
1117 _player_lock_file = boost::none;
1122 void changed (Property p = OTHER);
1123 boost::signals2::signal<void (Property)> Changed;
1124 /** Emitted if read() failed on an existing Config file. There is nothing
1125 a listener can do about it: this is just for information.
1127 static boost::signals2::signal<void ()> FailedToLoad;
1128 /** Emitted if read() issued a warning which the user might want to know about */
1129 static boost::signals2::signal<void (std::string)> Warning;
1130 /** Emitted if there is a something wrong the contents of our config. Handler can call
1131 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1134 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1135 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1136 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1139 static boost::signals2::signal<bool (BadReason)> Bad;
1141 void write () const;
1142 void write_config () const;
1143 void write_cinemas () const;
1144 void write_dkdm_recipients () const;
1145 void link (boost::filesystem::path new_file) const;
1146 void copy_and_link (boost::filesystem::path new_file) const;
1147 bool have_write_permission () const;
1149 void save_template (boost::shared_ptr<const Film> film, std::string name) const;
1150 bool existing_template (std::string name) const;
1151 std::list<std::string> templates () const;
1152 boost::filesystem::path template_path (std::string name) const;
1153 void rename_template (std::string old_name, std::string new_name) const;
1154 void delete_template (std::string name) const;
1156 static Config* instance ();
1157 static void drop ();
1158 static void restore_defaults ();
1159 static bool have_existing (std::string);
1160 static boost::filesystem::path config_file ();
1165 void set_defaults ();
1166 void set_kdm_email_to_default ();
1167 void set_notification_email_to_default ();
1168 void set_cover_sheet_to_default ();
1169 void read_cinemas (cxml::Document const & f);
1170 void read_dkdm_recipients (cxml::Document const & f);
1171 boost::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1172 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1173 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1174 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1178 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1179 if (member == new_value) {
1187 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1188 if (member && member.get() == new_value) {
1195 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1196 int _master_encoding_threads;
1197 /** number of threads which a server should use for J2K encoding on the local machine */
1198 int _server_encoding_threads;
1199 /** default directory to put new films in */
1200 boost::optional<boost::filesystem::path> _default_directory;
1201 /** base port number to use for J2K encoding servers;
1202 * this port and the two above it will be used.
1204 int _server_port_base;
1205 /** true to broadcast on the `any' address to look for servers */
1206 bool _use_any_servers;
1207 /** J2K encoding servers that should definitely be used */
1208 std::vector<std::string> _servers;
1209 bool _only_servers_encode;
1210 FileTransferProtocol _tms_protocol;
1211 /** The IP address of a TMS that we can copy DCPs to */
1212 std::string _tms_ip;
1213 /** The path on a TMS that we should write DCPs to */
1214 std::string _tms_path;
1215 /** User name to log into the TMS with */
1216 std::string _tms_user;
1217 /** Password to log into the TMS with */
1218 std::string _tms_password;
1219 /** The list of possible DCP frame rates that DCP-o-matic will use */
1220 std::list<int> _allowed_dcp_frame_rates;
1221 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1222 bool _allow_any_dcp_frame_rate;
1223 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1224 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1225 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1227 bool _allow_any_container;
1228 /** Offer the upmixers in the audio processor settings */
1229 bool _show_experimental_audio_processors;
1230 /** Default ISDCF metadata for newly-created Films */
1231 ISDCFMetadata _default_isdcf_metadata;
1232 boost::optional<std::string> _language;
1233 /** Default length of still image content (seconds) */
1234 int _default_still_length;
1235 Ratio const * _default_container;
1236 Ratio const * _default_scale_to;
1237 DCPContentType const * _default_dcp_content_type;
1238 int _default_dcp_audio_channels;
1239 std::string _dcp_issuer;
1240 std::string _dcp_creator;
1241 int _default_j2k_bandwidth;
1242 int _default_audio_delay;
1243 bool _default_interop;
1244 /** Default directory to offer to write KDMs to; if it's not set,
1245 the home directory will be offered.
1247 boost::optional<boost::filesystem::path> _default_kdm_directory;
1248 bool _default_upload_after_make_dcp;
1249 std::list<boost::shared_ptr<Cinema> > _cinemas;
1250 std::list<boost::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1251 std::string _mail_server;
1253 EmailProtocol _mail_protocol;
1254 std::string _mail_user;
1255 std::string _mail_password;
1256 std::string _kdm_subject;
1257 std::string _kdm_from;
1258 std::vector<std::string> _kdm_cc;
1259 std::string _kdm_bcc;
1260 std::string _kdm_email;
1261 std::string _notification_subject;
1262 std::string _notification_from;
1263 std::string _notification_to;
1264 std::vector<std::string> _notification_cc;
1265 std::string _notification_bcc;
1266 std::string _notification_email;
1267 boost::shared_ptr<const dcp::CertificateChain> _signer_chain;
1268 #ifdef DCPOMATIC_VARIANT_SWAROOP
1269 boost::filesystem::path _signer_chain_path;
1271 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1272 * certificate for making KDMs given to DCP-o-matic.
1274 boost::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1275 #ifdef DCPOMATIC_VARIANT_SWAROOP
1276 boost::filesystem::path _decryption_chain_path;
1278 /** true to check for updates on startup */
1279 bool _check_for_updates;
1280 bool _check_for_test_updates;
1281 /** maximum allowed J2K bandwidth in bits per second */
1282 int _maximum_j2k_bandwidth;
1284 bool _analyse_ebur128;
1285 bool _automatic_audio_analysis;
1286 #ifdef DCPOMATIC_WINDOWS
1287 bool _win32_console;
1289 std::vector<boost::filesystem::path> _history;
1290 std::vector<boost::filesystem::path> _player_history;
1291 boost::shared_ptr<DKDMGroup> _dkdms;
1292 boost::filesystem::path _cinemas_file;
1293 boost::filesystem::path _dkdm_recipients_file;
1294 bool _show_hints_before_make_dcp;
1295 bool _confirm_kdm_email;
1296 dcp::NameFormat _kdm_filename_format;
1297 dcp::NameFormat _dkdm_filename_format;
1298 dcp::NameFormat _kdm_container_name_format;
1299 dcp::NameFormat _dcp_metadata_filename_format;
1300 dcp::NameFormat _dcp_asset_filename_format;
1301 bool _jump_to_selected;
1302 bool _nagged[NAG_COUNT];
1304 /** name of a specific sound output stream to use, or empty to use the default */
1305 boost::optional<std::string> _sound_output;
1306 std::string _cover_sheet;
1307 boost::optional<boost::filesystem::path> _last_player_load_directory;
1308 boost::optional<KDMWriteType> _last_kdm_write_type;
1309 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1310 int _frames_in_memory_multiplier;
1311 boost::optional<int> _decode_reduction;
1312 bool _default_notify;
1313 bool _notification[NOTIFICATION_COUNT];
1314 boost::optional<std::string> _barco_username;
1315 boost::optional<std::string> _barco_password;
1316 boost::optional<std::string> _christie_username;
1317 boost::optional<std::string> _christie_password;
1318 boost::optional<std::string> _gdc_username;
1319 boost::optional<std::string> _gdc_password;
1320 Interface _interface_complexity;
1321 PlayerMode _player_mode;
1323 VideoViewType _video_view_type;
1324 bool _respect_kdm_validity_periods;
1325 /** Log file containing things the player does (e.g. started, stopped, loaded
1326 playlist etc.) Does not contain debugging information.
1328 boost::optional<boost::filesystem::path> _player_activity_log_file;
1329 /** Log file containing debug information for the player */
1330 boost::optional<boost::filesystem::path> _player_debug_log_file;
1331 /** A directory containing DCPs whose contents are presented to the user
1332 in the dual-screen player mode. DCPs on the list can be loaded
1335 boost::optional<boost::filesystem::path> _player_content_directory;
1336 boost::optional<boost::filesystem::path> _player_playlist_directory;
1337 boost::optional<boost::filesystem::path> _player_kdm_directory;
1338 boost::optional<AudioMapping> _audio_mapping;
1339 #ifdef DCPOMATIC_VARIANT_SWAROOP
1340 boost::optional<boost::filesystem::path> _player_background_image;
1341 std::string _kdm_server_url;
1342 std::string _player_watermark_theatre;
1343 /** watermark period in minutes */
1344 int _player_watermark_period;
1345 /** watermark duration in milliseconds */
1346 int _player_watermark_duration;
1347 std::vector<Monitor> _required_monitors;
1348 /** a file which, if specified, must be present for the player to work */
1349 boost::optional<boost::filesystem::path> _player_lock_file;
1352 static int const _current_version;
1354 /** Singleton instance, or 0 */
1355 static Config* _instance;