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 <boost/signals2.hpp>
37 #include <boost/filesystem.hpp>
40 class CinemaSoundProcessor;
49 * @brief A singleton class holding configuration.
51 class Config : public State
54 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
55 int master_encoding_threads () const {
56 return _master_encoding_threads;
59 /** @return number of threads which a server should use for J2K encoding on the local machine */
60 int server_encoding_threads () const {
61 return _server_encoding_threads;
64 boost::optional<boost::filesystem::path> default_directory () const {
65 return _default_directory;
68 boost::optional<boost::filesystem::path> default_kdm_directory () const {
69 return _default_kdm_directory;
72 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
73 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
82 PLAYER_CONTENT_DIRECTORY,
83 PLAYER_PLAYLIST_DIRECTORY,
86 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
91 /** @return base port number to use for J2K encoding servers */
92 int server_port_base () const {
93 return _server_port_base;
96 void set_use_any_servers (bool u) {
98 changed (USE_ANY_SERVERS);
101 bool use_any_servers () const {
102 return _use_any_servers;
105 /** @param s New list of servers */
106 void set_servers (std::vector<std::string> s) {
111 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
112 std::vector<std::string> servers () const {
116 bool only_servers_encode () const {
117 return _only_servers_encode;
120 FileTransferProtocol tms_protocol () const {
121 return _tms_protocol;
124 /** @return The IP address of a TMS that we can copy DCPs to */
125 std::string tms_ip () const {
129 /** @return The path on a TMS that we should changed DCPs to */
130 std::string tms_path () const {
134 /** @return User name to log into the TMS with */
135 std::string tms_user () const {
139 /** @return Password to log into the TMS with */
140 std::string tms_password () const {
141 return _tms_password;
144 std::list<std::shared_ptr<Cinema> > cinemas () const {
148 std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
149 return _dkdm_recipients;
152 std::list<int> allowed_dcp_frame_rates () const {
153 return _allowed_dcp_frame_rates;
156 bool allow_any_dcp_frame_rate () const {
157 return _allow_any_dcp_frame_rate;
160 bool allow_any_container () const {
161 return _allow_any_container;
164 bool show_experimental_audio_processors () const {
165 return _show_experimental_audio_processors;
168 ISDCFMetadata default_isdcf_metadata () const {
169 return _default_isdcf_metadata;
172 boost::optional<std::string> language () const {
176 int default_still_length () const {
177 return _default_still_length;
180 Ratio const * default_container () const {
181 return _default_container;
184 DCPContentType const * default_dcp_content_type () const {
185 return _default_dcp_content_type;
188 int default_dcp_audio_channels () const {
189 return _default_dcp_audio_channels;
192 std::string dcp_issuer () const {
196 std::string dcp_creator () const {
200 std::string dcp_company_name () const {
201 return _dcp_company_name;
204 std::string dcp_product_name () const {
205 return _dcp_product_name;
208 std::string dcp_product_version () const {
209 return _dcp_product_version;
212 std::string dcp_j2k_comment () const {
213 return _dcp_j2k_comment;
216 int default_j2k_bandwidth () const {
217 return _default_j2k_bandwidth;
220 int default_audio_delay () const {
221 return _default_audio_delay;
224 bool default_interop () const {
225 return _default_interop;
228 bool upload_after_make_dcp () {
229 return _upload_after_make_dcp;
232 void set_default_kdm_directory (boost::filesystem::path d) {
233 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
236 _default_kdm_directory = d;
240 std::string mail_server () const {
244 int mail_port () const {
248 EmailProtocol mail_protocol () const {
249 return _mail_protocol;
252 std::string mail_user () const {
256 std::string mail_password () const {
257 return _mail_password;
260 std::string kdm_subject () const {
264 std::string kdm_from () const {
268 std::vector<std::string> kdm_cc () const {
272 std::string kdm_bcc () const {
276 std::string kdm_email () const {
280 std::string notification_subject () const {
281 return _notification_subject;
284 std::string notification_from () const {
285 return _notification_from;
288 std::string notification_to () const {
289 return _notification_to;
292 std::vector<std::string> notification_cc () const {
293 return _notification_cc;
296 std::string notification_bcc () const {
297 return _notification_bcc;
300 std::string notification_email () const {
301 return _notification_email;
304 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
305 return _signer_chain;
308 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
309 return _decryption_chain;
312 bool check_for_updates () const {
313 return _check_for_updates;
316 bool check_for_test_updates () const {
317 return _check_for_test_updates;
320 int maximum_j2k_bandwidth () const {
321 return _maximum_j2k_bandwidth;
324 int log_types () const {
328 bool analyse_ebur128 () const {
329 return _analyse_ebur128;
332 bool automatic_audio_analysis () const {
333 return _automatic_audio_analysis;
336 #ifdef DCPOMATIC_WINDOWS
337 bool win32_console () const {
338 return _win32_console;
342 std::vector<boost::filesystem::path> history () const {
346 std::vector<boost::filesystem::path> player_history () const {
347 return _player_history;
350 std::shared_ptr<DKDMGroup> dkdms () const {
354 boost::filesystem::path cinemas_file () const {
355 return _cinemas_file;
358 boost::filesystem::path dkdm_recipients_file () const {
359 return _dkdm_recipients_file;
362 bool show_hints_before_make_dcp () const {
363 return _show_hints_before_make_dcp;
366 bool confirm_kdm_email () const {
367 return _confirm_kdm_email;
370 dcp::NameFormat kdm_container_name_format () const {
371 return _kdm_container_name_format;
374 dcp::NameFormat kdm_filename_format () const {
375 return _kdm_filename_format;
378 dcp::NameFormat dkdm_filename_format () const {
379 return _dkdm_filename_format;
382 dcp::NameFormat dcp_metadata_filename_format () const {
383 return _dcp_metadata_filename_format;
386 dcp::NameFormat dcp_asset_filename_format () const {
387 return _dcp_asset_filename_format;
390 bool jump_to_selected () const {
391 return _jump_to_selected;
396 NAG_ENCRYPTED_METADATA,
397 NAG_ALTER_DECRYPTION_CHAIN,
398 NAG_BAD_SIGNER_CHAIN,
399 NAG_IMPORT_DECRYPTION_CHAIN,
405 bool nagged (Nag nag) const {
409 bool sound () const {
413 std::string cover_sheet () const {
417 boost::optional<std::string> sound_output () const {
418 return _sound_output;
421 boost::optional<boost::filesystem::path> last_player_load_directory () const {
422 return _last_player_load_directory;
431 boost::optional<KDMWriteType> last_kdm_write_type () const {
432 return _last_kdm_write_type;
440 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
441 return _last_dkdm_write_type;
444 int frames_in_memory_multiplier () const {
445 return _frames_in_memory_multiplier;
448 boost::optional<int> decode_reduction () const {
449 return _decode_reduction;
452 bool default_notify () const {
453 return _default_notify;
462 bool notification (Notification n) const {
463 return _notification[n];
466 boost::optional<std::string> barco_username () const {
467 return _barco_username;
470 boost::optional<std::string> barco_password () const {
471 return _barco_password;
474 boost::optional<std::string> christie_username () const {
475 return _christie_username;
478 boost::optional<std::string> christie_password () const {
479 return _christie_password;
482 boost::optional<std::string> gdc_username () const {
483 return _gdc_username;
486 boost::optional<std::string> gdc_password () const {
487 return _gdc_password;
491 PLAYER_MODE_WINDOW, ///< one window containing image and controls
492 PLAYER_MODE_FULL, ///< just the image filling the screen
493 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
496 PlayerMode player_mode () const {
500 int image_display () const {
501 return _image_display;
509 VideoViewType video_view_type () const {
510 return _video_view_type;
513 bool respect_kdm_validity_periods () const {
514 return _respect_kdm_validity_periods;
517 boost::optional<boost::filesystem::path> player_activity_log_file () const {
518 return _player_activity_log_file;
521 boost::optional<boost::filesystem::path> player_debug_log_file () const {
522 return _player_debug_log_file;
525 boost::optional<boost::filesystem::path> player_content_directory () const {
526 return _player_content_directory;
529 boost::optional<boost::filesystem::path> player_playlist_directory () const {
530 return _player_playlist_directory;
533 boost::optional<boost::filesystem::path> player_kdm_directory () const {
534 return _player_kdm_directory;
537 AudioMapping audio_mapping (int output_channels);
539 int minimum_frame_size () const {
540 return _minimum_frame_size;
545 void set_master_encoding_threads (int n) {
546 maybe_set (_master_encoding_threads, n);
549 void set_server_encoding_threads (int n) {
550 maybe_set (_server_encoding_threads, n);
553 void set_default_directory (boost::filesystem::path d) {
554 if (_default_directory && *_default_directory == d) {
557 _default_directory = d;
561 /** @param p New server port */
562 void set_server_port_base (int p) {
563 maybe_set (_server_port_base, p);
566 void set_only_servers_encode (bool o) {
567 maybe_set (_only_servers_encode, o);
570 void set_tms_protocol (FileTransferProtocol p) {
571 maybe_set (_tms_protocol, p);
574 /** @param i IP address of a TMS that we can copy DCPs to */
575 void set_tms_ip (std::string i) {
576 maybe_set (_tms_ip, i);
579 /** @param p Path on a TMS that we should changed DCPs to */
580 void set_tms_path (std::string p) {
581 maybe_set (_tms_path, p);
584 /** @param u User name to log into the TMS with */
585 void set_tms_user (std::string u) {
586 maybe_set (_tms_user, u);
589 /** @param p Password to log into the TMS with */
590 void set_tms_password (std::string p) {
591 maybe_set (_tms_password, p);
594 void add_cinema (std::shared_ptr<Cinema> c) {
595 _cinemas.push_back (c);
599 void remove_cinema (std::shared_ptr<Cinema> c) {
604 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
605 _dkdm_recipients.push_back (c);
606 changed (DKDM_RECIPIENTS);
609 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
610 _dkdm_recipients.remove (c);
611 changed (DKDM_RECIPIENTS);
614 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
615 maybe_set (_allowed_dcp_frame_rates, r);
618 void set_allow_any_dcp_frame_rate (bool a) {
619 maybe_set (_allow_any_dcp_frame_rate, a);
622 void set_allow_any_container (bool a) {
623 maybe_set (_allow_any_container, a);
626 void set_show_experimental_audio_processors (bool e) {
627 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
630 void set_default_isdcf_metadata (ISDCFMetadata d) {
631 maybe_set (_default_isdcf_metadata, d);
634 void set_language (std::string l) {
635 if (_language && _language.get() == l) {
642 void unset_language () {
647 _language = boost::none;
651 void set_default_still_length (int s) {
652 maybe_set (_default_still_length, s);
655 void set_default_container (Ratio const * c) {
656 maybe_set (_default_container, c);
659 void set_default_dcp_content_type (DCPContentType const * t) {
660 maybe_set (_default_dcp_content_type, t);
663 void set_default_dcp_audio_channels (int c) {
664 maybe_set (_default_dcp_audio_channels, c);
667 void set_dcp_issuer (std::string i) {
668 maybe_set (_dcp_issuer, i);
671 void set_dcp_creator (std::string c) {
672 maybe_set (_dcp_creator, c);
675 void set_dcp_company_name (std::string c) {
676 maybe_set (_dcp_company_name, c);
679 void set_dcp_product_name (std::string c) {
680 maybe_set (_dcp_product_name, c);
683 void set_dcp_product_version (std::string c) {
684 maybe_set (_dcp_product_version, c);
687 void set_dcp_j2k_comment (std::string c) {
688 maybe_set (_dcp_j2k_comment, c);
691 void set_default_j2k_bandwidth (int b) {
692 maybe_set (_default_j2k_bandwidth, b);
695 void set_default_audio_delay (int d) {
696 maybe_set (_default_audio_delay, d);
699 void set_default_interop (bool i) {
700 maybe_set (_default_interop, i);
703 void set_upload_after_make_dcp (bool u) {
704 maybe_set (_upload_after_make_dcp, u);
707 void set_mail_server (std::string s) {
708 maybe_set (_mail_server, s);
711 void set_mail_port (int p) {
712 maybe_set (_mail_port, p);
715 void set_mail_protocol (EmailProtocol p) {
716 maybe_set (_mail_protocol, p);
719 void set_mail_user (std::string u) {
720 maybe_set (_mail_user, u);
723 void set_mail_password (std::string p) {
724 maybe_set (_mail_password, p);
727 void set_kdm_subject (std::string s) {
728 maybe_set (_kdm_subject, s);
731 void set_kdm_from (std::string f) {
732 maybe_set (_kdm_from, f);
735 void set_kdm_cc (std::vector<std::string> f) {
736 maybe_set (_kdm_cc, f);
739 void set_kdm_bcc (std::string f) {
740 maybe_set (_kdm_bcc, f);
743 void set_kdm_email (std::string e) {
744 maybe_set (_kdm_email, e);
747 void reset_kdm_email ();
749 void set_notification_subject (std::string s) {
750 maybe_set (_notification_subject, s);
753 void set_notification_from (std::string f) {
754 maybe_set (_notification_from, f);
757 void set_notification_to (std::string t) {
758 maybe_set (_notification_to, t);
761 void set_notification_cc (std::vector<std::string> f) {
762 maybe_set (_notification_cc, f);
765 void set_notification_bcc (std::string f) {
766 maybe_set (_notification_bcc, f);
769 void set_notification_email (std::string e) {
770 maybe_set (_notification_email, e);
773 void reset_notification_email ();
775 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
776 maybe_set (_signer_chain, s);
779 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
780 maybe_set (_decryption_chain, c);
783 void set_check_for_updates (bool c) {
784 maybe_set (_check_for_updates, c);
786 set_check_for_test_updates (false);
790 void set_check_for_test_updates (bool c) {
791 maybe_set (_check_for_test_updates, c);
794 void set_maximum_j2k_bandwidth (int b) {
795 maybe_set (_maximum_j2k_bandwidth, b);
798 void set_log_types (int t) {
799 maybe_set (_log_types, t);
802 void set_analyse_ebur128 (bool a) {
803 maybe_set (_analyse_ebur128, a);
806 void set_automatic_audio_analysis (bool a) {
807 maybe_set (_automatic_audio_analysis, a);
810 #ifdef DCPOMATIC_WINDOWS
811 void set_win32_console (bool c) {
812 maybe_set (_win32_console, c);
816 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
821 void set_cinemas_file (boost::filesystem::path file);
823 void set_dkdm_recipients_file (boost::filesystem::path file);
825 void set_show_hints_before_make_dcp (bool s) {
826 maybe_set (_show_hints_before_make_dcp, s);
829 void set_confirm_kdm_email (bool s) {
830 maybe_set (_confirm_kdm_email, s);
833 void set_sound (bool s) {
834 maybe_set (_sound, s, SOUND);
837 void set_sound_output (std::string o) {
838 maybe_set (_sound_output, o, SOUND_OUTPUT);
841 void set_last_player_load_directory (boost::filesystem::path d) {
842 maybe_set (_last_player_load_directory, d);
845 void set_last_kdm_write_type (KDMWriteType t) {
846 maybe_set (_last_kdm_write_type, t);
849 void set_last_dkdm_write_type (DKDMWriteType t) {
850 maybe_set (_last_dkdm_write_type, t);
853 void unset_sound_output () {
854 if (!_sound_output) {
858 _sound_output = boost::none;
862 void set_kdm_container_name_format (dcp::NameFormat n) {
863 maybe_set (_kdm_container_name_format, n);
866 void set_kdm_filename_format (dcp::NameFormat n) {
867 maybe_set (_kdm_filename_format, n);
870 void set_dkdm_filename_format (dcp::NameFormat n) {
871 maybe_set (_dkdm_filename_format, n);
874 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
875 maybe_set (_dcp_metadata_filename_format, n);
878 void set_dcp_asset_filename_format (dcp::NameFormat n) {
879 maybe_set (_dcp_asset_filename_format, n);
882 void set_frames_in_memory_multiplier (int m) {
883 maybe_set (_frames_in_memory_multiplier, m);
886 void set_decode_reduction (boost::optional<int> r) {
887 maybe_set (_decode_reduction, r);
890 void set_default_notify (bool n) {
891 maybe_set (_default_notify, n);
894 void clear_history () {
899 void clear_player_history () {
900 _player_history.clear ();
904 void add_to_history (boost::filesystem::path p);
905 void clean_history ();
906 void add_to_player_history (boost::filesystem::path p);
907 void clean_player_history ();
909 void set_jump_to_selected (bool j) {
910 maybe_set (_jump_to_selected, j);
913 void set_nagged (Nag nag, bool nagged) {
914 maybe_set (_nagged[nag], nagged);
917 void set_cover_sheet (std::string s) {
918 maybe_set (_cover_sheet, s);
921 void reset_cover_sheet ();
923 void set_notification (Notification n, bool v) {
924 maybe_set (_notification[n], v);
927 void set_barco_username (std::string u) {
928 maybe_set (_barco_username, u);
931 void unset_barco_username () {
932 maybe_set (_barco_username, boost::optional<std::string>());
935 void set_barco_password (std::string p) {
936 maybe_set (_barco_password, p);
939 void unset_barco_password () {
940 maybe_set (_barco_password, boost::optional<std::string>());
943 void set_christie_username (std::string u) {
944 maybe_set (_christie_username, u);
947 void unset_christie_username () {
948 maybe_set (_christie_username, boost::optional<std::string>());
951 void set_christie_password (std::string p) {
952 maybe_set (_christie_password, p);
955 void unset_christie_password () {
956 maybe_set (_christie_password, boost::optional<std::string>());
959 void set_gdc_username (std::string u) {
960 maybe_set (_gdc_username, u);
963 void unset_gdc_username () {
964 maybe_set (_gdc_username, boost::optional<std::string>());
967 void set_gdc_password (std::string p) {
968 maybe_set (_gdc_password, p);
971 void unset_gdc_password () {
972 maybe_set (_gdc_password, boost::optional<std::string>());
975 void set_player_mode (PlayerMode m) {
976 maybe_set (_player_mode, m);
979 void set_image_display (int n) {
980 maybe_set (_image_display, n);
983 void set_video_view_type (VideoViewType v) {
984 maybe_set (_video_view_type, v);
987 void set_respect_kdm_validity_periods (bool r) {
988 maybe_set (_respect_kdm_validity_periods, r);
991 void set_player_activity_log_file (boost::filesystem::path p) {
992 maybe_set (_player_activity_log_file, p);
995 void unset_player_activity_log_file () {
996 if (!_player_activity_log_file) {
999 _player_activity_log_file = boost::none;
1003 void set_player_debug_log_file (boost::filesystem::path p) {
1004 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1007 void unset_player_debug_log_file () {
1008 if (!_player_debug_log_file) {
1011 _player_debug_log_file = boost::none;
1012 changed (PLAYER_DEBUG_LOG);
1015 void set_player_content_directory (boost::filesystem::path p) {
1016 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1019 void unset_player_content_directory () {
1020 if (!_player_content_directory) {
1023 _player_content_directory = boost::none;
1024 changed (PLAYER_CONTENT_DIRECTORY);
1027 void set_player_playlist_directory (boost::filesystem::path p) {
1028 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1031 void unset_player_playlist_directory () {
1032 if (!_player_playlist_directory) {
1035 _player_playlist_directory = boost::none;
1036 changed (PLAYER_PLAYLIST_DIRECTORY);
1039 void set_player_kdm_directory (boost::filesystem::path p) {
1040 maybe_set (_player_kdm_directory, p);
1043 void unset_player_kdm_directory () {
1044 if (!_player_kdm_directory) {
1047 _player_kdm_directory = boost::none;
1051 void set_audio_mapping (AudioMapping m);
1052 void set_audio_mapping_to_default ();
1054 void set_minimum_frame_size (int size) {
1055 maybe_set (_minimum_frame_size, size);
1058 void changed (Property p = OTHER);
1059 boost::signals2::signal<void (Property)> Changed;
1060 /** Emitted if read() failed on an existing Config file. There is nothing
1061 a listener can do about it: this is just for information.
1063 static boost::signals2::signal<void ()> FailedToLoad;
1064 /** Emitted if read() issued a warning which the user might want to know about */
1065 static boost::signals2::signal<void (std::string)> Warning;
1066 /** Emitted if there is a something wrong the contents of our config. Handler can call
1067 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1070 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1071 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1072 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1075 static boost::signals2::signal<bool (BadReason)> Bad;
1077 void write () const;
1078 void write_config () const;
1079 void write_cinemas () const;
1080 void write_dkdm_recipients () const;
1081 void link (boost::filesystem::path new_file) const;
1082 void copy_and_link (boost::filesystem::path new_file) const;
1083 bool have_write_permission () const;
1085 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1086 bool existing_template (std::string name) const;
1087 std::list<std::string> templates () const;
1088 boost::filesystem::path template_path (std::string name) const;
1089 void rename_template (std::string old_name, std::string new_name) const;
1090 void delete_template (std::string name) const;
1092 static Config* instance ();
1093 static void drop ();
1094 static void restore_defaults ();
1095 static bool have_existing (std::string);
1096 static boost::filesystem::path config_file ();
1101 void set_defaults ();
1102 void set_kdm_email_to_default ();
1103 void set_notification_email_to_default ();
1104 void set_cover_sheet_to_default ();
1105 void read_cinemas (cxml::Document const & f);
1106 void read_dkdm_recipients (cxml::Document const & f);
1107 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1108 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1109 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1110 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1114 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1115 if (member == new_value) {
1123 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1124 if (member && member.get() == new_value) {
1131 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1132 int _master_encoding_threads;
1133 /** number of threads which a server should use for J2K encoding on the local machine */
1134 int _server_encoding_threads;
1135 /** default directory to put new films in */
1136 boost::optional<boost::filesystem::path> _default_directory;
1137 /** base port number to use for J2K encoding servers;
1138 * this port and the two above it will be used.
1140 int _server_port_base;
1141 /** true to broadcast on the `any' address to look for servers */
1142 bool _use_any_servers;
1143 /** J2K encoding servers that should definitely be used */
1144 std::vector<std::string> _servers;
1145 bool _only_servers_encode;
1146 FileTransferProtocol _tms_protocol;
1147 /** The IP address of a TMS that we can copy DCPs to */
1148 std::string _tms_ip;
1149 /** The path on a TMS that we should write DCPs to */
1150 std::string _tms_path;
1151 /** User name to log into the TMS with */
1152 std::string _tms_user;
1153 /** Password to log into the TMS with */
1154 std::string _tms_password;
1155 /** The list of possible DCP frame rates that DCP-o-matic will use */
1156 std::list<int> _allowed_dcp_frame_rates;
1157 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1158 bool _allow_any_dcp_frame_rate;
1159 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1160 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1161 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1163 bool _allow_any_container;
1164 /** Offer the upmixers in the audio processor settings */
1165 bool _show_experimental_audio_processors;
1166 /** Default ISDCF metadata for newly-created Films */
1167 ISDCFMetadata _default_isdcf_metadata;
1168 boost::optional<std::string> _language;
1169 /** Default length of still image content (seconds) */
1170 int _default_still_length;
1171 Ratio const * _default_container;
1172 DCPContentType const * _default_dcp_content_type;
1173 int _default_dcp_audio_channels;
1174 std::string _dcp_issuer;
1175 std::string _dcp_creator;
1176 std::string _dcp_company_name;
1177 std::string _dcp_product_name;
1178 std::string _dcp_product_version;
1179 std::string _dcp_j2k_comment;
1180 int _default_j2k_bandwidth;
1181 int _default_audio_delay;
1182 bool _default_interop;
1183 /** Default directory to offer to write KDMs to; if it's not set,
1184 the home directory will be offered.
1186 boost::optional<boost::filesystem::path> _default_kdm_directory;
1187 bool _upload_after_make_dcp;
1188 std::list<std::shared_ptr<Cinema> > _cinemas;
1189 std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1190 std::string _mail_server;
1192 EmailProtocol _mail_protocol;
1193 std::string _mail_user;
1194 std::string _mail_password;
1195 std::string _kdm_subject;
1196 std::string _kdm_from;
1197 std::vector<std::string> _kdm_cc;
1198 std::string _kdm_bcc;
1199 std::string _kdm_email;
1200 std::string _notification_subject;
1201 std::string _notification_from;
1202 std::string _notification_to;
1203 std::vector<std::string> _notification_cc;
1204 std::string _notification_bcc;
1205 std::string _notification_email;
1206 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1207 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1208 * certificate for making KDMs given to DCP-o-matic.
1210 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1211 /** true to check for updates on startup */
1212 bool _check_for_updates;
1213 bool _check_for_test_updates;
1214 /** maximum allowed J2K bandwidth in bits per second */
1215 int _maximum_j2k_bandwidth;
1217 bool _analyse_ebur128;
1218 bool _automatic_audio_analysis;
1219 #ifdef DCPOMATIC_WINDOWS
1220 bool _win32_console;
1222 std::vector<boost::filesystem::path> _history;
1223 std::vector<boost::filesystem::path> _player_history;
1224 std::shared_ptr<DKDMGroup> _dkdms;
1225 boost::filesystem::path _cinemas_file;
1226 boost::filesystem::path _dkdm_recipients_file;
1227 bool _show_hints_before_make_dcp;
1228 bool _confirm_kdm_email;
1229 dcp::NameFormat _kdm_filename_format;
1230 dcp::NameFormat _dkdm_filename_format;
1231 dcp::NameFormat _kdm_container_name_format;
1232 dcp::NameFormat _dcp_metadata_filename_format;
1233 dcp::NameFormat _dcp_asset_filename_format;
1234 bool _jump_to_selected;
1235 bool _nagged[NAG_COUNT];
1237 /** name of a specific sound output stream to use, or empty to use the default */
1238 boost::optional<std::string> _sound_output;
1239 std::string _cover_sheet;
1240 boost::optional<boost::filesystem::path> _last_player_load_directory;
1241 boost::optional<KDMWriteType> _last_kdm_write_type;
1242 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1243 int _frames_in_memory_multiplier;
1244 boost::optional<int> _decode_reduction;
1245 bool _default_notify;
1246 bool _notification[NOTIFICATION_COUNT];
1247 boost::optional<std::string> _barco_username;
1248 boost::optional<std::string> _barco_password;
1249 boost::optional<std::string> _christie_username;
1250 boost::optional<std::string> _christie_password;
1251 boost::optional<std::string> _gdc_username;
1252 boost::optional<std::string> _gdc_password;
1253 PlayerMode _player_mode;
1255 VideoViewType _video_view_type;
1256 bool _respect_kdm_validity_periods;
1257 /** Log file containing things the player does (e.g. started, stopped, loaded
1258 playlist etc.) Does not contain debugging information.
1260 boost::optional<boost::filesystem::path> _player_activity_log_file;
1261 /** Log file containing debug information for the player */
1262 boost::optional<boost::filesystem::path> _player_debug_log_file;
1263 /** A directory containing DCPs whose contents are presented to the user
1264 in the dual-screen player mode. DCPs on the list can be loaded
1267 boost::optional<boost::filesystem::path> _player_content_directory;
1268 boost::optional<boost::filesystem::path> _player_playlist_directory;
1269 boost::optional<boost::filesystem::path> _player_kdm_directory;
1270 boost::optional<AudioMapping> _audio_mapping;
1271 int _minimum_frame_size;
1273 static int const _current_version;
1275 /** Singleton instance, or 0 */
1276 static Config* _instance;