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
30 #include "audio_mapping.h"
31 #include <dcp/name_format.h>
32 #include <dcp/certificate_chain.h>
33 #include <dcp/encrypted_kdm.h>
34 #include <dcp/language_tag.h>
35 #include <boost/signals2.hpp>
36 #include <boost/filesystem.hpp>
39 class CinemaSoundProcessor;
48 * @brief A singleton class holding configuration.
50 class Config : public State
53 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
54 int master_encoding_threads () const {
55 return _master_encoding_threads;
58 /** @return number of threads which a server should use for J2K encoding on the local machine */
59 int server_encoding_threads () const {
60 return _server_encoding_threads;
63 boost::optional<boost::filesystem::path> default_directory () const {
64 return _default_directory;
67 boost::optional<boost::filesystem::path> default_kdm_directory () const {
68 return _default_kdm_directory;
71 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
72 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
81 PLAYER_CONTENT_DIRECTORY,
82 PLAYER_PLAYLIST_DIRECTORY,
85 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
90 /** @return base port number to use for J2K encoding servers */
91 int server_port_base () const {
92 return _server_port_base;
95 void set_use_any_servers (bool u) {
97 changed (USE_ANY_SERVERS);
100 bool use_any_servers () const {
101 return _use_any_servers;
104 /** @param s New list of servers */
105 void set_servers (std::vector<std::string> s) {
110 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
111 std::vector<std::string> servers () const {
115 bool only_servers_encode () const {
116 return _only_servers_encode;
119 FileTransferProtocol tms_protocol () const {
120 return _tms_protocol;
123 /** @return The IP address of a TMS that we can copy DCPs to */
124 std::string tms_ip () const {
128 /** @return The path on a TMS that we should changed DCPs to */
129 std::string tms_path () const {
133 /** @return User name to log into the TMS with */
134 std::string tms_user () const {
138 /** @return Password to log into the TMS with */
139 std::string tms_password () const {
140 return _tms_password;
143 std::list<std::shared_ptr<Cinema> > cinemas () const {
147 std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
148 return _dkdm_recipients;
151 std::list<int> allowed_dcp_frame_rates () const {
152 return _allowed_dcp_frame_rates;
155 bool allow_any_dcp_frame_rate () const {
156 return _allow_any_dcp_frame_rate;
159 bool allow_any_container () const {
160 return _allow_any_container;
163 bool show_experimental_audio_processors () const {
164 return _show_experimental_audio_processors;
167 boost::optional<std::string> language () const {
171 int default_still_length () const {
172 return _default_still_length;
175 Ratio const * default_container () const {
176 return _default_container;
179 DCPContentType const * default_dcp_content_type () const {
180 return _default_dcp_content_type;
183 int default_dcp_audio_channels () const {
184 return _default_dcp_audio_channels;
187 std::string dcp_issuer () const {
191 std::string dcp_creator () const {
195 std::string dcp_company_name () const {
196 return _dcp_company_name;
199 std::string dcp_product_name () const {
200 return _dcp_product_name;
203 std::string dcp_product_version () const {
204 return _dcp_product_version;
207 std::string dcp_j2k_comment () const {
208 return _dcp_j2k_comment;
211 int default_j2k_bandwidth () const {
212 return _default_j2k_bandwidth;
215 int default_audio_delay () const {
216 return _default_audio_delay;
219 bool default_interop () const {
220 return _default_interop;
223 std::map<std::string, std::string> default_metadata () const {
224 return _default_metadata;
227 bool upload_after_make_dcp () {
228 return _upload_after_make_dcp;
231 void set_default_kdm_directory (boost::filesystem::path d) {
232 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
235 _default_kdm_directory = d;
239 std::string mail_server () const {
243 int mail_port () const {
247 EmailProtocol mail_protocol () const {
248 return _mail_protocol;
251 std::string mail_user () const {
255 std::string mail_password () const {
256 return _mail_password;
259 std::string kdm_subject () const {
263 std::string kdm_from () const {
267 std::vector<std::string> kdm_cc () const {
271 std::string kdm_bcc () const {
275 std::string kdm_email () const {
279 std::string notification_subject () const {
280 return _notification_subject;
283 std::string notification_from () const {
284 return _notification_from;
287 std::string notification_to () const {
288 return _notification_to;
291 std::vector<std::string> notification_cc () const {
292 return _notification_cc;
295 std::string notification_bcc () const {
296 return _notification_bcc;
299 std::string notification_email () const {
300 return _notification_email;
303 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
304 return _signer_chain;
307 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
308 return _decryption_chain;
311 bool check_for_updates () const {
312 return _check_for_updates;
315 bool check_for_test_updates () const {
316 return _check_for_test_updates;
319 int maximum_j2k_bandwidth () const {
320 return _maximum_j2k_bandwidth;
323 int log_types () const {
327 bool analyse_ebur128 () const {
328 return _analyse_ebur128;
331 bool automatic_audio_analysis () const {
332 return _automatic_audio_analysis;
335 #ifdef DCPOMATIC_WINDOWS
336 bool win32_console () const {
337 return _win32_console;
341 std::vector<boost::filesystem::path> history () const {
345 std::vector<boost::filesystem::path> player_history () const {
346 return _player_history;
349 std::shared_ptr<DKDMGroup> dkdms () const {
353 boost::filesystem::path cinemas_file () const {
354 return _cinemas_file;
357 boost::filesystem::path dkdm_recipients_file () const {
358 return _dkdm_recipients_file;
361 bool show_hints_before_make_dcp () const {
362 return _show_hints_before_make_dcp;
365 bool confirm_kdm_email () const {
366 return _confirm_kdm_email;
369 dcp::NameFormat kdm_container_name_format () const {
370 return _kdm_container_name_format;
373 dcp::NameFormat kdm_filename_format () const {
374 return _kdm_filename_format;
377 dcp::NameFormat dkdm_filename_format () const {
378 return _dkdm_filename_format;
381 dcp::NameFormat dcp_metadata_filename_format () const {
382 return _dcp_metadata_filename_format;
385 dcp::NameFormat dcp_asset_filename_format () const {
386 return _dcp_asset_filename_format;
389 bool jump_to_selected () const {
390 return _jump_to_selected;
393 /* This could be an enum class but we use the enum a lot to index _nagged
394 * so it means a lot of casts.
398 NAG_ENCRYPTED_METADATA,
399 NAG_ALTER_DECRYPTION_CHAIN,
400 NAG_BAD_SIGNER_CHAIN,
401 NAG_IMPORT_DECRYPTION_CHAIN,
404 NAG_TOO_MANY_DROPPED_FRAMES,
408 bool nagged (Nag nag) const {
412 bool sound () const {
416 std::string cover_sheet () const {
420 boost::optional<std::string> sound_output () const {
421 return _sound_output;
424 boost::optional<boost::filesystem::path> last_player_load_directory () const {
425 return _last_player_load_directory;
434 boost::optional<KDMWriteType> last_kdm_write_type () const {
435 return _last_kdm_write_type;
443 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
444 return _last_dkdm_write_type;
447 int frames_in_memory_multiplier () const {
448 return _frames_in_memory_multiplier;
451 boost::optional<int> decode_reduction () const {
452 return _decode_reduction;
455 bool default_notify () const {
456 return _default_notify;
465 bool notification (Notification n) const {
466 return _notification[n];
469 boost::optional<std::string> barco_username () const {
470 return _barco_username;
473 boost::optional<std::string> barco_password () const {
474 return _barco_password;
477 boost::optional<std::string> christie_username () const {
478 return _christie_username;
481 boost::optional<std::string> christie_password () const {
482 return _christie_password;
485 boost::optional<std::string> gdc_username () const {
486 return _gdc_username;
489 boost::optional<std::string> gdc_password () const {
490 return _gdc_password;
494 PLAYER_MODE_WINDOW, ///< one window containing image and controls
495 PLAYER_MODE_FULL, ///< just the image filling the screen
496 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
499 PlayerMode player_mode () const {
503 int image_display () const {
504 return _image_display;
512 VideoViewType video_view_type () const {
513 return _video_view_type;
516 bool respect_kdm_validity_periods () const {
517 return _respect_kdm_validity_periods;
520 boost::optional<boost::filesystem::path> player_debug_log_file () const {
521 return _player_debug_log_file;
524 boost::optional<boost::filesystem::path> player_content_directory () const {
525 return _player_content_directory;
528 boost::optional<boost::filesystem::path> player_playlist_directory () const {
529 return _player_playlist_directory;
532 boost::optional<boost::filesystem::path> player_kdm_directory () const {
533 return _player_kdm_directory;
536 AudioMapping audio_mapping (int output_channels);
538 std::vector<dcp::LanguageTag> custom_languages () const {
539 return _custom_languages;
542 boost::optional<boost::filesystem::path> add_files_path () const {
543 return _add_files_path;
548 void set_master_encoding_threads (int n) {
549 maybe_set (_master_encoding_threads, n);
552 void set_server_encoding_threads (int n) {
553 maybe_set (_server_encoding_threads, n);
556 void set_default_directory (boost::filesystem::path d) {
557 if (_default_directory && *_default_directory == d) {
560 _default_directory = d;
564 /** @param p New server port */
565 void set_server_port_base (int p) {
566 maybe_set (_server_port_base, p);
569 void set_only_servers_encode (bool o) {
570 maybe_set (_only_servers_encode, o);
573 void set_tms_protocol (FileTransferProtocol p) {
574 maybe_set (_tms_protocol, p);
577 /** @param i IP address of a TMS that we can copy DCPs to */
578 void set_tms_ip (std::string i) {
579 maybe_set (_tms_ip, i);
582 /** @param p Path on a TMS that we should changed DCPs to */
583 void set_tms_path (std::string p) {
584 maybe_set (_tms_path, p);
587 /** @param u User name to log into the TMS with */
588 void set_tms_user (std::string u) {
589 maybe_set (_tms_user, u);
592 /** @param p Password to log into the TMS with */
593 void set_tms_password (std::string p) {
594 maybe_set (_tms_password, p);
597 void add_cinema (std::shared_ptr<Cinema> c) {
598 _cinemas.push_back (c);
602 void remove_cinema (std::shared_ptr<Cinema> c) {
607 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
608 _dkdm_recipients.push_back (c);
609 changed (DKDM_RECIPIENTS);
612 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
613 _dkdm_recipients.remove (c);
614 changed (DKDM_RECIPIENTS);
617 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
618 maybe_set (_allowed_dcp_frame_rates, r);
621 void set_allow_any_dcp_frame_rate (bool a) {
622 maybe_set (_allow_any_dcp_frame_rate, a);
625 void set_allow_any_container (bool a) {
626 maybe_set (_allow_any_container, a);
629 void set_show_experimental_audio_processors (bool e) {
630 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
633 void set_language (std::string l) {
634 if (_language && _language.get() == l) {
641 void unset_language () {
646 _language = boost::none;
650 void set_default_still_length (int s) {
651 maybe_set (_default_still_length, s);
654 void set_default_container (Ratio const * c) {
655 maybe_set (_default_container, c);
658 void set_default_dcp_content_type (DCPContentType const * t) {
659 maybe_set (_default_dcp_content_type, t);
662 void set_default_dcp_audio_channels (int c) {
663 maybe_set (_default_dcp_audio_channels, c);
666 void set_dcp_issuer (std::string i) {
667 maybe_set (_dcp_issuer, i);
670 void set_dcp_creator (std::string c) {
671 maybe_set (_dcp_creator, c);
674 void set_dcp_company_name (std::string c) {
675 maybe_set (_dcp_company_name, c);
678 void set_dcp_product_name (std::string c) {
679 maybe_set (_dcp_product_name, c);
682 void set_dcp_product_version (std::string c) {
683 maybe_set (_dcp_product_version, c);
686 void set_dcp_j2k_comment (std::string c) {
687 maybe_set (_dcp_j2k_comment, c);
690 void set_default_j2k_bandwidth (int b) {
691 maybe_set (_default_j2k_bandwidth, b);
694 void set_default_audio_delay (int d) {
695 maybe_set (_default_audio_delay, d);
698 void set_default_interop (bool i) {
699 maybe_set (_default_interop, i);
702 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
703 maybe_set (_default_metadata, metadata);
706 void set_upload_after_make_dcp (bool u) {
707 maybe_set (_upload_after_make_dcp, u);
710 void set_mail_server (std::string s) {
711 maybe_set (_mail_server, s);
714 void set_mail_port (int p) {
715 maybe_set (_mail_port, p);
718 void set_mail_protocol (EmailProtocol p) {
719 maybe_set (_mail_protocol, p);
722 void set_mail_user (std::string u) {
723 maybe_set (_mail_user, u);
726 void set_mail_password (std::string p) {
727 maybe_set (_mail_password, p);
730 void set_kdm_subject (std::string s) {
731 maybe_set (_kdm_subject, s);
734 void set_kdm_from (std::string f) {
735 maybe_set (_kdm_from, f);
738 void set_kdm_cc (std::vector<std::string> f) {
739 maybe_set (_kdm_cc, f);
742 void set_kdm_bcc (std::string f) {
743 maybe_set (_kdm_bcc, f);
746 void set_kdm_email (std::string e) {
747 maybe_set (_kdm_email, e);
750 void reset_kdm_email ();
752 void set_notification_subject (std::string s) {
753 maybe_set (_notification_subject, s);
756 void set_notification_from (std::string f) {
757 maybe_set (_notification_from, f);
760 void set_notification_to (std::string t) {
761 maybe_set (_notification_to, t);
764 void set_notification_cc (std::vector<std::string> f) {
765 maybe_set (_notification_cc, f);
768 void set_notification_bcc (std::string f) {
769 maybe_set (_notification_bcc, f);
772 void set_notification_email (std::string e) {
773 maybe_set (_notification_email, e);
776 void reset_notification_email ();
778 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
779 maybe_set (_signer_chain, s);
782 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
783 maybe_set (_decryption_chain, c);
786 void set_check_for_updates (bool c) {
787 maybe_set (_check_for_updates, c);
789 set_check_for_test_updates (false);
793 void set_check_for_test_updates (bool c) {
794 maybe_set (_check_for_test_updates, c);
797 void set_maximum_j2k_bandwidth (int b) {
798 maybe_set (_maximum_j2k_bandwidth, b);
801 void set_log_types (int t) {
802 maybe_set (_log_types, t);
805 void set_analyse_ebur128 (bool a) {
806 maybe_set (_analyse_ebur128, a);
809 void set_automatic_audio_analysis (bool a) {
810 maybe_set (_automatic_audio_analysis, a);
813 #ifdef DCPOMATIC_WINDOWS
814 void set_win32_console (bool c) {
815 maybe_set (_win32_console, c);
819 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
824 void set_cinemas_file (boost::filesystem::path file);
826 void set_show_hints_before_make_dcp (bool s) {
827 maybe_set (_show_hints_before_make_dcp, s);
830 void set_confirm_kdm_email (bool s) {
831 maybe_set (_confirm_kdm_email, s);
834 void set_sound (bool s) {
835 maybe_set (_sound, s, SOUND);
838 void set_sound_output (std::string o) {
839 maybe_set (_sound_output, o, SOUND_OUTPUT);
842 void set_last_player_load_directory (boost::filesystem::path d) {
843 maybe_set (_last_player_load_directory, d);
846 void set_last_kdm_write_type (KDMWriteType t) {
847 maybe_set (_last_kdm_write_type, t);
850 void set_last_dkdm_write_type (DKDMWriteType t) {
851 maybe_set (_last_dkdm_write_type, t);
854 void unset_sound_output () {
855 if (!_sound_output) {
859 _sound_output = boost::none;
863 void set_kdm_container_name_format (dcp::NameFormat n) {
864 maybe_set (_kdm_container_name_format, n);
867 void set_kdm_filename_format (dcp::NameFormat n) {
868 maybe_set (_kdm_filename_format, n);
871 void set_dkdm_filename_format (dcp::NameFormat n) {
872 maybe_set (_dkdm_filename_format, n);
875 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
876 maybe_set (_dcp_metadata_filename_format, n);
879 void set_dcp_asset_filename_format (dcp::NameFormat n) {
880 maybe_set (_dcp_asset_filename_format, n);
883 void set_frames_in_memory_multiplier (int m) {
884 maybe_set (_frames_in_memory_multiplier, m);
887 void set_decode_reduction (boost::optional<int> r) {
888 maybe_set (_decode_reduction, r);
891 void set_default_notify (bool n) {
892 maybe_set (_default_notify, n);
895 void clear_history () {
900 void clear_player_history () {
901 _player_history.clear ();
905 void add_to_history (boost::filesystem::path p);
906 void clean_history ();
907 void add_to_player_history (boost::filesystem::path p);
908 void clean_player_history ();
910 void set_jump_to_selected (bool j) {
911 maybe_set (_jump_to_selected, j);
914 void set_nagged (Nag nag, bool nagged) {
915 maybe_set (_nagged[nag], nagged);
918 void set_cover_sheet (std::string s) {
919 maybe_set (_cover_sheet, s);
922 void reset_cover_sheet ();
924 void set_notification (Notification n, bool v) {
925 maybe_set (_notification[n], v);
928 void set_barco_username (std::string u) {
929 maybe_set (_barco_username, u);
932 void unset_barco_username () {
933 maybe_set (_barco_username, boost::optional<std::string>());
936 void set_barco_password (std::string p) {
937 maybe_set (_barco_password, p);
940 void unset_barco_password () {
941 maybe_set (_barco_password, boost::optional<std::string>());
944 void set_christie_username (std::string u) {
945 maybe_set (_christie_username, u);
948 void unset_christie_username () {
949 maybe_set (_christie_username, boost::optional<std::string>());
952 void set_christie_password (std::string p) {
953 maybe_set (_christie_password, p);
956 void unset_christie_password () {
957 maybe_set (_christie_password, boost::optional<std::string>());
960 void set_gdc_username (std::string u) {
961 maybe_set (_gdc_username, u);
964 void unset_gdc_username () {
965 maybe_set (_gdc_username, boost::optional<std::string>());
968 void set_gdc_password (std::string p) {
969 maybe_set (_gdc_password, p);
972 void unset_gdc_password () {
973 maybe_set (_gdc_password, boost::optional<std::string>());
976 void set_player_mode (PlayerMode m) {
977 maybe_set (_player_mode, m);
980 void set_image_display (int n) {
981 maybe_set (_image_display, n);
984 void set_video_view_type (VideoViewType v) {
985 maybe_set (_video_view_type, v);
988 void set_respect_kdm_validity_periods (bool r) {
989 maybe_set (_respect_kdm_validity_periods, r);
992 void set_player_debug_log_file (boost::filesystem::path p) {
993 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
996 void unset_player_debug_log_file () {
997 if (!_player_debug_log_file) {
1000 _player_debug_log_file = boost::none;
1001 changed (PLAYER_DEBUG_LOG);
1004 void set_player_content_directory (boost::filesystem::path p) {
1005 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1008 void unset_player_content_directory () {
1009 if (!_player_content_directory) {
1012 _player_content_directory = boost::none;
1013 changed (PLAYER_CONTENT_DIRECTORY);
1016 void set_player_playlist_directory (boost::filesystem::path p) {
1017 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1020 void unset_player_playlist_directory () {
1021 if (!_player_playlist_directory) {
1024 _player_playlist_directory = boost::none;
1025 changed (PLAYER_PLAYLIST_DIRECTORY);
1028 void set_player_kdm_directory (boost::filesystem::path p) {
1029 maybe_set (_player_kdm_directory, p);
1032 void unset_player_kdm_directory () {
1033 if (!_player_kdm_directory) {
1036 _player_kdm_directory = boost::none;
1040 void set_audio_mapping (AudioMapping m);
1041 void set_audio_mapping_to_default ();
1043 void add_custom_language (dcp::LanguageTag tag);
1045 void set_add_files_path (boost::filesystem::path p) {
1046 _add_files_path = p;
1050 void changed (Property p = OTHER);
1051 boost::signals2::signal<void (Property)> Changed;
1052 /** Emitted if read() failed on an existing Config file. There is nothing
1053 a listener can do about it: this is just for information.
1055 static boost::signals2::signal<void ()> FailedToLoad;
1056 /** Emitted if read() issued a warning which the user might want to know about */
1057 static boost::signals2::signal<void (std::string)> Warning;
1058 /** Emitted if there is a something wrong the contents of our config. Handler can call
1059 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1062 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1063 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1064 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1067 static boost::signals2::signal<bool (BadReason)> Bad;
1069 void write () const;
1070 void write_config () const;
1071 void write_cinemas () const;
1072 void write_dkdm_recipients () const;
1073 void link (boost::filesystem::path new_file) const;
1074 void copy_and_link (boost::filesystem::path new_file) const;
1075 bool have_write_permission () const;
1077 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1078 bool existing_template (std::string name) const;
1079 std::list<std::string> templates () const;
1080 boost::filesystem::path template_read_path (std::string name) const;
1081 boost::filesystem::path template_write_path (std::string name) const;
1082 void rename_template (std::string old_name, std::string new_name) const;
1083 void delete_template (std::string name) const;
1085 static Config* instance ();
1086 static void drop ();
1087 static void restore_defaults ();
1088 static bool have_existing (std::string);
1089 static boost::filesystem::path config_read_file ();
1090 static boost::filesystem::path config_write_file ();
1095 void set_defaults ();
1096 void set_kdm_email_to_default ();
1097 void set_notification_email_to_default ();
1098 void set_cover_sheet_to_default ();
1099 void read_cinemas (cxml::Document const & f);
1100 void read_dkdm_recipients (cxml::Document const & f);
1101 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1102 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1103 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1104 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1108 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1109 if (member == new_value) {
1117 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1118 if (member && member.get() == new_value) {
1125 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1126 int _master_encoding_threads;
1127 /** number of threads which a server should use for J2K encoding on the local machine */
1128 int _server_encoding_threads;
1129 /** default directory to put new films in */
1130 boost::optional<boost::filesystem::path> _default_directory;
1131 /** base port number to use for J2K encoding servers;
1132 * this port and the two above it will be used.
1134 int _server_port_base;
1135 /** true to broadcast on the `any' address to look for servers */
1136 bool _use_any_servers;
1137 /** J2K encoding servers that should definitely be used */
1138 std::vector<std::string> _servers;
1139 bool _only_servers_encode;
1140 FileTransferProtocol _tms_protocol;
1141 /** The IP address of a TMS that we can copy DCPs to */
1142 std::string _tms_ip;
1143 /** The path on a TMS that we should write DCPs to */
1144 std::string _tms_path;
1145 /** User name to log into the TMS with */
1146 std::string _tms_user;
1147 /** Password to log into the TMS with */
1148 std::string _tms_password;
1149 /** The list of possible DCP frame rates that DCP-o-matic will use */
1150 std::list<int> _allowed_dcp_frame_rates;
1151 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1152 bool _allow_any_dcp_frame_rate;
1153 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1154 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1155 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1157 bool _allow_any_container;
1158 /** Offer the upmixers in the audio processor settings */
1159 bool _show_experimental_audio_processors;
1160 boost::optional<std::string> _language;
1161 /** Default length of still image content (seconds) */
1162 int _default_still_length;
1163 Ratio const * _default_container;
1164 DCPContentType const * _default_dcp_content_type;
1165 int _default_dcp_audio_channels;
1166 std::string _dcp_issuer;
1167 std::string _dcp_creator;
1168 std::string _dcp_company_name;
1169 std::string _dcp_product_name;
1170 std::string _dcp_product_version;
1171 std::string _dcp_j2k_comment;
1172 int _default_j2k_bandwidth;
1173 int _default_audio_delay;
1174 bool _default_interop;
1175 std::map<std::string, std::string> _default_metadata;
1176 /** Default directory to offer to write KDMs to; if it's not set,
1177 the home directory will be offered.
1179 boost::optional<boost::filesystem::path> _default_kdm_directory;
1180 bool _upload_after_make_dcp;
1181 std::list<std::shared_ptr<Cinema> > _cinemas;
1182 std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1183 std::string _mail_server;
1185 EmailProtocol _mail_protocol;
1186 std::string _mail_user;
1187 std::string _mail_password;
1188 std::string _kdm_subject;
1189 std::string _kdm_from;
1190 std::vector<std::string> _kdm_cc;
1191 std::string _kdm_bcc;
1192 std::string _kdm_email;
1193 std::string _notification_subject;
1194 std::string _notification_from;
1195 std::string _notification_to;
1196 std::vector<std::string> _notification_cc;
1197 std::string _notification_bcc;
1198 std::string _notification_email;
1199 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1200 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1201 * certificate for making KDMs given to DCP-o-matic.
1203 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1204 /** true to check for updates on startup */
1205 bool _check_for_updates;
1206 bool _check_for_test_updates;
1207 /** maximum allowed J2K bandwidth in bits per second */
1208 int _maximum_j2k_bandwidth;
1210 bool _analyse_ebur128;
1211 bool _automatic_audio_analysis;
1212 #ifdef DCPOMATIC_WINDOWS
1213 bool _win32_console;
1215 std::vector<boost::filesystem::path> _history;
1216 std::vector<boost::filesystem::path> _player_history;
1217 std::shared_ptr<DKDMGroup> _dkdms;
1218 boost::filesystem::path _cinemas_file;
1219 boost::filesystem::path _dkdm_recipients_file;
1220 bool _show_hints_before_make_dcp;
1221 bool _confirm_kdm_email;
1222 dcp::NameFormat _kdm_filename_format;
1223 dcp::NameFormat _dkdm_filename_format;
1224 dcp::NameFormat _kdm_container_name_format;
1225 dcp::NameFormat _dcp_metadata_filename_format;
1226 dcp::NameFormat _dcp_asset_filename_format;
1227 bool _jump_to_selected;
1228 bool _nagged[NAG_COUNT];
1230 /** name of a specific sound output stream to use, or empty to use the default */
1231 boost::optional<std::string> _sound_output;
1232 std::string _cover_sheet;
1233 boost::optional<boost::filesystem::path> _last_player_load_directory;
1234 boost::optional<KDMWriteType> _last_kdm_write_type;
1235 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1236 int _frames_in_memory_multiplier;
1237 boost::optional<int> _decode_reduction;
1238 bool _default_notify;
1239 bool _notification[NOTIFICATION_COUNT];
1240 boost::optional<std::string> _barco_username;
1241 boost::optional<std::string> _barco_password;
1242 boost::optional<std::string> _christie_username;
1243 boost::optional<std::string> _christie_password;
1244 boost::optional<std::string> _gdc_username;
1245 boost::optional<std::string> _gdc_password;
1246 PlayerMode _player_mode;
1248 VideoViewType _video_view_type;
1249 bool _respect_kdm_validity_periods;
1250 /** Log file containing debug information for the player */
1251 boost::optional<boost::filesystem::path> _player_debug_log_file;
1252 /** A directory containing DCPs whose contents are presented to the user
1253 in the dual-screen player mode. DCPs on the list can be loaded
1256 boost::optional<boost::filesystem::path> _player_content_directory;
1257 boost::optional<boost::filesystem::path> _player_playlist_directory;
1258 boost::optional<boost::filesystem::path> _player_kdm_directory;
1259 boost::optional<AudioMapping> _audio_mapping;
1260 std::vector<dcp::LanguageTag> _custom_languages;
1261 boost::optional<boost::filesystem::path> _add_files_path;
1263 static int const _current_version;
1265 /** Singleton instance, or 0 */
1266 static Config* _instance;