2 Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 /** @file src/config.h
22 * @brief Class holding configuration.
25 #ifndef DCPOMATIC_CONFIG_H
26 #define DCPOMATIC_CONFIG_H
28 #include "isdcf_metadata.h"
32 #include "audio_mapping.h"
33 #include <dcp/name_format.h>
34 #include <dcp/certificate_chain.h>
35 #include <dcp/encrypted_kdm.h>
36 #include <dcp/language_tag.h>
37 #include <boost/signals2.hpp>
38 #include <boost/filesystem.hpp>
41 class CinemaSoundProcessor;
50 * @brief A singleton class holding configuration.
52 class Config : public State
55 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
56 int master_encoding_threads () const {
57 return _master_encoding_threads;
60 /** @return number of threads which a server should use for J2K encoding on the local machine */
61 int server_encoding_threads () const {
62 return _server_encoding_threads;
65 boost::optional<boost::filesystem::path> default_directory () const {
66 return _default_directory;
69 boost::optional<boost::filesystem::path> default_kdm_directory () const {
70 return _default_kdm_directory;
73 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
74 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
83 PLAYER_CONTENT_DIRECTORY,
84 PLAYER_PLAYLIST_DIRECTORY,
87 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
92 /** @return base port number to use for J2K encoding servers */
93 int server_port_base () const {
94 return _server_port_base;
97 void set_use_any_servers (bool u) {
99 changed (USE_ANY_SERVERS);
102 bool use_any_servers () const {
103 return _use_any_servers;
106 /** @param s New list of servers */
107 void set_servers (std::vector<std::string> s) {
112 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
113 std::vector<std::string> servers () const {
117 bool only_servers_encode () const {
118 return _only_servers_encode;
121 FileTransferProtocol tms_protocol () const {
122 return _tms_protocol;
125 /** @return The IP address of a TMS that we can copy DCPs to */
126 std::string tms_ip () const {
130 /** @return The path on a TMS that we should changed DCPs to */
131 std::string tms_path () const {
135 /** @return User name to log into the TMS with */
136 std::string tms_user () const {
140 /** @return Password to log into the TMS with */
141 std::string tms_password () const {
142 return _tms_password;
145 std::list<std::shared_ptr<Cinema> > cinemas () const {
149 std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
150 return _dkdm_recipients;
153 std::list<int> allowed_dcp_frame_rates () const {
154 return _allowed_dcp_frame_rates;
157 bool allow_any_dcp_frame_rate () const {
158 return _allow_any_dcp_frame_rate;
161 bool allow_any_container () const {
162 return _allow_any_container;
165 bool show_experimental_audio_processors () const {
166 return _show_experimental_audio_processors;
169 ISDCFMetadata default_isdcf_metadata () const {
170 return _default_isdcf_metadata;
173 boost::optional<std::string> language () const {
177 int default_still_length () const {
178 return _default_still_length;
181 Ratio const * default_container () const {
182 return _default_container;
185 DCPContentType const * default_dcp_content_type () const {
186 return _default_dcp_content_type;
189 int default_dcp_audio_channels () const {
190 return _default_dcp_audio_channels;
193 std::string dcp_issuer () const {
197 std::string dcp_creator () const {
201 std::string dcp_company_name () const {
202 return _dcp_company_name;
205 std::string dcp_product_name () const {
206 return _dcp_product_name;
209 std::string dcp_product_version () const {
210 return _dcp_product_version;
213 std::string dcp_j2k_comment () const {
214 return _dcp_j2k_comment;
217 int default_j2k_bandwidth () const {
218 return _default_j2k_bandwidth;
221 int default_audio_delay () const {
222 return _default_audio_delay;
225 bool default_interop () const {
226 return _default_interop;
229 bool upload_after_make_dcp () {
230 return _upload_after_make_dcp;
233 void set_default_kdm_directory (boost::filesystem::path d) {
234 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
237 _default_kdm_directory = d;
241 std::string mail_server () const {
245 int mail_port () const {
249 EmailProtocol mail_protocol () const {
250 return _mail_protocol;
253 std::string mail_user () const {
257 std::string mail_password () const {
258 return _mail_password;
261 std::string kdm_subject () const {
265 std::string kdm_from () const {
269 std::vector<std::string> kdm_cc () const {
273 std::string kdm_bcc () const {
277 std::string kdm_email () const {
281 std::string notification_subject () const {
282 return _notification_subject;
285 std::string notification_from () const {
286 return _notification_from;
289 std::string notification_to () const {
290 return _notification_to;
293 std::vector<std::string> notification_cc () const {
294 return _notification_cc;
297 std::string notification_bcc () const {
298 return _notification_bcc;
301 std::string notification_email () const {
302 return _notification_email;
305 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
306 return _signer_chain;
309 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
310 return _decryption_chain;
313 bool check_for_updates () const {
314 return _check_for_updates;
317 bool check_for_test_updates () const {
318 return _check_for_test_updates;
321 int maximum_j2k_bandwidth () const {
322 return _maximum_j2k_bandwidth;
325 int log_types () const {
329 bool analyse_ebur128 () const {
330 return _analyse_ebur128;
333 bool automatic_audio_analysis () const {
334 return _automatic_audio_analysis;
337 #ifdef DCPOMATIC_WINDOWS
338 bool win32_console () const {
339 return _win32_console;
343 std::vector<boost::filesystem::path> history () const {
347 std::vector<boost::filesystem::path> player_history () const {
348 return _player_history;
351 std::shared_ptr<DKDMGroup> dkdms () const {
355 boost::filesystem::path cinemas_file () const {
356 return _cinemas_file;
359 boost::filesystem::path dkdm_recipients_file () const {
360 return _dkdm_recipients_file;
363 bool show_hints_before_make_dcp () const {
364 return _show_hints_before_make_dcp;
367 bool confirm_kdm_email () const {
368 return _confirm_kdm_email;
371 dcp::NameFormat kdm_container_name_format () const {
372 return _kdm_container_name_format;
375 dcp::NameFormat kdm_filename_format () const {
376 return _kdm_filename_format;
379 dcp::NameFormat dkdm_filename_format () const {
380 return _dkdm_filename_format;
383 dcp::NameFormat dcp_metadata_filename_format () const {
384 return _dcp_metadata_filename_format;
387 dcp::NameFormat dcp_asset_filename_format () const {
388 return _dcp_asset_filename_format;
391 bool jump_to_selected () const {
392 return _jump_to_selected;
395 /* This could be an enum class but we use the enum a lot to index _nagged
396 * so it means a lot of casts.
400 NAG_ENCRYPTED_METADATA,
401 NAG_ALTER_DECRYPTION_CHAIN,
402 NAG_BAD_SIGNER_CHAIN,
403 NAG_IMPORT_DECRYPTION_CHAIN,
406 NAG_TOO_MANY_DROPPED_FRAMES,
410 bool nagged (Nag nag) const {
414 bool sound () const {
418 std::string cover_sheet () const {
422 boost::optional<std::string> sound_output () const {
423 return _sound_output;
426 boost::optional<boost::filesystem::path> last_player_load_directory () const {
427 return _last_player_load_directory;
436 boost::optional<KDMWriteType> last_kdm_write_type () const {
437 return _last_kdm_write_type;
445 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
446 return _last_dkdm_write_type;
449 int frames_in_memory_multiplier () const {
450 return _frames_in_memory_multiplier;
453 boost::optional<int> decode_reduction () const {
454 return _decode_reduction;
457 bool default_notify () const {
458 return _default_notify;
467 bool notification (Notification n) const {
468 return _notification[n];
471 boost::optional<std::string> barco_username () const {
472 return _barco_username;
475 boost::optional<std::string> barco_password () const {
476 return _barco_password;
479 boost::optional<std::string> christie_username () const {
480 return _christie_username;
483 boost::optional<std::string> christie_password () const {
484 return _christie_password;
487 boost::optional<std::string> gdc_username () const {
488 return _gdc_username;
491 boost::optional<std::string> gdc_password () const {
492 return _gdc_password;
496 PLAYER_MODE_WINDOW, ///< one window containing image and controls
497 PLAYER_MODE_FULL, ///< just the image filling the screen
498 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
501 PlayerMode player_mode () const {
505 int image_display () const {
506 return _image_display;
514 VideoViewType video_view_type () const {
515 return _video_view_type;
518 bool respect_kdm_validity_periods () const {
519 return _respect_kdm_validity_periods;
522 boost::optional<boost::filesystem::path> player_activity_log_file () const {
523 return _player_activity_log_file;
526 boost::optional<boost::filesystem::path> player_debug_log_file () const {
527 return _player_debug_log_file;
530 boost::optional<boost::filesystem::path> player_content_directory () const {
531 return _player_content_directory;
534 boost::optional<boost::filesystem::path> player_playlist_directory () const {
535 return _player_playlist_directory;
538 boost::optional<boost::filesystem::path> player_kdm_directory () const {
539 return _player_kdm_directory;
542 AudioMapping audio_mapping (int output_channels);
544 int minimum_frame_size () const {
545 return _minimum_frame_size;
548 std::vector<dcp::LanguageTag> custom_languages () const {
549 return _custom_languages;
554 void set_master_encoding_threads (int n) {
555 maybe_set (_master_encoding_threads, n);
558 void set_server_encoding_threads (int n) {
559 maybe_set (_server_encoding_threads, n);
562 void set_default_directory (boost::filesystem::path d) {
563 if (_default_directory && *_default_directory == d) {
566 _default_directory = d;
570 /** @param p New server port */
571 void set_server_port_base (int p) {
572 maybe_set (_server_port_base, p);
575 void set_only_servers_encode (bool o) {
576 maybe_set (_only_servers_encode, o);
579 void set_tms_protocol (FileTransferProtocol p) {
580 maybe_set (_tms_protocol, p);
583 /** @param i IP address of a TMS that we can copy DCPs to */
584 void set_tms_ip (std::string i) {
585 maybe_set (_tms_ip, i);
588 /** @param p Path on a TMS that we should changed DCPs to */
589 void set_tms_path (std::string p) {
590 maybe_set (_tms_path, p);
593 /** @param u User name to log into the TMS with */
594 void set_tms_user (std::string u) {
595 maybe_set (_tms_user, u);
598 /** @param p Password to log into the TMS with */
599 void set_tms_password (std::string p) {
600 maybe_set (_tms_password, p);
603 void add_cinema (std::shared_ptr<Cinema> c) {
604 _cinemas.push_back (c);
608 void remove_cinema (std::shared_ptr<Cinema> c) {
613 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
614 _dkdm_recipients.push_back (c);
615 changed (DKDM_RECIPIENTS);
618 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
619 _dkdm_recipients.remove (c);
620 changed (DKDM_RECIPIENTS);
623 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
624 maybe_set (_allowed_dcp_frame_rates, r);
627 void set_allow_any_dcp_frame_rate (bool a) {
628 maybe_set (_allow_any_dcp_frame_rate, a);
631 void set_allow_any_container (bool a) {
632 maybe_set (_allow_any_container, a);
635 void set_show_experimental_audio_processors (bool e) {
636 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
639 void set_default_isdcf_metadata (ISDCFMetadata d) {
640 maybe_set (_default_isdcf_metadata, d);
643 void set_language (std::string l) {
644 if (_language && _language.get() == l) {
651 void unset_language () {
656 _language = boost::none;
660 void set_default_still_length (int s) {
661 maybe_set (_default_still_length, s);
664 void set_default_container (Ratio const * c) {
665 maybe_set (_default_container, c);
668 void set_default_dcp_content_type (DCPContentType const * t) {
669 maybe_set (_default_dcp_content_type, t);
672 void set_default_dcp_audio_channels (int c) {
673 maybe_set (_default_dcp_audio_channels, c);
676 void set_dcp_issuer (std::string i) {
677 maybe_set (_dcp_issuer, i);
680 void set_dcp_creator (std::string c) {
681 maybe_set (_dcp_creator, c);
684 void set_dcp_company_name (std::string c) {
685 maybe_set (_dcp_company_name, c);
688 void set_dcp_product_name (std::string c) {
689 maybe_set (_dcp_product_name, c);
692 void set_dcp_product_version (std::string c) {
693 maybe_set (_dcp_product_version, c);
696 void set_dcp_j2k_comment (std::string c) {
697 maybe_set (_dcp_j2k_comment, c);
700 void set_default_j2k_bandwidth (int b) {
701 maybe_set (_default_j2k_bandwidth, b);
704 void set_default_audio_delay (int d) {
705 maybe_set (_default_audio_delay, d);
708 void set_default_interop (bool i) {
709 maybe_set (_default_interop, i);
712 void set_upload_after_make_dcp (bool u) {
713 maybe_set (_upload_after_make_dcp, u);
716 void set_mail_server (std::string s) {
717 maybe_set (_mail_server, s);
720 void set_mail_port (int p) {
721 maybe_set (_mail_port, p);
724 void set_mail_protocol (EmailProtocol p) {
725 maybe_set (_mail_protocol, p);
728 void set_mail_user (std::string u) {
729 maybe_set (_mail_user, u);
732 void set_mail_password (std::string p) {
733 maybe_set (_mail_password, p);
736 void set_kdm_subject (std::string s) {
737 maybe_set (_kdm_subject, s);
740 void set_kdm_from (std::string f) {
741 maybe_set (_kdm_from, f);
744 void set_kdm_cc (std::vector<std::string> f) {
745 maybe_set (_kdm_cc, f);
748 void set_kdm_bcc (std::string f) {
749 maybe_set (_kdm_bcc, f);
752 void set_kdm_email (std::string e) {
753 maybe_set (_kdm_email, e);
756 void reset_kdm_email ();
758 void set_notification_subject (std::string s) {
759 maybe_set (_notification_subject, s);
762 void set_notification_from (std::string f) {
763 maybe_set (_notification_from, f);
766 void set_notification_to (std::string t) {
767 maybe_set (_notification_to, t);
770 void set_notification_cc (std::vector<std::string> f) {
771 maybe_set (_notification_cc, f);
774 void set_notification_bcc (std::string f) {
775 maybe_set (_notification_bcc, f);
778 void set_notification_email (std::string e) {
779 maybe_set (_notification_email, e);
782 void reset_notification_email ();
784 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
785 maybe_set (_signer_chain, s);
788 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
789 maybe_set (_decryption_chain, c);
792 void set_check_for_updates (bool c) {
793 maybe_set (_check_for_updates, c);
795 set_check_for_test_updates (false);
799 void set_check_for_test_updates (bool c) {
800 maybe_set (_check_for_test_updates, c);
803 void set_maximum_j2k_bandwidth (int b) {
804 maybe_set (_maximum_j2k_bandwidth, b);
807 void set_log_types (int t) {
808 maybe_set (_log_types, t);
811 void set_analyse_ebur128 (bool a) {
812 maybe_set (_analyse_ebur128, a);
815 void set_automatic_audio_analysis (bool a) {
816 maybe_set (_automatic_audio_analysis, a);
819 #ifdef DCPOMATIC_WINDOWS
820 void set_win32_console (bool c) {
821 maybe_set (_win32_console, c);
825 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
830 void set_cinemas_file (boost::filesystem::path file);
832 void set_dkdm_recipients_file (boost::filesystem::path file);
834 void set_show_hints_before_make_dcp (bool s) {
835 maybe_set (_show_hints_before_make_dcp, s);
838 void set_confirm_kdm_email (bool s) {
839 maybe_set (_confirm_kdm_email, s);
842 void set_sound (bool s) {
843 maybe_set (_sound, s, SOUND);
846 void set_sound_output (std::string o) {
847 maybe_set (_sound_output, o, SOUND_OUTPUT);
850 void set_last_player_load_directory (boost::filesystem::path d) {
851 maybe_set (_last_player_load_directory, d);
854 void set_last_kdm_write_type (KDMWriteType t) {
855 maybe_set (_last_kdm_write_type, t);
858 void set_last_dkdm_write_type (DKDMWriteType t) {
859 maybe_set (_last_dkdm_write_type, t);
862 void unset_sound_output () {
863 if (!_sound_output) {
867 _sound_output = boost::none;
871 void set_kdm_container_name_format (dcp::NameFormat n) {
872 maybe_set (_kdm_container_name_format, n);
875 void set_kdm_filename_format (dcp::NameFormat n) {
876 maybe_set (_kdm_filename_format, n);
879 void set_dkdm_filename_format (dcp::NameFormat n) {
880 maybe_set (_dkdm_filename_format, n);
883 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
884 maybe_set (_dcp_metadata_filename_format, n);
887 void set_dcp_asset_filename_format (dcp::NameFormat n) {
888 maybe_set (_dcp_asset_filename_format, n);
891 void set_frames_in_memory_multiplier (int m) {
892 maybe_set (_frames_in_memory_multiplier, m);
895 void set_decode_reduction (boost::optional<int> r) {
896 maybe_set (_decode_reduction, r);
899 void set_default_notify (bool n) {
900 maybe_set (_default_notify, n);
903 void clear_history () {
908 void clear_player_history () {
909 _player_history.clear ();
913 void add_to_history (boost::filesystem::path p);
914 void clean_history ();
915 void add_to_player_history (boost::filesystem::path p);
916 void clean_player_history ();
918 void set_jump_to_selected (bool j) {
919 maybe_set (_jump_to_selected, j);
922 void set_nagged (Nag nag, bool nagged) {
923 maybe_set (_nagged[nag], nagged);
926 void set_cover_sheet (std::string s) {
927 maybe_set (_cover_sheet, s);
930 void reset_cover_sheet ();
932 void set_notification (Notification n, bool v) {
933 maybe_set (_notification[n], v);
936 void set_barco_username (std::string u) {
937 maybe_set (_barco_username, u);
940 void unset_barco_username () {
941 maybe_set (_barco_username, boost::optional<std::string>());
944 void set_barco_password (std::string p) {
945 maybe_set (_barco_password, p);
948 void unset_barco_password () {
949 maybe_set (_barco_password, boost::optional<std::string>());
952 void set_christie_username (std::string u) {
953 maybe_set (_christie_username, u);
956 void unset_christie_username () {
957 maybe_set (_christie_username, boost::optional<std::string>());
960 void set_christie_password (std::string p) {
961 maybe_set (_christie_password, p);
964 void unset_christie_password () {
965 maybe_set (_christie_password, boost::optional<std::string>());
968 void set_gdc_username (std::string u) {
969 maybe_set (_gdc_username, u);
972 void unset_gdc_username () {
973 maybe_set (_gdc_username, boost::optional<std::string>());
976 void set_gdc_password (std::string p) {
977 maybe_set (_gdc_password, p);
980 void unset_gdc_password () {
981 maybe_set (_gdc_password, boost::optional<std::string>());
984 void set_player_mode (PlayerMode m) {
985 maybe_set (_player_mode, m);
988 void set_image_display (int n) {
989 maybe_set (_image_display, n);
992 void set_video_view_type (VideoViewType v) {
993 maybe_set (_video_view_type, v);
996 void set_respect_kdm_validity_periods (bool r) {
997 maybe_set (_respect_kdm_validity_periods, r);
1000 void set_player_activity_log_file (boost::filesystem::path p) {
1001 maybe_set (_player_activity_log_file, p);
1004 void unset_player_activity_log_file () {
1005 if (!_player_activity_log_file) {
1008 _player_activity_log_file = boost::none;
1012 void set_player_debug_log_file (boost::filesystem::path p) {
1013 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1016 void unset_player_debug_log_file () {
1017 if (!_player_debug_log_file) {
1020 _player_debug_log_file = boost::none;
1021 changed (PLAYER_DEBUG_LOG);
1024 void set_player_content_directory (boost::filesystem::path p) {
1025 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1028 void unset_player_content_directory () {
1029 if (!_player_content_directory) {
1032 _player_content_directory = boost::none;
1033 changed (PLAYER_CONTENT_DIRECTORY);
1036 void set_player_playlist_directory (boost::filesystem::path p) {
1037 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1040 void unset_player_playlist_directory () {
1041 if (!_player_playlist_directory) {
1044 _player_playlist_directory = boost::none;
1045 changed (PLAYER_PLAYLIST_DIRECTORY);
1048 void set_player_kdm_directory (boost::filesystem::path p) {
1049 maybe_set (_player_kdm_directory, p);
1052 void unset_player_kdm_directory () {
1053 if (!_player_kdm_directory) {
1056 _player_kdm_directory = boost::none;
1060 void set_audio_mapping (AudioMapping m);
1061 void set_audio_mapping_to_default ();
1063 void set_minimum_frame_size (int size) {
1064 maybe_set (_minimum_frame_size, size);
1067 void add_custom_language (dcp::LanguageTag tag);
1069 void changed (Property p = OTHER);
1070 boost::signals2::signal<void (Property)> Changed;
1071 /** Emitted if read() failed on an existing Config file. There is nothing
1072 a listener can do about it: this is just for information.
1074 static boost::signals2::signal<void ()> FailedToLoad;
1075 /** Emitted if read() issued a warning which the user might want to know about */
1076 static boost::signals2::signal<void (std::string)> Warning;
1077 /** Emitted if there is a something wrong the contents of our config. Handler can call
1078 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1081 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1082 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1083 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1086 static boost::signals2::signal<bool (BadReason)> Bad;
1088 void write () const;
1089 void write_config () const;
1090 void write_cinemas () const;
1091 void write_dkdm_recipients () const;
1092 void link (boost::filesystem::path new_file) const;
1093 void copy_and_link (boost::filesystem::path new_file) const;
1094 bool have_write_permission () const;
1096 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1097 bool existing_template (std::string name) const;
1098 std::list<std::string> templates () const;
1099 boost::filesystem::path template_path (std::string name) const;
1100 void rename_template (std::string old_name, std::string new_name) const;
1101 void delete_template (std::string name) const;
1103 static Config* instance ();
1104 static void drop ();
1105 static void restore_defaults ();
1106 static bool have_existing (std::string);
1107 static boost::filesystem::path config_file ();
1112 void set_defaults ();
1113 void set_kdm_email_to_default ();
1114 void set_notification_email_to_default ();
1115 void set_cover_sheet_to_default ();
1116 void read_cinemas (cxml::Document const & f);
1117 void read_dkdm_recipients (cxml::Document const & f);
1118 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1119 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1120 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1121 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1125 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1126 if (member == new_value) {
1134 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1135 if (member && member.get() == new_value) {
1142 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1143 int _master_encoding_threads;
1144 /** number of threads which a server should use for J2K encoding on the local machine */
1145 int _server_encoding_threads;
1146 /** default directory to put new films in */
1147 boost::optional<boost::filesystem::path> _default_directory;
1148 /** base port number to use for J2K encoding servers;
1149 * this port and the two above it will be used.
1151 int _server_port_base;
1152 /** true to broadcast on the `any' address to look for servers */
1153 bool _use_any_servers;
1154 /** J2K encoding servers that should definitely be used */
1155 std::vector<std::string> _servers;
1156 bool _only_servers_encode;
1157 FileTransferProtocol _tms_protocol;
1158 /** The IP address of a TMS that we can copy DCPs to */
1159 std::string _tms_ip;
1160 /** The path on a TMS that we should write DCPs to */
1161 std::string _tms_path;
1162 /** User name to log into the TMS with */
1163 std::string _tms_user;
1164 /** Password to log into the TMS with */
1165 std::string _tms_password;
1166 /** The list of possible DCP frame rates that DCP-o-matic will use */
1167 std::list<int> _allowed_dcp_frame_rates;
1168 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1169 bool _allow_any_dcp_frame_rate;
1170 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1171 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1172 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1174 bool _allow_any_container;
1175 /** Offer the upmixers in the audio processor settings */
1176 bool _show_experimental_audio_processors;
1177 /** Default ISDCF metadata for newly-created Films */
1178 ISDCFMetadata _default_isdcf_metadata;
1179 boost::optional<std::string> _language;
1180 /** Default length of still image content (seconds) */
1181 int _default_still_length;
1182 Ratio const * _default_container;
1183 DCPContentType const * _default_dcp_content_type;
1184 int _default_dcp_audio_channels;
1185 std::string _dcp_issuer;
1186 std::string _dcp_creator;
1187 std::string _dcp_company_name;
1188 std::string _dcp_product_name;
1189 std::string _dcp_product_version;
1190 std::string _dcp_j2k_comment;
1191 int _default_j2k_bandwidth;
1192 int _default_audio_delay;
1193 bool _default_interop;
1194 /** Default directory to offer to write KDMs to; if it's not set,
1195 the home directory will be offered.
1197 boost::optional<boost::filesystem::path> _default_kdm_directory;
1198 bool _upload_after_make_dcp;
1199 std::list<std::shared_ptr<Cinema> > _cinemas;
1200 std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1201 std::string _mail_server;
1203 EmailProtocol _mail_protocol;
1204 std::string _mail_user;
1205 std::string _mail_password;
1206 std::string _kdm_subject;
1207 std::string _kdm_from;
1208 std::vector<std::string> _kdm_cc;
1209 std::string _kdm_bcc;
1210 std::string _kdm_email;
1211 std::string _notification_subject;
1212 std::string _notification_from;
1213 std::string _notification_to;
1214 std::vector<std::string> _notification_cc;
1215 std::string _notification_bcc;
1216 std::string _notification_email;
1217 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1218 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1219 * certificate for making KDMs given to DCP-o-matic.
1221 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1222 /** true to check for updates on startup */
1223 bool _check_for_updates;
1224 bool _check_for_test_updates;
1225 /** maximum allowed J2K bandwidth in bits per second */
1226 int _maximum_j2k_bandwidth;
1228 bool _analyse_ebur128;
1229 bool _automatic_audio_analysis;
1230 #ifdef DCPOMATIC_WINDOWS
1231 bool _win32_console;
1233 std::vector<boost::filesystem::path> _history;
1234 std::vector<boost::filesystem::path> _player_history;
1235 std::shared_ptr<DKDMGroup> _dkdms;
1236 boost::filesystem::path _cinemas_file;
1237 boost::filesystem::path _dkdm_recipients_file;
1238 bool _show_hints_before_make_dcp;
1239 bool _confirm_kdm_email;
1240 dcp::NameFormat _kdm_filename_format;
1241 dcp::NameFormat _dkdm_filename_format;
1242 dcp::NameFormat _kdm_container_name_format;
1243 dcp::NameFormat _dcp_metadata_filename_format;
1244 dcp::NameFormat _dcp_asset_filename_format;
1245 bool _jump_to_selected;
1246 bool _nagged[NAG_COUNT];
1248 /** name of a specific sound output stream to use, or empty to use the default */
1249 boost::optional<std::string> _sound_output;
1250 std::string _cover_sheet;
1251 boost::optional<boost::filesystem::path> _last_player_load_directory;
1252 boost::optional<KDMWriteType> _last_kdm_write_type;
1253 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1254 int _frames_in_memory_multiplier;
1255 boost::optional<int> _decode_reduction;
1256 bool _default_notify;
1257 bool _notification[NOTIFICATION_COUNT];
1258 boost::optional<std::string> _barco_username;
1259 boost::optional<std::string> _barco_password;
1260 boost::optional<std::string> _christie_username;
1261 boost::optional<std::string> _christie_password;
1262 boost::optional<std::string> _gdc_username;
1263 boost::optional<std::string> _gdc_password;
1264 PlayerMode _player_mode;
1266 VideoViewType _video_view_type;
1267 bool _respect_kdm_validity_periods;
1268 /** Log file containing things the player does (e.g. started, stopped, loaded
1269 playlist etc.) Does not contain debugging information.
1271 boost::optional<boost::filesystem::path> _player_activity_log_file;
1272 /** Log file containing debug information for the player */
1273 boost::optional<boost::filesystem::path> _player_debug_log_file;
1274 /** A directory containing DCPs whose contents are presented to the user
1275 in the dual-screen player mode. DCPs on the list can be loaded
1278 boost::optional<boost::filesystem::path> _player_content_directory;
1279 boost::optional<boost::filesystem::path> _player_playlist_directory;
1280 boost::optional<boost::filesystem::path> _player_kdm_directory;
1281 boost::optional<AudioMapping> _audio_mapping;
1282 int _minimum_frame_size;
1283 std::vector<dcp::LanguageTag> _custom_languages;
1285 static int const _current_version;
1287 /** Singleton instance, or 0 */
1288 static Config* _instance;