2 Copyright (C) 2012-2022 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.
26 #ifndef DCPOMATIC_CONFIG_H
27 #define DCPOMATIC_CONFIG_H
30 #include "audio_mapping.h"
31 #include "export_config.h"
32 #include "rough_duration.h"
35 #include <dcp/name_format.h>
36 #include <dcp/certificate_chain.h>
37 #include <dcp/encrypted_kdm.h>
38 #include <dcp/language_tag.h>
39 #include <boost/signals2.hpp>
40 #include <boost/filesystem.hpp>
45 class CinemaSoundProcessor;
53 extern void save_all_config_as_zip (boost::filesystem::path zip_file);
57 * @brief A singleton class holding configuration.
59 class Config : public State
62 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
63 int master_encoding_threads () const {
64 return _master_encoding_threads;
67 /** @return number of threads which a server should use for J2K encoding on the local machine */
68 int server_encoding_threads () const {
69 return _server_encoding_threads;
72 boost::optional<boost::filesystem::path> default_directory () const {
73 return _default_directory;
76 boost::optional<boost::filesystem::path> default_kdm_directory () const {
77 return _default_kdm_directory;
80 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
81 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
90 PLAYER_CONTENT_DIRECTORY,
91 PLAYER_PLAYLIST_DIRECTORY,
94 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
100 /** @return base port number to use for J2K encoding servers */
101 int server_port_base () const {
102 return _server_port_base;
105 void set_use_any_servers (bool u) {
106 _use_any_servers = u;
107 changed (USE_ANY_SERVERS);
110 bool use_any_servers () const {
111 return _use_any_servers;
114 /** @param s New list of servers */
115 void set_servers (std::vector<std::string> s) {
120 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
121 std::vector<std::string> servers () const {
125 bool only_servers_encode () const {
126 return _only_servers_encode;
129 FileTransferProtocol tms_protocol () const {
130 return _tms_protocol;
133 /** @return The IP address of a TMS that we can copy DCPs to */
134 std::string tms_ip () const {
138 /** @return The path on a TMS that we should changed DCPs to */
139 std::string tms_path () const {
143 /** @return User name to log into the TMS with */
144 std::string tms_user () const {
148 /** @return Password to log into the TMS with */
149 std::string tms_password () const {
150 return _tms_password;
153 std::list<std::shared_ptr<Cinema>> cinemas () const {
157 std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
158 return _dkdm_recipients;
161 std::list<int> allowed_dcp_frame_rates () const {
162 return _allowed_dcp_frame_rates;
165 bool allow_any_dcp_frame_rate () const {
166 return _allow_any_dcp_frame_rate;
169 bool allow_any_container () const {
170 return _allow_any_container;
173 bool allow_96khz_audio () const {
174 return _allow_96khz_audio;
177 bool use_all_audio_channels () const {
178 return _use_all_audio_channels;
181 bool show_experimental_audio_processors () const {
182 return _show_experimental_audio_processors;
185 boost::optional<std::string> language () const {
189 int default_still_length () const {
190 return _default_still_length;
193 Ratio const * default_container () const {
194 return _default_container;
197 DCPContentType const * default_dcp_content_type () const {
198 return _default_dcp_content_type;
201 int default_dcp_audio_channels () const {
202 return _default_dcp_audio_channels;
205 std::string dcp_issuer () const {
209 std::string dcp_creator () const {
213 std::string dcp_company_name () const {
214 return _dcp_company_name;
217 std::string dcp_product_name () const {
218 return _dcp_product_name;
221 std::string dcp_product_version () const {
222 return _dcp_product_version;
225 std::string dcp_j2k_comment () const {
226 return _dcp_j2k_comment;
229 int default_j2k_bandwidth () const {
230 return _default_j2k_bandwidth;
233 int default_audio_delay () const {
234 return _default_audio_delay;
237 bool default_interop () const {
238 return _default_interop;
241 std::map<std::string, std::string> default_metadata () const {
242 return _default_metadata;
245 bool upload_after_make_dcp () {
246 return _upload_after_make_dcp;
249 void set_default_kdm_directory (boost::filesystem::path d) {
250 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
253 _default_kdm_directory = d;
257 std::string mail_server () const {
261 int mail_port () const {
265 EmailProtocol mail_protocol () const {
266 return _mail_protocol;
269 std::string mail_user () const {
273 std::string mail_password () const {
274 return _mail_password;
277 std::string kdm_subject () const {
281 std::string kdm_from () const {
285 std::vector<std::string> kdm_cc () const {
289 std::string kdm_bcc () const {
293 std::string kdm_email () const {
297 std::string notification_subject () const {
298 return _notification_subject;
301 std::string notification_from () const {
302 return _notification_from;
305 std::string notification_to () const {
306 return _notification_to;
309 std::vector<std::string> notification_cc () const {
310 return _notification_cc;
313 std::string notification_bcc () const {
314 return _notification_bcc;
317 std::string notification_email () const {
318 return _notification_email;
321 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
322 return _signer_chain;
325 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
326 return _decryption_chain;
329 bool check_for_updates () const {
330 return _check_for_updates;
333 bool check_for_test_updates () const {
334 return _check_for_test_updates;
337 int maximum_j2k_bandwidth () const {
338 return _maximum_j2k_bandwidth;
341 int log_types () const {
345 bool analyse_ebur128 () const {
346 return _analyse_ebur128;
349 bool automatic_audio_analysis () const {
350 return _automatic_audio_analysis;
353 #ifdef DCPOMATIC_WINDOWS
354 bool win32_console () const {
355 return _win32_console;
359 std::vector<boost::filesystem::path> history () const {
363 std::vector<boost::filesystem::path> player_history () const {
364 return _player_history;
367 std::shared_ptr<DKDMGroup> dkdms () const {
371 boost::filesystem::path cinemas_file () const {
372 return _cinemas_file;
375 boost::filesystem::path dkdm_recipients_file () const {
376 return _dkdm_recipients_file;
379 bool show_hints_before_make_dcp () const {
380 return _show_hints_before_make_dcp;
383 bool confirm_kdm_email () const {
384 return _confirm_kdm_email;
387 dcp::NameFormat kdm_container_name_format () const {
388 return _kdm_container_name_format;
391 dcp::NameFormat kdm_filename_format () const {
392 return _kdm_filename_format;
395 dcp::NameFormat dkdm_filename_format () const {
396 return _dkdm_filename_format;
399 dcp::NameFormat dcp_metadata_filename_format () const {
400 return _dcp_metadata_filename_format;
403 dcp::NameFormat dcp_asset_filename_format () const {
404 return _dcp_asset_filename_format;
407 bool jump_to_selected () const {
408 return _jump_to_selected;
411 /* This could be an enum class but we use the enum a lot to index _nagged
412 * so it means a lot of casts.
416 NAG_ENCRYPTED_METADATA,
417 NAG_ALTER_DECRYPTION_CHAIN,
418 NAG_BAD_SIGNER_CHAIN_UTF8,
419 NAG_IMPORT_DECRYPTION_CHAIN,
422 NAG_TOO_MANY_DROPPED_FRAMES,
423 NAG_BAD_SIGNER_CHAIN_VALIDITY,
427 bool nagged (Nag nag) const {
431 bool sound () const {
435 std::string cover_sheet () const {
439 boost::optional<std::string> sound_output () const {
440 return _sound_output;
443 boost::optional<boost::filesystem::path> last_player_load_directory () const {
444 return _last_player_load_directory;
453 boost::optional<KDMWriteType> last_kdm_write_type () const {
454 return _last_kdm_write_type;
462 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
463 return _last_dkdm_write_type;
466 int frames_in_memory_multiplier () const {
467 return _frames_in_memory_multiplier;
470 boost::optional<int> decode_reduction () const {
471 return _decode_reduction;
474 bool default_notify () const {
475 return _default_notify;
484 bool notification (Notification n) const {
485 return _notification[n];
488 boost::optional<std::string> barco_username () const {
489 return _barco_username;
492 boost::optional<std::string> barco_password () const {
493 return _barco_password;
496 boost::optional<std::string> christie_username () const {
497 return _christie_username;
500 boost::optional<std::string> christie_password () const {
501 return _christie_password;
504 boost::optional<std::string> gdc_username () const {
505 return _gdc_username;
508 boost::optional<std::string> gdc_password () const {
509 return _gdc_password;
513 PLAYER_MODE_WINDOW, ///< one window containing image and controls
514 PLAYER_MODE_FULL, ///< just the image filling the screen
515 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
518 PlayerMode player_mode () const {
522 int image_display () const {
523 return _image_display;
531 VideoViewType video_view_type () const {
532 return _video_view_type;
535 bool respect_kdm_validity_periods () const {
536 return _respect_kdm_validity_periods;
539 boost::optional<boost::filesystem::path> player_debug_log_file () const {
540 return _player_debug_log_file;
543 boost::optional<boost::filesystem::path> player_content_directory () const {
544 return _player_content_directory;
547 boost::optional<boost::filesystem::path> player_playlist_directory () const {
548 return _player_playlist_directory;
551 boost::optional<boost::filesystem::path> player_kdm_directory () const {
552 return _player_kdm_directory;
555 AudioMapping audio_mapping (int output_channels);
557 std::vector<dcp::LanguageTag> custom_languages () const {
558 return _custom_languages;
561 boost::optional<boost::filesystem::path> add_files_path () const {
562 return _add_files_path;
565 bool use_isdcf_name_by_default () const {
566 return _use_isdcf_name_by_default;
569 bool write_kdms_to_disk () const {
570 return _write_kdms_to_disk;
573 bool email_kdms () const {
577 dcp::Formulation default_kdm_type () const {
578 return _default_kdm_type;
581 RoughDuration default_kdm_duration () const {
582 return _default_kdm_duration;
585 double auto_crop_threshold () const {
586 return _auto_crop_threshold;
589 boost::optional<std::string> last_release_notes_version () const {
590 return _last_release_notes_version;
595 void set_master_encoding_threads (int n) {
596 maybe_set (_master_encoding_threads, n);
599 void set_server_encoding_threads (int n) {
600 maybe_set (_server_encoding_threads, n);
603 void set_default_directory (boost::filesystem::path d) {
604 if (_default_directory && *_default_directory == d) {
607 _default_directory = d;
611 /** @param p New server port */
612 void set_server_port_base (int p) {
613 maybe_set (_server_port_base, p);
616 void set_only_servers_encode (bool o) {
617 maybe_set (_only_servers_encode, o);
620 void set_tms_protocol (FileTransferProtocol p) {
621 maybe_set (_tms_protocol, p);
624 /** @param i IP address of a TMS that we can copy DCPs to */
625 void set_tms_ip (std::string i) {
626 maybe_set (_tms_ip, i);
629 /** @param p Path on a TMS that we should changed DCPs to */
630 void set_tms_path (std::string p) {
631 maybe_set (_tms_path, p);
634 /** @param u User name to log into the TMS with */
635 void set_tms_user (std::string u) {
636 maybe_set (_tms_user, u);
639 /** @param p Password to log into the TMS with */
640 void set_tms_password (std::string p) {
641 maybe_set (_tms_password, p);
644 void add_cinema (std::shared_ptr<Cinema> c) {
645 _cinemas.push_back (c);
649 void remove_cinema (std::shared_ptr<Cinema> c) {
654 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
655 _dkdm_recipients.push_back (c);
656 changed (DKDM_RECIPIENTS);
659 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
660 _dkdm_recipients.remove (c);
661 changed (DKDM_RECIPIENTS);
664 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
665 maybe_set (_allowed_dcp_frame_rates, r);
668 void set_allow_any_dcp_frame_rate (bool a) {
669 maybe_set (_allow_any_dcp_frame_rate, a);
672 void set_allow_any_container (bool a) {
673 maybe_set (_allow_any_container, a);
676 void set_allow_96hhz_audio (bool a) {
677 maybe_set (_allow_96khz_audio, a);
680 void set_use_all_audio_channels (bool a) {
681 maybe_set (_use_all_audio_channels, a);
684 void set_show_experimental_audio_processors (bool e) {
685 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
688 void set_language (std::string l) {
689 if (_language && _language.get() == l) {
696 void unset_language () {
701 _language = boost::none;
705 void set_default_still_length (int s) {
706 maybe_set (_default_still_length, s);
709 void set_default_container (Ratio const * c) {
710 maybe_set (_default_container, c);
713 void set_default_dcp_content_type (DCPContentType const * t) {
714 maybe_set (_default_dcp_content_type, t);
717 void set_default_dcp_audio_channels (int c) {
718 maybe_set (_default_dcp_audio_channels, c);
721 void set_dcp_issuer (std::string i) {
722 maybe_set (_dcp_issuer, i);
725 void set_dcp_creator (std::string c) {
726 maybe_set (_dcp_creator, c);
729 void set_dcp_company_name (std::string c) {
730 maybe_set (_dcp_company_name, c);
733 void set_dcp_product_name (std::string c) {
734 maybe_set (_dcp_product_name, c);
737 void set_dcp_product_version (std::string c) {
738 maybe_set (_dcp_product_version, c);
741 void set_dcp_j2k_comment (std::string c) {
742 maybe_set (_dcp_j2k_comment, c);
745 void set_default_j2k_bandwidth (int b) {
746 maybe_set (_default_j2k_bandwidth, b);
749 void set_default_audio_delay (int d) {
750 maybe_set (_default_audio_delay, d);
753 void set_default_interop (bool i) {
754 maybe_set (_default_interop, i);
757 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
758 maybe_set (_default_metadata, metadata);
761 void set_upload_after_make_dcp (bool u) {
762 maybe_set (_upload_after_make_dcp, u);
765 void set_mail_server (std::string s) {
766 maybe_set (_mail_server, s);
769 void set_mail_port (int p) {
770 maybe_set (_mail_port, p);
773 void set_mail_protocol (EmailProtocol p) {
774 maybe_set (_mail_protocol, p);
777 void set_mail_user (std::string u) {
778 maybe_set (_mail_user, u);
781 void set_mail_password (std::string p) {
782 maybe_set (_mail_password, p);
785 void set_kdm_subject (std::string s) {
786 maybe_set (_kdm_subject, s);
789 void set_kdm_from (std::string f) {
790 maybe_set (_kdm_from, f);
793 void set_kdm_cc (std::vector<std::string> f) {
794 maybe_set (_kdm_cc, f);
797 void set_kdm_bcc (std::string f) {
798 maybe_set (_kdm_bcc, f);
801 void set_kdm_email (std::string e) {
802 maybe_set (_kdm_email, e);
805 void reset_kdm_email ();
807 void set_notification_subject (std::string s) {
808 maybe_set (_notification_subject, s);
811 void set_notification_from (std::string f) {
812 maybe_set (_notification_from, f);
815 void set_notification_to (std::string t) {
816 maybe_set (_notification_to, t);
819 void set_notification_cc (std::vector<std::string> f) {
820 maybe_set (_notification_cc, f);
823 void set_notification_bcc (std::string f) {
824 maybe_set (_notification_bcc, f);
827 void set_notification_email (std::string e) {
828 maybe_set (_notification_email, e);
831 void reset_notification_email ();
833 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
834 maybe_set (_signer_chain, s);
837 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
838 maybe_set (_decryption_chain, c);
841 void set_check_for_updates (bool c) {
842 maybe_set (_check_for_updates, c);
844 set_check_for_test_updates (false);
848 void set_check_for_test_updates (bool c) {
849 maybe_set (_check_for_test_updates, c);
852 void set_maximum_j2k_bandwidth (int b) {
853 maybe_set (_maximum_j2k_bandwidth, b);
856 void set_log_types (int t) {
857 maybe_set (_log_types, t);
860 void set_analyse_ebur128 (bool a) {
861 maybe_set (_analyse_ebur128, a);
864 void set_automatic_audio_analysis (bool a) {
865 maybe_set (_automatic_audio_analysis, a);
868 #ifdef DCPOMATIC_WINDOWS
869 void set_win32_console (bool c) {
870 maybe_set (_win32_console, c);
874 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
879 void set_cinemas_file (boost::filesystem::path file);
881 void set_show_hints_before_make_dcp (bool s) {
882 maybe_set (_show_hints_before_make_dcp, s);
885 void set_confirm_kdm_email (bool s) {
886 maybe_set (_confirm_kdm_email, s);
889 void set_sound (bool s) {
890 maybe_set (_sound, s, SOUND);
893 void set_sound_output (std::string o) {
894 maybe_set (_sound_output, o, SOUND_OUTPUT);
897 void set_last_player_load_directory (boost::filesystem::path d) {
898 maybe_set (_last_player_load_directory, d);
901 void set_last_kdm_write_type (KDMWriteType t) {
902 maybe_set (_last_kdm_write_type, t);
905 void set_last_dkdm_write_type (DKDMWriteType t) {
906 maybe_set (_last_dkdm_write_type, t);
909 void unset_sound_output () {
910 if (!_sound_output) {
914 _sound_output = boost::none;
918 void set_kdm_container_name_format (dcp::NameFormat n) {
919 maybe_set (_kdm_container_name_format, n);
922 void set_kdm_filename_format (dcp::NameFormat n) {
923 maybe_set (_kdm_filename_format, n);
926 void set_dkdm_filename_format (dcp::NameFormat n) {
927 maybe_set (_dkdm_filename_format, n);
930 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
931 maybe_set (_dcp_metadata_filename_format, n);
934 void set_dcp_asset_filename_format (dcp::NameFormat n) {
935 maybe_set (_dcp_asset_filename_format, n);
938 void set_frames_in_memory_multiplier (int m) {
939 maybe_set (_frames_in_memory_multiplier, m);
942 void set_decode_reduction (boost::optional<int> r) {
943 maybe_set (_decode_reduction, r);
946 void set_default_notify (bool n) {
947 maybe_set (_default_notify, n);
950 void clear_history () {
955 void clear_player_history () {
956 _player_history.clear ();
960 void add_to_history (boost::filesystem::path p);
961 void clean_history ();
962 void add_to_player_history (boost::filesystem::path p);
963 void clean_player_history ();
965 void set_jump_to_selected (bool j) {
966 maybe_set (_jump_to_selected, j);
969 void set_nagged (Nag nag, bool nagged) {
970 maybe_set (_nagged[nag], nagged);
973 void set_cover_sheet (std::string s) {
974 maybe_set (_cover_sheet, s);
977 void reset_cover_sheet ();
979 void set_notification (Notification n, bool v) {
980 maybe_set (_notification[n], v);
983 void set_barco_username (std::string u) {
984 maybe_set (_barco_username, u);
987 void unset_barco_username () {
988 maybe_set (_barco_username, boost::optional<std::string>());
991 void set_barco_password (std::string p) {
992 maybe_set (_barco_password, p);
995 void unset_barco_password () {
996 maybe_set (_barco_password, boost::optional<std::string>());
999 void set_christie_username (std::string u) {
1000 maybe_set (_christie_username, u);
1003 void unset_christie_username () {
1004 maybe_set (_christie_username, boost::optional<std::string>());
1007 void set_christie_password (std::string p) {
1008 maybe_set (_christie_password, p);
1011 void unset_christie_password () {
1012 maybe_set (_christie_password, boost::optional<std::string>());
1015 void set_gdc_username (std::string u) {
1016 maybe_set (_gdc_username, u);
1019 void unset_gdc_username () {
1020 maybe_set (_gdc_username, boost::optional<std::string>());
1023 void set_gdc_password (std::string p) {
1024 maybe_set (_gdc_password, p);
1027 void unset_gdc_password () {
1028 maybe_set (_gdc_password, boost::optional<std::string>());
1031 void set_player_mode (PlayerMode m) {
1032 maybe_set (_player_mode, m);
1035 void set_image_display (int n) {
1036 maybe_set (_image_display, n);
1039 void set_video_view_type (VideoViewType v) {
1040 maybe_set (_video_view_type, v);
1043 void set_respect_kdm_validity_periods (bool r) {
1044 maybe_set (_respect_kdm_validity_periods, r);
1047 void set_player_debug_log_file (boost::filesystem::path p) {
1048 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1051 void unset_player_debug_log_file () {
1052 if (!_player_debug_log_file) {
1055 _player_debug_log_file = boost::none;
1056 changed (PLAYER_DEBUG_LOG);
1059 void set_player_content_directory (boost::filesystem::path p) {
1060 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1063 void unset_player_content_directory () {
1064 if (!_player_content_directory) {
1067 _player_content_directory = boost::none;
1068 changed (PLAYER_CONTENT_DIRECTORY);
1071 void set_player_playlist_directory (boost::filesystem::path p) {
1072 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1075 void unset_player_playlist_directory () {
1076 if (!_player_playlist_directory) {
1079 _player_playlist_directory = boost::none;
1080 changed (PLAYER_PLAYLIST_DIRECTORY);
1083 void set_player_kdm_directory (boost::filesystem::path p) {
1084 maybe_set (_player_kdm_directory, p);
1087 void unset_player_kdm_directory () {
1088 if (!_player_kdm_directory) {
1091 _player_kdm_directory = boost::none;
1095 void set_audio_mapping (AudioMapping m);
1096 void set_audio_mapping_to_default ();
1098 void add_custom_language (dcp::LanguageTag tag);
1100 void set_add_files_path (boost::filesystem::path p) {
1101 _add_files_path = p;
1105 void set_use_isdcf_name_by_default (bool use) {
1106 maybe_set (_use_isdcf_name_by_default, use);
1109 void set_write_kdms_to_disk (bool write) {
1110 maybe_set (_write_kdms_to_disk, write);
1113 void set_email_kdms (bool email) {
1114 maybe_set (_email_kdms, email);
1117 void set_default_kdm_type (dcp::Formulation type) {
1118 maybe_set (_default_kdm_type, type);
1121 void set_default_kdm_duration (RoughDuration duration) {
1122 maybe_set (_default_kdm_duration, duration);
1125 void set_auto_crop_threshold (double threshold) {
1126 maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
1129 void set_last_release_notes_version (std::string version) {
1130 maybe_set (_last_release_notes_version, version);
1133 void unset_last_release_notes_version() {
1134 maybe_set(_last_release_notes_version, boost::optional<std::string>());
1137 ExportConfig& export_config() {
1141 void changed (Property p = OTHER);
1142 boost::signals2::signal<void (Property)> Changed;
1143 /** Emitted if read() failed on an existing Config file. There is nothing
1144 a listener can do about it: this is just for information.
1146 enum class LoadFailure {
1151 static boost::signals2::signal<void (LoadFailure)> FailedToLoad;
1152 /** Emitted if read() issued a warning which the user might want to know about */
1153 static boost::signals2::signal<void (std::string)> Warning;
1154 /** Emitted if there is a something wrong the contents of our config. Handler can call
1155 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1158 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1159 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1160 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1161 BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
1164 static boost::signals2::signal<bool (BadReason)> Bad;
1166 void write () const override;
1167 void write_config () const;
1168 void write_cinemas () const;
1169 void write_dkdm_recipients () const;
1170 void link (boost::filesystem::path new_file) const;
1171 void copy_and_link (boost::filesystem::path new_file) const;
1172 bool have_write_permission () const;
1174 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1175 bool existing_template (std::string name) const;
1176 std::list<std::string> templates () const;
1177 boost::filesystem::path template_read_path (std::string name) const;
1178 boost::filesystem::path template_write_path (std::string name) const;
1179 void rename_template (std::string old_name, std::string new_name) const;
1180 void delete_template (std::string name) const;
1182 boost::optional<BadReason> check_certificates () const;
1184 static Config* instance ();
1185 static void drop ();
1186 static void restore_defaults ();
1187 static bool have_existing (std::string);
1188 static boost::filesystem::path config_read_file ();
1189 static boost::filesystem::path config_write_file ();
1192 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1193 if (member == new_value) {
1201 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1202 if (member && member.get() == new_value) {
1211 void read () override;
1213 void read_cinemas();
1214 void read_dkdm_recipients();
1215 void set_defaults ();
1216 void set_kdm_email_to_default ();
1217 void set_notification_email_to_default ();
1218 void set_cover_sheet_to_default ();
1219 void read_cinemas (cxml::Document const & f);
1220 void read_dkdm_recipients (cxml::Document const & f);
1221 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1222 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1223 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1224 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1227 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1228 int _master_encoding_threads;
1229 /** number of threads which a server should use for J2K encoding on the local machine */
1230 int _server_encoding_threads;
1231 /** default directory to put new films in */
1232 boost::optional<boost::filesystem::path> _default_directory;
1233 /** base port number to use for J2K encoding servers;
1234 * this port and the two above it will be used.
1236 int _server_port_base;
1237 /** true to broadcast on the `any' address to look for servers */
1238 bool _use_any_servers;
1239 /** J2K encoding servers that should definitely be used */
1240 std::vector<std::string> _servers;
1241 bool _only_servers_encode;
1242 FileTransferProtocol _tms_protocol;
1243 /** The IP address of a TMS that we can copy DCPs to */
1244 std::string _tms_ip;
1245 /** The path on a TMS that we should write DCPs to */
1246 std::string _tms_path;
1247 /** User name to log into the TMS with */
1248 std::string _tms_user;
1249 /** Password to log into the TMS with */
1250 std::string _tms_password;
1251 /** The list of possible DCP frame rates that DCP-o-matic will use */
1252 std::list<int> _allowed_dcp_frame_rates;
1253 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1254 bool _allow_any_dcp_frame_rate;
1255 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1256 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1257 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1259 bool _allow_any_container;
1260 bool _allow_96khz_audio;
1261 bool _use_all_audio_channels;
1262 /** Offer the upmixers in the audio processor settings */
1263 bool _show_experimental_audio_processors;
1264 boost::optional<std::string> _language;
1265 /** Default length of still image content (seconds) */
1266 int _default_still_length;
1267 Ratio const * _default_container;
1268 DCPContentType const * _default_dcp_content_type;
1269 int _default_dcp_audio_channels;
1270 std::string _dcp_issuer;
1271 std::string _dcp_creator;
1272 std::string _dcp_company_name;
1273 std::string _dcp_product_name;
1274 std::string _dcp_product_version;
1275 std::string _dcp_j2k_comment;
1276 int _default_j2k_bandwidth;
1277 int _default_audio_delay;
1278 bool _default_interop;
1279 std::map<std::string, std::string> _default_metadata;
1280 /** Default directory to offer to write KDMs to; if it's not set,
1281 the home directory will be offered.
1283 boost::optional<boost::filesystem::path> _default_kdm_directory;
1284 bool _upload_after_make_dcp;
1285 std::list<std::shared_ptr<Cinema>> _cinemas;
1286 std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
1287 std::string _mail_server;
1289 EmailProtocol _mail_protocol;
1290 std::string _mail_user;
1291 std::string _mail_password;
1292 std::string _kdm_subject;
1293 std::string _kdm_from;
1294 std::vector<std::string> _kdm_cc;
1295 std::string _kdm_bcc;
1296 std::string _kdm_email;
1297 std::string _notification_subject;
1298 std::string _notification_from;
1299 std::string _notification_to;
1300 std::vector<std::string> _notification_cc;
1301 std::string _notification_bcc;
1302 std::string _notification_email;
1303 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1304 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1305 * certificate for making KDMs given to DCP-o-matic.
1307 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1308 /** true to check for updates on startup */
1309 bool _check_for_updates;
1310 bool _check_for_test_updates;
1311 /** maximum allowed J2K bandwidth in bits per second */
1312 int _maximum_j2k_bandwidth;
1314 bool _analyse_ebur128;
1315 bool _automatic_audio_analysis;
1316 #ifdef DCPOMATIC_WINDOWS
1317 bool _win32_console;
1319 std::vector<boost::filesystem::path> _history;
1320 std::vector<boost::filesystem::path> _player_history;
1321 std::shared_ptr<DKDMGroup> _dkdms;
1322 boost::filesystem::path _cinemas_file;
1323 boost::filesystem::path _dkdm_recipients_file;
1324 bool _show_hints_before_make_dcp;
1325 bool _confirm_kdm_email;
1326 dcp::NameFormat _kdm_filename_format;
1327 dcp::NameFormat _dkdm_filename_format;
1328 dcp::NameFormat _kdm_container_name_format;
1329 dcp::NameFormat _dcp_metadata_filename_format;
1330 dcp::NameFormat _dcp_asset_filename_format;
1331 bool _jump_to_selected;
1332 bool _nagged[NAG_COUNT];
1334 /** name of a specific sound output stream to use, or empty to use the default */
1335 boost::optional<std::string> _sound_output;
1336 std::string _cover_sheet;
1337 boost::optional<boost::filesystem::path> _last_player_load_directory;
1338 boost::optional<KDMWriteType> _last_kdm_write_type;
1339 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1340 int _frames_in_memory_multiplier;
1341 boost::optional<int> _decode_reduction;
1342 bool _default_notify;
1343 bool _notification[NOTIFICATION_COUNT];
1344 boost::optional<std::string> _barco_username;
1345 boost::optional<std::string> _barco_password;
1346 boost::optional<std::string> _christie_username;
1347 boost::optional<std::string> _christie_password;
1348 boost::optional<std::string> _gdc_username;
1349 boost::optional<std::string> _gdc_password;
1350 PlayerMode _player_mode;
1352 VideoViewType _video_view_type;
1353 bool _respect_kdm_validity_periods;
1354 /** Log file containing debug information for the player */
1355 boost::optional<boost::filesystem::path> _player_debug_log_file;
1356 /** A directory containing DCPs whose contents are presented to the user
1357 in the dual-screen player mode. DCPs on the list can be loaded
1360 boost::optional<boost::filesystem::path> _player_content_directory;
1361 boost::optional<boost::filesystem::path> _player_playlist_directory;
1362 boost::optional<boost::filesystem::path> _player_kdm_directory;
1363 boost::optional<AudioMapping> _audio_mapping;
1364 std::vector<dcp::LanguageTag> _custom_languages;
1365 boost::optional<boost::filesystem::path> _add_files_path;
1366 bool _use_isdcf_name_by_default;
1367 bool _write_kdms_to_disk;
1369 dcp::Formulation _default_kdm_type;
1370 RoughDuration _default_kdm_duration;
1371 double _auto_crop_threshold;
1372 boost::optional<std::string> _last_release_notes_version;
1374 ExportConfig _export;
1376 static int const _current_version;
1378 /** Singleton instance, or 0 */
1379 static Config* _instance;