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"
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>
43 class CinemaSoundProcessor;
51 extern void save_all_config_as_zip (boost::filesystem::path zip_file);
55 * @brief A singleton class holding configuration.
57 class Config : public State
60 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
61 int master_encoding_threads () const {
62 return _master_encoding_threads;
65 /** @return number of threads which a server should use for J2K encoding on the local machine */
66 int server_encoding_threads () const {
67 return _server_encoding_threads;
70 boost::optional<boost::filesystem::path> default_directory () const {
71 return _default_directory;
74 boost::optional<boost::filesystem::path> default_kdm_directory () const {
75 return _default_kdm_directory;
78 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
79 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
88 PLAYER_CONTENT_DIRECTORY,
89 PLAYER_PLAYLIST_DIRECTORY,
92 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
97 /** @return base port number to use for J2K encoding servers */
98 int server_port_base () const {
99 return _server_port_base;
102 void set_use_any_servers (bool u) {
103 _use_any_servers = u;
104 changed (USE_ANY_SERVERS);
107 bool use_any_servers () const {
108 return _use_any_servers;
111 /** @param s New list of servers */
112 void set_servers (std::vector<std::string> s) {
117 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
118 std::vector<std::string> servers () const {
122 bool only_servers_encode () const {
123 return _only_servers_encode;
126 FileTransferProtocol tms_protocol () const {
127 return _tms_protocol;
130 /** @return The IP address of a TMS that we can copy DCPs to */
131 std::string tms_ip () const {
135 /** @return The path on a TMS that we should changed DCPs to */
136 std::string tms_path () const {
140 /** @return User name to log into the TMS with */
141 std::string tms_user () const {
145 /** @return Password to log into the TMS with */
146 std::string tms_password () const {
147 return _tms_password;
150 std::list<std::shared_ptr<Cinema>> cinemas () const {
154 std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
155 return _dkdm_recipients;
158 std::list<int> allowed_dcp_frame_rates () const {
159 return _allowed_dcp_frame_rates;
162 bool allow_any_dcp_frame_rate () const {
163 return _allow_any_dcp_frame_rate;
166 bool allow_any_container () const {
167 return _allow_any_container;
170 bool show_experimental_audio_processors () const {
171 return _show_experimental_audio_processors;
174 boost::optional<std::string> language () const {
178 int default_still_length () const {
179 return _default_still_length;
182 Ratio const * default_container () const {
183 return _default_container;
186 DCPContentType const * default_dcp_content_type () const {
187 return _default_dcp_content_type;
190 int default_dcp_audio_channels () const {
191 return _default_dcp_audio_channels;
194 std::string dcp_issuer () const {
198 std::string dcp_creator () const {
202 std::string dcp_company_name () const {
203 return _dcp_company_name;
206 std::string dcp_product_name () const {
207 return _dcp_product_name;
210 std::string dcp_product_version () const {
211 return _dcp_product_version;
214 std::string dcp_j2k_comment () const {
215 return _dcp_j2k_comment;
218 int default_j2k_bandwidth () const {
219 return _default_j2k_bandwidth;
222 int default_audio_delay () const {
223 return _default_audio_delay;
226 bool default_interop () const {
227 return _default_interop;
230 std::map<std::string, std::string> default_metadata () const {
231 return _default_metadata;
234 bool upload_after_make_dcp () {
235 return _upload_after_make_dcp;
238 void set_default_kdm_directory (boost::filesystem::path d) {
239 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
242 _default_kdm_directory = d;
246 std::string mail_server () const {
250 int mail_port () const {
254 EmailProtocol mail_protocol () const {
255 return _mail_protocol;
258 std::string mail_user () const {
262 std::string mail_password () const {
263 return _mail_password;
266 std::string kdm_subject () const {
270 std::string kdm_from () const {
274 std::vector<std::string> kdm_cc () const {
278 std::string kdm_bcc () const {
282 std::string kdm_email () const {
286 std::string notification_subject () const {
287 return _notification_subject;
290 std::string notification_from () const {
291 return _notification_from;
294 std::string notification_to () const {
295 return _notification_to;
298 std::vector<std::string> notification_cc () const {
299 return _notification_cc;
302 std::string notification_bcc () const {
303 return _notification_bcc;
306 std::string notification_email () const {
307 return _notification_email;
310 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
311 return _signer_chain;
314 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
315 return _decryption_chain;
318 bool check_for_updates () const {
319 return _check_for_updates;
322 bool check_for_test_updates () const {
323 return _check_for_test_updates;
326 int maximum_j2k_bandwidth () const {
327 return _maximum_j2k_bandwidth;
330 int log_types () const {
334 bool analyse_ebur128 () const {
335 return _analyse_ebur128;
338 bool automatic_audio_analysis () const {
339 return _automatic_audio_analysis;
342 #ifdef DCPOMATIC_WINDOWS
343 bool win32_console () const {
344 return _win32_console;
348 std::vector<boost::filesystem::path> history () const {
352 std::vector<boost::filesystem::path> player_history () const {
353 return _player_history;
356 std::shared_ptr<DKDMGroup> dkdms () const {
360 boost::filesystem::path cinemas_file () const {
361 return _cinemas_file;
364 boost::filesystem::path dkdm_recipients_file () const {
365 return _dkdm_recipients_file;
368 bool show_hints_before_make_dcp () const {
369 return _show_hints_before_make_dcp;
372 bool confirm_kdm_email () const {
373 return _confirm_kdm_email;
376 dcp::NameFormat kdm_container_name_format () const {
377 return _kdm_container_name_format;
380 dcp::NameFormat kdm_filename_format () const {
381 return _kdm_filename_format;
384 dcp::NameFormat dkdm_filename_format () const {
385 return _dkdm_filename_format;
388 dcp::NameFormat dcp_metadata_filename_format () const {
389 return _dcp_metadata_filename_format;
392 dcp::NameFormat dcp_asset_filename_format () const {
393 return _dcp_asset_filename_format;
396 bool jump_to_selected () const {
397 return _jump_to_selected;
400 /* This could be an enum class but we use the enum a lot to index _nagged
401 * so it means a lot of casts.
405 NAG_ENCRYPTED_METADATA,
406 NAG_ALTER_DECRYPTION_CHAIN,
407 NAG_BAD_SIGNER_CHAIN_UTF8,
408 NAG_IMPORT_DECRYPTION_CHAIN,
411 NAG_TOO_MANY_DROPPED_FRAMES,
412 NAG_BAD_SIGNER_CHAIN_VALIDITY,
416 bool nagged (Nag nag) const {
420 bool sound () const {
424 std::string cover_sheet () const {
428 boost::optional<std::string> sound_output () const {
429 return _sound_output;
432 boost::optional<boost::filesystem::path> last_player_load_directory () const {
433 return _last_player_load_directory;
442 boost::optional<KDMWriteType> last_kdm_write_type () const {
443 return _last_kdm_write_type;
451 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
452 return _last_dkdm_write_type;
455 int frames_in_memory_multiplier () const {
456 return _frames_in_memory_multiplier;
459 boost::optional<int> decode_reduction () const {
460 return _decode_reduction;
463 bool default_notify () const {
464 return _default_notify;
473 bool notification (Notification n) const {
474 return _notification[n];
477 boost::optional<std::string> barco_username () const {
478 return _barco_username;
481 boost::optional<std::string> barco_password () const {
482 return _barco_password;
485 boost::optional<std::string> christie_username () const {
486 return _christie_username;
489 boost::optional<std::string> christie_password () const {
490 return _christie_password;
493 boost::optional<std::string> gdc_username () const {
494 return _gdc_username;
497 boost::optional<std::string> gdc_password () const {
498 return _gdc_password;
502 PLAYER_MODE_WINDOW, ///< one window containing image and controls
503 PLAYER_MODE_FULL, ///< just the image filling the screen
504 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
507 PlayerMode player_mode () const {
511 int image_display () const {
512 return _image_display;
520 VideoViewType video_view_type () const {
521 return _video_view_type;
524 bool respect_kdm_validity_periods () const {
525 return _respect_kdm_validity_periods;
528 boost::optional<boost::filesystem::path> player_debug_log_file () const {
529 return _player_debug_log_file;
532 boost::optional<boost::filesystem::path> player_content_directory () const {
533 return _player_content_directory;
536 boost::optional<boost::filesystem::path> player_playlist_directory () const {
537 return _player_playlist_directory;
540 boost::optional<boost::filesystem::path> player_kdm_directory () const {
541 return _player_kdm_directory;
544 AudioMapping audio_mapping (int output_channels);
546 std::vector<dcp::LanguageTag> custom_languages () const {
547 return _custom_languages;
550 boost::optional<boost::filesystem::path> add_files_path () const {
551 return _add_files_path;
554 bool use_isdcf_name_by_default () const {
555 return _use_isdcf_name_by_default;
558 bool write_kdms_to_disk () const {
559 return _write_kdms_to_disk;
562 bool email_kdms () const {
566 dcp::Formulation default_kdm_type () const {
567 return _default_kdm_type;
573 void set_master_encoding_threads (int n) {
574 maybe_set (_master_encoding_threads, n);
577 void set_server_encoding_threads (int n) {
578 maybe_set (_server_encoding_threads, n);
581 void set_default_directory (boost::filesystem::path d) {
582 if (_default_directory && *_default_directory == d) {
585 _default_directory = d;
589 /** @param p New server port */
590 void set_server_port_base (int p) {
591 maybe_set (_server_port_base, p);
594 void set_only_servers_encode (bool o) {
595 maybe_set (_only_servers_encode, o);
598 void set_tms_protocol (FileTransferProtocol p) {
599 maybe_set (_tms_protocol, p);
602 /** @param i IP address of a TMS that we can copy DCPs to */
603 void set_tms_ip (std::string i) {
604 maybe_set (_tms_ip, i);
607 /** @param p Path on a TMS that we should changed DCPs to */
608 void set_tms_path (std::string p) {
609 maybe_set (_tms_path, p);
612 /** @param u User name to log into the TMS with */
613 void set_tms_user (std::string u) {
614 maybe_set (_tms_user, u);
617 /** @param p Password to log into the TMS with */
618 void set_tms_password (std::string p) {
619 maybe_set (_tms_password, p);
622 void add_cinema (std::shared_ptr<Cinema> c) {
623 _cinemas.push_back (c);
627 void remove_cinema (std::shared_ptr<Cinema> c) {
632 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
633 _dkdm_recipients.push_back (c);
634 changed (DKDM_RECIPIENTS);
637 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
638 _dkdm_recipients.remove (c);
639 changed (DKDM_RECIPIENTS);
642 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
643 maybe_set (_allowed_dcp_frame_rates, r);
646 void set_allow_any_dcp_frame_rate (bool a) {
647 maybe_set (_allow_any_dcp_frame_rate, a);
650 void set_allow_any_container (bool a) {
651 maybe_set (_allow_any_container, a);
654 void set_show_experimental_audio_processors (bool e) {
655 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
658 void set_language (std::string l) {
659 if (_language && _language.get() == l) {
666 void unset_language () {
671 _language = boost::none;
675 void set_default_still_length (int s) {
676 maybe_set (_default_still_length, s);
679 void set_default_container (Ratio const * c) {
680 maybe_set (_default_container, c);
683 void set_default_dcp_content_type (DCPContentType const * t) {
684 maybe_set (_default_dcp_content_type, t);
687 void set_default_dcp_audio_channels (int c) {
688 maybe_set (_default_dcp_audio_channels, c);
691 void set_dcp_issuer (std::string i) {
692 maybe_set (_dcp_issuer, i);
695 void set_dcp_creator (std::string c) {
696 maybe_set (_dcp_creator, c);
699 void set_dcp_company_name (std::string c) {
700 maybe_set (_dcp_company_name, c);
703 void set_dcp_product_name (std::string c) {
704 maybe_set (_dcp_product_name, c);
707 void set_dcp_product_version (std::string c) {
708 maybe_set (_dcp_product_version, c);
711 void set_dcp_j2k_comment (std::string c) {
712 maybe_set (_dcp_j2k_comment, c);
715 void set_default_j2k_bandwidth (int b) {
716 maybe_set (_default_j2k_bandwidth, b);
719 void set_default_audio_delay (int d) {
720 maybe_set (_default_audio_delay, d);
723 void set_default_interop (bool i) {
724 maybe_set (_default_interop, i);
727 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
728 maybe_set (_default_metadata, metadata);
731 void set_upload_after_make_dcp (bool u) {
732 maybe_set (_upload_after_make_dcp, u);
735 void set_mail_server (std::string s) {
736 maybe_set (_mail_server, s);
739 void set_mail_port (int p) {
740 maybe_set (_mail_port, p);
743 void set_mail_protocol (EmailProtocol p) {
744 maybe_set (_mail_protocol, p);
747 void set_mail_user (std::string u) {
748 maybe_set (_mail_user, u);
751 void set_mail_password (std::string p) {
752 maybe_set (_mail_password, p);
755 void set_kdm_subject (std::string s) {
756 maybe_set (_kdm_subject, s);
759 void set_kdm_from (std::string f) {
760 maybe_set (_kdm_from, f);
763 void set_kdm_cc (std::vector<std::string> f) {
764 maybe_set (_kdm_cc, f);
767 void set_kdm_bcc (std::string f) {
768 maybe_set (_kdm_bcc, f);
771 void set_kdm_email (std::string e) {
772 maybe_set (_kdm_email, e);
775 void reset_kdm_email ();
777 void set_notification_subject (std::string s) {
778 maybe_set (_notification_subject, s);
781 void set_notification_from (std::string f) {
782 maybe_set (_notification_from, f);
785 void set_notification_to (std::string t) {
786 maybe_set (_notification_to, t);
789 void set_notification_cc (std::vector<std::string> f) {
790 maybe_set (_notification_cc, f);
793 void set_notification_bcc (std::string f) {
794 maybe_set (_notification_bcc, f);
797 void set_notification_email (std::string e) {
798 maybe_set (_notification_email, e);
801 void reset_notification_email ();
803 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
804 maybe_set (_signer_chain, s);
807 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
808 maybe_set (_decryption_chain, c);
811 void set_check_for_updates (bool c) {
812 maybe_set (_check_for_updates, c);
814 set_check_for_test_updates (false);
818 void set_check_for_test_updates (bool c) {
819 maybe_set (_check_for_test_updates, c);
822 void set_maximum_j2k_bandwidth (int b) {
823 maybe_set (_maximum_j2k_bandwidth, b);
826 void set_log_types (int t) {
827 maybe_set (_log_types, t);
830 void set_analyse_ebur128 (bool a) {
831 maybe_set (_analyse_ebur128, a);
834 void set_automatic_audio_analysis (bool a) {
835 maybe_set (_automatic_audio_analysis, a);
838 #ifdef DCPOMATIC_WINDOWS
839 void set_win32_console (bool c) {
840 maybe_set (_win32_console, c);
844 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
849 void set_cinemas_file (boost::filesystem::path file);
851 void set_show_hints_before_make_dcp (bool s) {
852 maybe_set (_show_hints_before_make_dcp, s);
855 void set_confirm_kdm_email (bool s) {
856 maybe_set (_confirm_kdm_email, s);
859 void set_sound (bool s) {
860 maybe_set (_sound, s, SOUND);
863 void set_sound_output (std::string o) {
864 maybe_set (_sound_output, o, SOUND_OUTPUT);
867 void set_last_player_load_directory (boost::filesystem::path d) {
868 maybe_set (_last_player_load_directory, d);
871 void set_last_kdm_write_type (KDMWriteType t) {
872 maybe_set (_last_kdm_write_type, t);
875 void set_last_dkdm_write_type (DKDMWriteType t) {
876 maybe_set (_last_dkdm_write_type, t);
879 void unset_sound_output () {
880 if (!_sound_output) {
884 _sound_output = boost::none;
888 void set_kdm_container_name_format (dcp::NameFormat n) {
889 maybe_set (_kdm_container_name_format, n);
892 void set_kdm_filename_format (dcp::NameFormat n) {
893 maybe_set (_kdm_filename_format, n);
896 void set_dkdm_filename_format (dcp::NameFormat n) {
897 maybe_set (_dkdm_filename_format, n);
900 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
901 maybe_set (_dcp_metadata_filename_format, n);
904 void set_dcp_asset_filename_format (dcp::NameFormat n) {
905 maybe_set (_dcp_asset_filename_format, n);
908 void set_frames_in_memory_multiplier (int m) {
909 maybe_set (_frames_in_memory_multiplier, m);
912 void set_decode_reduction (boost::optional<int> r) {
913 maybe_set (_decode_reduction, r);
916 void set_default_notify (bool n) {
917 maybe_set (_default_notify, n);
920 void clear_history () {
925 void clear_player_history () {
926 _player_history.clear ();
930 void add_to_history (boost::filesystem::path p);
931 void clean_history ();
932 void add_to_player_history (boost::filesystem::path p);
933 void clean_player_history ();
935 void set_jump_to_selected (bool j) {
936 maybe_set (_jump_to_selected, j);
939 void set_nagged (Nag nag, bool nagged) {
940 maybe_set (_nagged[nag], nagged);
943 void set_cover_sheet (std::string s) {
944 maybe_set (_cover_sheet, s);
947 void reset_cover_sheet ();
949 void set_notification (Notification n, bool v) {
950 maybe_set (_notification[n], v);
953 void set_barco_username (std::string u) {
954 maybe_set (_barco_username, u);
957 void unset_barco_username () {
958 maybe_set (_barco_username, boost::optional<std::string>());
961 void set_barco_password (std::string p) {
962 maybe_set (_barco_password, p);
965 void unset_barco_password () {
966 maybe_set (_barco_password, boost::optional<std::string>());
969 void set_christie_username (std::string u) {
970 maybe_set (_christie_username, u);
973 void unset_christie_username () {
974 maybe_set (_christie_username, boost::optional<std::string>());
977 void set_christie_password (std::string p) {
978 maybe_set (_christie_password, p);
981 void unset_christie_password () {
982 maybe_set (_christie_password, boost::optional<std::string>());
985 void set_gdc_username (std::string u) {
986 maybe_set (_gdc_username, u);
989 void unset_gdc_username () {
990 maybe_set (_gdc_username, boost::optional<std::string>());
993 void set_gdc_password (std::string p) {
994 maybe_set (_gdc_password, p);
997 void unset_gdc_password () {
998 maybe_set (_gdc_password, boost::optional<std::string>());
1001 void set_player_mode (PlayerMode m) {
1002 maybe_set (_player_mode, m);
1005 void set_image_display (int n) {
1006 maybe_set (_image_display, n);
1009 void set_video_view_type (VideoViewType v) {
1010 maybe_set (_video_view_type, v);
1013 void set_respect_kdm_validity_periods (bool r) {
1014 maybe_set (_respect_kdm_validity_periods, r);
1017 void set_player_debug_log_file (boost::filesystem::path p) {
1018 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1021 void unset_player_debug_log_file () {
1022 if (!_player_debug_log_file) {
1025 _player_debug_log_file = boost::none;
1026 changed (PLAYER_DEBUG_LOG);
1029 void set_player_content_directory (boost::filesystem::path p) {
1030 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1033 void unset_player_content_directory () {
1034 if (!_player_content_directory) {
1037 _player_content_directory = boost::none;
1038 changed (PLAYER_CONTENT_DIRECTORY);
1041 void set_player_playlist_directory (boost::filesystem::path p) {
1042 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1045 void unset_player_playlist_directory () {
1046 if (!_player_playlist_directory) {
1049 _player_playlist_directory = boost::none;
1050 changed (PLAYER_PLAYLIST_DIRECTORY);
1053 void set_player_kdm_directory (boost::filesystem::path p) {
1054 maybe_set (_player_kdm_directory, p);
1057 void unset_player_kdm_directory () {
1058 if (!_player_kdm_directory) {
1061 _player_kdm_directory = boost::none;
1065 void set_audio_mapping (AudioMapping m);
1066 void set_audio_mapping_to_default ();
1068 void add_custom_language (dcp::LanguageTag tag);
1070 void set_add_files_path (boost::filesystem::path p) {
1071 _add_files_path = p;
1075 void set_use_isdcf_name_by_default (bool use) {
1076 maybe_set (_use_isdcf_name_by_default, use);
1079 void set_write_kdms_to_disk (bool write) {
1080 maybe_set (_write_kdms_to_disk, write);
1083 void set_email_kdms (bool email) {
1084 maybe_set (_email_kdms, email);
1087 void set_default_kdm_type (dcp::Formulation type) {
1088 maybe_set (_default_kdm_type, type);
1091 void changed (Property p = OTHER);
1092 boost::signals2::signal<void (Property)> Changed;
1093 /** Emitted if read() failed on an existing Config file. There is nothing
1094 a listener can do about it: this is just for information.
1096 static boost::signals2::signal<void ()> FailedToLoad;
1097 /** Emitted if read() issued a warning which the user might want to know about */
1098 static boost::signals2::signal<void (std::string)> Warning;
1099 /** Emitted if there is a something wrong the contents of our config. Handler can call
1100 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1103 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1104 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1105 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1106 BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
1109 static boost::signals2::signal<bool (BadReason)> Bad;
1111 void write () const override;
1112 void write_config () const;
1113 void write_cinemas () const;
1114 void write_dkdm_recipients () const;
1115 void link (boost::filesystem::path new_file) const;
1116 void copy_and_link (boost::filesystem::path new_file) const;
1117 bool have_write_permission () const;
1119 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1120 bool existing_template (std::string name) const;
1121 std::list<std::string> templates () const;
1122 boost::filesystem::path template_read_path (std::string name) const;
1123 boost::filesystem::path template_write_path (std::string name) const;
1124 void rename_template (std::string old_name, std::string new_name) const;
1125 void delete_template (std::string name) const;
1127 boost::optional<BadReason> check_certificates () const;
1129 static Config* instance ();
1130 static void drop ();
1131 static void restore_defaults ();
1132 static bool have_existing (std::string);
1133 static boost::filesystem::path config_read_file ();
1134 static boost::filesystem::path config_write_file ();
1138 void read () override;
1139 void set_defaults ();
1140 void set_kdm_email_to_default ();
1141 void set_notification_email_to_default ();
1142 void set_cover_sheet_to_default ();
1143 void read_cinemas (cxml::Document const & f);
1144 void read_dkdm_recipients (cxml::Document const & f);
1145 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1146 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1147 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1148 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1152 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1153 if (member == new_value) {
1161 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1162 if (member && member.get() == new_value) {
1169 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1170 int _master_encoding_threads;
1171 /** number of threads which a server should use for J2K encoding on the local machine */
1172 int _server_encoding_threads;
1173 /** default directory to put new films in */
1174 boost::optional<boost::filesystem::path> _default_directory;
1175 /** base port number to use for J2K encoding servers;
1176 * this port and the two above it will be used.
1178 int _server_port_base;
1179 /** true to broadcast on the `any' address to look for servers */
1180 bool _use_any_servers;
1181 /** J2K encoding servers that should definitely be used */
1182 std::vector<std::string> _servers;
1183 bool _only_servers_encode;
1184 FileTransferProtocol _tms_protocol;
1185 /** The IP address of a TMS that we can copy DCPs to */
1186 std::string _tms_ip;
1187 /** The path on a TMS that we should write DCPs to */
1188 std::string _tms_path;
1189 /** User name to log into the TMS with */
1190 std::string _tms_user;
1191 /** Password to log into the TMS with */
1192 std::string _tms_password;
1193 /** The list of possible DCP frame rates that DCP-o-matic will use */
1194 std::list<int> _allowed_dcp_frame_rates;
1195 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1196 bool _allow_any_dcp_frame_rate;
1197 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1198 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1199 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1201 bool _allow_any_container;
1202 /** Offer the upmixers in the audio processor settings */
1203 bool _show_experimental_audio_processors;
1204 boost::optional<std::string> _language;
1205 /** Default length of still image content (seconds) */
1206 int _default_still_length;
1207 Ratio const * _default_container;
1208 DCPContentType const * _default_dcp_content_type;
1209 int _default_dcp_audio_channels;
1210 std::string _dcp_issuer;
1211 std::string _dcp_creator;
1212 std::string _dcp_company_name;
1213 std::string _dcp_product_name;
1214 std::string _dcp_product_version;
1215 std::string _dcp_j2k_comment;
1216 int _default_j2k_bandwidth;
1217 int _default_audio_delay;
1218 bool _default_interop;
1219 std::map<std::string, std::string> _default_metadata;
1220 /** Default directory to offer to write KDMs to; if it's not set,
1221 the home directory will be offered.
1223 boost::optional<boost::filesystem::path> _default_kdm_directory;
1224 bool _upload_after_make_dcp;
1225 std::list<std::shared_ptr<Cinema>> _cinemas;
1226 std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
1227 std::string _mail_server;
1229 EmailProtocol _mail_protocol;
1230 std::string _mail_user;
1231 std::string _mail_password;
1232 std::string _kdm_subject;
1233 std::string _kdm_from;
1234 std::vector<std::string> _kdm_cc;
1235 std::string _kdm_bcc;
1236 std::string _kdm_email;
1237 std::string _notification_subject;
1238 std::string _notification_from;
1239 std::string _notification_to;
1240 std::vector<std::string> _notification_cc;
1241 std::string _notification_bcc;
1242 std::string _notification_email;
1243 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1244 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1245 * certificate for making KDMs given to DCP-o-matic.
1247 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1248 /** true to check for updates on startup */
1249 bool _check_for_updates;
1250 bool _check_for_test_updates;
1251 /** maximum allowed J2K bandwidth in bits per second */
1252 int _maximum_j2k_bandwidth;
1254 bool _analyse_ebur128;
1255 bool _automatic_audio_analysis;
1256 #ifdef DCPOMATIC_WINDOWS
1257 bool _win32_console;
1259 std::vector<boost::filesystem::path> _history;
1260 std::vector<boost::filesystem::path> _player_history;
1261 std::shared_ptr<DKDMGroup> _dkdms;
1262 boost::filesystem::path _cinemas_file;
1263 boost::filesystem::path _dkdm_recipients_file;
1264 bool _show_hints_before_make_dcp;
1265 bool _confirm_kdm_email;
1266 dcp::NameFormat _kdm_filename_format;
1267 dcp::NameFormat _dkdm_filename_format;
1268 dcp::NameFormat _kdm_container_name_format;
1269 dcp::NameFormat _dcp_metadata_filename_format;
1270 dcp::NameFormat _dcp_asset_filename_format;
1271 bool _jump_to_selected;
1272 bool _nagged[NAG_COUNT];
1274 /** name of a specific sound output stream to use, or empty to use the default */
1275 boost::optional<std::string> _sound_output;
1276 std::string _cover_sheet;
1277 boost::optional<boost::filesystem::path> _last_player_load_directory;
1278 boost::optional<KDMWriteType> _last_kdm_write_type;
1279 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1280 int _frames_in_memory_multiplier;
1281 boost::optional<int> _decode_reduction;
1282 bool _default_notify;
1283 bool _notification[NOTIFICATION_COUNT];
1284 boost::optional<std::string> _barco_username;
1285 boost::optional<std::string> _barco_password;
1286 boost::optional<std::string> _christie_username;
1287 boost::optional<std::string> _christie_password;
1288 boost::optional<std::string> _gdc_username;
1289 boost::optional<std::string> _gdc_password;
1290 PlayerMode _player_mode;
1292 VideoViewType _video_view_type;
1293 bool _respect_kdm_validity_periods;
1294 /** Log file containing debug information for the player */
1295 boost::optional<boost::filesystem::path> _player_debug_log_file;
1296 /** A directory containing DCPs whose contents are presented to the user
1297 in the dual-screen player mode. DCPs on the list can be loaded
1300 boost::optional<boost::filesystem::path> _player_content_directory;
1301 boost::optional<boost::filesystem::path> _player_playlist_directory;
1302 boost::optional<boost::filesystem::path> _player_kdm_directory;
1303 boost::optional<AudioMapping> _audio_mapping;
1304 std::vector<dcp::LanguageTag> _custom_languages;
1305 boost::optional<boost::filesystem::path> _add_files_path;
1306 bool _use_isdcf_name_by_default;
1307 bool _write_kdms_to_disk;
1309 dcp::Formulation _default_kdm_type;
1311 static int const _current_version;
1313 /** Singleton instance, or 0 */
1314 static Config* _instance;