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 extern void save_all_config_as_zip (boost::filesystem::path zip_file);
52 * @brief A singleton class holding configuration.
54 class Config : public State
57 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
58 int master_encoding_threads () const {
59 return _master_encoding_threads;
62 /** @return number of threads which a server should use for J2K encoding on the local machine */
63 int server_encoding_threads () const {
64 return _server_encoding_threads;
67 boost::optional<boost::filesystem::path> default_directory () const {
68 return _default_directory;
71 boost::optional<boost::filesystem::path> default_kdm_directory () const {
72 return _default_kdm_directory;
75 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
76 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
85 PLAYER_CONTENT_DIRECTORY,
86 PLAYER_PLAYLIST_DIRECTORY,
89 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
94 /** @return base port number to use for J2K encoding servers */
95 int server_port_base () const {
96 return _server_port_base;
99 void set_use_any_servers (bool u) {
100 _use_any_servers = u;
101 changed (USE_ANY_SERVERS);
104 bool use_any_servers () const {
105 return _use_any_servers;
108 /** @param s New list of servers */
109 void set_servers (std::vector<std::string> s) {
114 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
115 std::vector<std::string> servers () const {
119 bool only_servers_encode () const {
120 return _only_servers_encode;
123 FileTransferProtocol tms_protocol () const {
124 return _tms_protocol;
127 /** @return The IP address of a TMS that we can copy DCPs to */
128 std::string tms_ip () const {
132 /** @return The path on a TMS that we should changed DCPs to */
133 std::string tms_path () const {
137 /** @return User name to log into the TMS with */
138 std::string tms_user () const {
142 /** @return Password to log into the TMS with */
143 std::string tms_password () const {
144 return _tms_password;
147 std::list<std::shared_ptr<Cinema> > cinemas () const {
151 std::list<std::shared_ptr<DKDMRecipient> > dkdm_recipients () const {
152 return _dkdm_recipients;
155 std::list<int> allowed_dcp_frame_rates () const {
156 return _allowed_dcp_frame_rates;
159 bool allow_any_dcp_frame_rate () const {
160 return _allow_any_dcp_frame_rate;
163 bool allow_any_container () const {
164 return _allow_any_container;
167 bool show_experimental_audio_processors () const {
168 return _show_experimental_audio_processors;
171 boost::optional<std::string> language () const {
175 int default_still_length () const {
176 return _default_still_length;
179 Ratio const * default_container () const {
180 return _default_container;
183 DCPContentType const * default_dcp_content_type () const {
184 return _default_dcp_content_type;
187 int default_dcp_audio_channels () const {
188 return _default_dcp_audio_channels;
191 std::string dcp_issuer () const {
195 std::string dcp_creator () const {
199 std::string dcp_company_name () const {
200 return _dcp_company_name;
203 std::string dcp_product_name () const {
204 return _dcp_product_name;
207 std::string dcp_product_version () const {
208 return _dcp_product_version;
211 std::string dcp_j2k_comment () const {
212 return _dcp_j2k_comment;
215 int default_j2k_bandwidth () const {
216 return _default_j2k_bandwidth;
219 int default_audio_delay () const {
220 return _default_audio_delay;
223 bool default_interop () const {
224 return _default_interop;
227 std::map<std::string, std::string> default_metadata () const {
228 return _default_metadata;
231 bool upload_after_make_dcp () {
232 return _upload_after_make_dcp;
235 void set_default_kdm_directory (boost::filesystem::path d) {
236 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
239 _default_kdm_directory = d;
243 std::string mail_server () const {
247 int mail_port () const {
251 EmailProtocol mail_protocol () const {
252 return _mail_protocol;
255 std::string mail_user () const {
259 std::string mail_password () const {
260 return _mail_password;
263 std::string kdm_subject () const {
267 std::string kdm_from () const {
271 std::vector<std::string> kdm_cc () const {
275 std::string kdm_bcc () const {
279 std::string kdm_email () const {
283 std::string notification_subject () const {
284 return _notification_subject;
287 std::string notification_from () const {
288 return _notification_from;
291 std::string notification_to () const {
292 return _notification_to;
295 std::vector<std::string> notification_cc () const {
296 return _notification_cc;
299 std::string notification_bcc () const {
300 return _notification_bcc;
303 std::string notification_email () const {
304 return _notification_email;
307 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
308 return _signer_chain;
311 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
312 return _decryption_chain;
315 bool check_for_updates () const {
316 return _check_for_updates;
319 bool check_for_test_updates () const {
320 return _check_for_test_updates;
323 int maximum_j2k_bandwidth () const {
324 return _maximum_j2k_bandwidth;
327 int log_types () const {
331 bool analyse_ebur128 () const {
332 return _analyse_ebur128;
335 bool automatic_audio_analysis () const {
336 return _automatic_audio_analysis;
339 #ifdef DCPOMATIC_WINDOWS
340 bool win32_console () const {
341 return _win32_console;
345 std::vector<boost::filesystem::path> history () const {
349 std::vector<boost::filesystem::path> player_history () const {
350 return _player_history;
353 std::shared_ptr<DKDMGroup> dkdms () const {
357 boost::filesystem::path cinemas_file () const {
358 return _cinemas_file;
361 boost::filesystem::path dkdm_recipients_file () const {
362 return _dkdm_recipients_file;
365 bool show_hints_before_make_dcp () const {
366 return _show_hints_before_make_dcp;
369 bool confirm_kdm_email () const {
370 return _confirm_kdm_email;
373 dcp::NameFormat kdm_container_name_format () const {
374 return _kdm_container_name_format;
377 dcp::NameFormat kdm_filename_format () const {
378 return _kdm_filename_format;
381 dcp::NameFormat dkdm_filename_format () const {
382 return _dkdm_filename_format;
385 dcp::NameFormat dcp_metadata_filename_format () const {
386 return _dcp_metadata_filename_format;
389 dcp::NameFormat dcp_asset_filename_format () const {
390 return _dcp_asset_filename_format;
393 bool jump_to_selected () const {
394 return _jump_to_selected;
397 /* This could be an enum class but we use the enum a lot to index _nagged
398 * so it means a lot of casts.
402 NAG_ENCRYPTED_METADATA,
403 NAG_ALTER_DECRYPTION_CHAIN,
404 NAG_BAD_SIGNER_CHAIN_UTF8,
405 NAG_IMPORT_DECRYPTION_CHAIN,
408 NAG_TOO_MANY_DROPPED_FRAMES,
409 NAG_BAD_SIGNER_CHAIN_VALIDITY,
413 bool nagged (Nag nag) const {
417 bool sound () const {
421 std::string cover_sheet () const {
425 boost::optional<std::string> sound_output () const {
426 return _sound_output;
429 boost::optional<boost::filesystem::path> last_player_load_directory () const {
430 return _last_player_load_directory;
439 boost::optional<KDMWriteType> last_kdm_write_type () const {
440 return _last_kdm_write_type;
448 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
449 return _last_dkdm_write_type;
452 int frames_in_memory_multiplier () const {
453 return _frames_in_memory_multiplier;
456 boost::optional<int> decode_reduction () const {
457 return _decode_reduction;
460 bool default_notify () const {
461 return _default_notify;
470 bool notification (Notification n) const {
471 return _notification[n];
474 boost::optional<std::string> barco_username () const {
475 return _barco_username;
478 boost::optional<std::string> barco_password () const {
479 return _barco_password;
482 boost::optional<std::string> christie_username () const {
483 return _christie_username;
486 boost::optional<std::string> christie_password () const {
487 return _christie_password;
490 boost::optional<std::string> gdc_username () const {
491 return _gdc_username;
494 boost::optional<std::string> gdc_password () const {
495 return _gdc_password;
499 PLAYER_MODE_WINDOW, ///< one window containing image and controls
500 PLAYER_MODE_FULL, ///< just the image filling the screen
501 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
504 PlayerMode player_mode () const {
508 int image_display () const {
509 return _image_display;
517 VideoViewType video_view_type () const {
518 return _video_view_type;
521 bool respect_kdm_validity_periods () const {
522 return _respect_kdm_validity_periods;
525 boost::optional<boost::filesystem::path> player_debug_log_file () const {
526 return _player_debug_log_file;
529 boost::optional<boost::filesystem::path> player_content_directory () const {
530 return _player_content_directory;
533 boost::optional<boost::filesystem::path> player_playlist_directory () const {
534 return _player_playlist_directory;
537 boost::optional<boost::filesystem::path> player_kdm_directory () const {
538 return _player_kdm_directory;
541 AudioMapping audio_mapping (int output_channels);
543 std::vector<dcp::LanguageTag> custom_languages () const {
544 return _custom_languages;
547 boost::optional<boost::filesystem::path> add_files_path () const {
548 return _add_files_path;
553 void set_master_encoding_threads (int n) {
554 maybe_set (_master_encoding_threads, n);
557 void set_server_encoding_threads (int n) {
558 maybe_set (_server_encoding_threads, n);
561 void set_default_directory (boost::filesystem::path d) {
562 if (_default_directory && *_default_directory == d) {
565 _default_directory = d;
569 /** @param p New server port */
570 void set_server_port_base (int p) {
571 maybe_set (_server_port_base, p);
574 void set_only_servers_encode (bool o) {
575 maybe_set (_only_servers_encode, o);
578 void set_tms_protocol (FileTransferProtocol p) {
579 maybe_set (_tms_protocol, p);
582 /** @param i IP address of a TMS that we can copy DCPs to */
583 void set_tms_ip (std::string i) {
584 maybe_set (_tms_ip, i);
587 /** @param p Path on a TMS that we should changed DCPs to */
588 void set_tms_path (std::string p) {
589 maybe_set (_tms_path, p);
592 /** @param u User name to log into the TMS with */
593 void set_tms_user (std::string u) {
594 maybe_set (_tms_user, u);
597 /** @param p Password to log into the TMS with */
598 void set_tms_password (std::string p) {
599 maybe_set (_tms_password, p);
602 void add_cinema (std::shared_ptr<Cinema> c) {
603 _cinemas.push_back (c);
607 void remove_cinema (std::shared_ptr<Cinema> c) {
612 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
613 _dkdm_recipients.push_back (c);
614 changed (DKDM_RECIPIENTS);
617 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
618 _dkdm_recipients.remove (c);
619 changed (DKDM_RECIPIENTS);
622 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
623 maybe_set (_allowed_dcp_frame_rates, r);
626 void set_allow_any_dcp_frame_rate (bool a) {
627 maybe_set (_allow_any_dcp_frame_rate, a);
630 void set_allow_any_container (bool a) {
631 maybe_set (_allow_any_container, a);
634 void set_show_experimental_audio_processors (bool e) {
635 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
638 void set_language (std::string l) {
639 if (_language && _language.get() == l) {
646 void unset_language () {
651 _language = boost::none;
655 void set_default_still_length (int s) {
656 maybe_set (_default_still_length, s);
659 void set_default_container (Ratio const * c) {
660 maybe_set (_default_container, c);
663 void set_default_dcp_content_type (DCPContentType const * t) {
664 maybe_set (_default_dcp_content_type, t);
667 void set_default_dcp_audio_channels (int c) {
668 maybe_set (_default_dcp_audio_channels, c);
671 void set_dcp_issuer (std::string i) {
672 maybe_set (_dcp_issuer, i);
675 void set_dcp_creator (std::string c) {
676 maybe_set (_dcp_creator, c);
679 void set_dcp_company_name (std::string c) {
680 maybe_set (_dcp_company_name, c);
683 void set_dcp_product_name (std::string c) {
684 maybe_set (_dcp_product_name, c);
687 void set_dcp_product_version (std::string c) {
688 maybe_set (_dcp_product_version, c);
691 void set_dcp_j2k_comment (std::string c) {
692 maybe_set (_dcp_j2k_comment, c);
695 void set_default_j2k_bandwidth (int b) {
696 maybe_set (_default_j2k_bandwidth, b);
699 void set_default_audio_delay (int d) {
700 maybe_set (_default_audio_delay, d);
703 void set_default_interop (bool i) {
704 maybe_set (_default_interop, i);
707 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
708 maybe_set (_default_metadata, metadata);
711 void set_upload_after_make_dcp (bool u) {
712 maybe_set (_upload_after_make_dcp, u);
715 void set_mail_server (std::string s) {
716 maybe_set (_mail_server, s);
719 void set_mail_port (int p) {
720 maybe_set (_mail_port, p);
723 void set_mail_protocol (EmailProtocol p) {
724 maybe_set (_mail_protocol, p);
727 void set_mail_user (std::string u) {
728 maybe_set (_mail_user, u);
731 void set_mail_password (std::string p) {
732 maybe_set (_mail_password, p);
735 void set_kdm_subject (std::string s) {
736 maybe_set (_kdm_subject, s);
739 void set_kdm_from (std::string f) {
740 maybe_set (_kdm_from, f);
743 void set_kdm_cc (std::vector<std::string> f) {
744 maybe_set (_kdm_cc, f);
747 void set_kdm_bcc (std::string f) {
748 maybe_set (_kdm_bcc, f);
751 void set_kdm_email (std::string e) {
752 maybe_set (_kdm_email, e);
755 void reset_kdm_email ();
757 void set_notification_subject (std::string s) {
758 maybe_set (_notification_subject, s);
761 void set_notification_from (std::string f) {
762 maybe_set (_notification_from, f);
765 void set_notification_to (std::string t) {
766 maybe_set (_notification_to, t);
769 void set_notification_cc (std::vector<std::string> f) {
770 maybe_set (_notification_cc, f);
773 void set_notification_bcc (std::string f) {
774 maybe_set (_notification_bcc, f);
777 void set_notification_email (std::string e) {
778 maybe_set (_notification_email, e);
781 void reset_notification_email ();
783 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
784 maybe_set (_signer_chain, s);
787 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
788 maybe_set (_decryption_chain, c);
791 void set_check_for_updates (bool c) {
792 maybe_set (_check_for_updates, c);
794 set_check_for_test_updates (false);
798 void set_check_for_test_updates (bool c) {
799 maybe_set (_check_for_test_updates, c);
802 void set_maximum_j2k_bandwidth (int b) {
803 maybe_set (_maximum_j2k_bandwidth, b);
806 void set_log_types (int t) {
807 maybe_set (_log_types, t);
810 void set_analyse_ebur128 (bool a) {
811 maybe_set (_analyse_ebur128, a);
814 void set_automatic_audio_analysis (bool a) {
815 maybe_set (_automatic_audio_analysis, a);
818 #ifdef DCPOMATIC_WINDOWS
819 void set_win32_console (bool c) {
820 maybe_set (_win32_console, c);
824 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
829 void set_cinemas_file (boost::filesystem::path file);
831 void set_show_hints_before_make_dcp (bool s) {
832 maybe_set (_show_hints_before_make_dcp, s);
835 void set_confirm_kdm_email (bool s) {
836 maybe_set (_confirm_kdm_email, s);
839 void set_sound (bool s) {
840 maybe_set (_sound, s, SOUND);
843 void set_sound_output (std::string o) {
844 maybe_set (_sound_output, o, SOUND_OUTPUT);
847 void set_last_player_load_directory (boost::filesystem::path d) {
848 maybe_set (_last_player_load_directory, d);
851 void set_last_kdm_write_type (KDMWriteType t) {
852 maybe_set (_last_kdm_write_type, t);
855 void set_last_dkdm_write_type (DKDMWriteType t) {
856 maybe_set (_last_dkdm_write_type, t);
859 void unset_sound_output () {
860 if (!_sound_output) {
864 _sound_output = boost::none;
868 void set_kdm_container_name_format (dcp::NameFormat n) {
869 maybe_set (_kdm_container_name_format, n);
872 void set_kdm_filename_format (dcp::NameFormat n) {
873 maybe_set (_kdm_filename_format, n);
876 void set_dkdm_filename_format (dcp::NameFormat n) {
877 maybe_set (_dkdm_filename_format, n);
880 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
881 maybe_set (_dcp_metadata_filename_format, n);
884 void set_dcp_asset_filename_format (dcp::NameFormat n) {
885 maybe_set (_dcp_asset_filename_format, n);
888 void set_frames_in_memory_multiplier (int m) {
889 maybe_set (_frames_in_memory_multiplier, m);
892 void set_decode_reduction (boost::optional<int> r) {
893 maybe_set (_decode_reduction, r);
896 void set_default_notify (bool n) {
897 maybe_set (_default_notify, n);
900 void clear_history () {
905 void clear_player_history () {
906 _player_history.clear ();
910 void add_to_history (boost::filesystem::path p);
911 void clean_history ();
912 void add_to_player_history (boost::filesystem::path p);
913 void clean_player_history ();
915 void set_jump_to_selected (bool j) {
916 maybe_set (_jump_to_selected, j);
919 void set_nagged (Nag nag, bool nagged) {
920 maybe_set (_nagged[nag], nagged);
923 void set_cover_sheet (std::string s) {
924 maybe_set (_cover_sheet, s);
927 void reset_cover_sheet ();
929 void set_notification (Notification n, bool v) {
930 maybe_set (_notification[n], v);
933 void set_barco_username (std::string u) {
934 maybe_set (_barco_username, u);
937 void unset_barco_username () {
938 maybe_set (_barco_username, boost::optional<std::string>());
941 void set_barco_password (std::string p) {
942 maybe_set (_barco_password, p);
945 void unset_barco_password () {
946 maybe_set (_barco_password, boost::optional<std::string>());
949 void set_christie_username (std::string u) {
950 maybe_set (_christie_username, u);
953 void unset_christie_username () {
954 maybe_set (_christie_username, boost::optional<std::string>());
957 void set_christie_password (std::string p) {
958 maybe_set (_christie_password, p);
961 void unset_christie_password () {
962 maybe_set (_christie_password, boost::optional<std::string>());
965 void set_gdc_username (std::string u) {
966 maybe_set (_gdc_username, u);
969 void unset_gdc_username () {
970 maybe_set (_gdc_username, boost::optional<std::string>());
973 void set_gdc_password (std::string p) {
974 maybe_set (_gdc_password, p);
977 void unset_gdc_password () {
978 maybe_set (_gdc_password, boost::optional<std::string>());
981 void set_player_mode (PlayerMode m) {
982 maybe_set (_player_mode, m);
985 void set_image_display (int n) {
986 maybe_set (_image_display, n);
989 void set_video_view_type (VideoViewType v) {
990 maybe_set (_video_view_type, v);
993 void set_respect_kdm_validity_periods (bool r) {
994 maybe_set (_respect_kdm_validity_periods, r);
997 void set_player_debug_log_file (boost::filesystem::path p) {
998 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1001 void unset_player_debug_log_file () {
1002 if (!_player_debug_log_file) {
1005 _player_debug_log_file = boost::none;
1006 changed (PLAYER_DEBUG_LOG);
1009 void set_player_content_directory (boost::filesystem::path p) {
1010 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1013 void unset_player_content_directory () {
1014 if (!_player_content_directory) {
1017 _player_content_directory = boost::none;
1018 changed (PLAYER_CONTENT_DIRECTORY);
1021 void set_player_playlist_directory (boost::filesystem::path p) {
1022 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1025 void unset_player_playlist_directory () {
1026 if (!_player_playlist_directory) {
1029 _player_playlist_directory = boost::none;
1030 changed (PLAYER_PLAYLIST_DIRECTORY);
1033 void set_player_kdm_directory (boost::filesystem::path p) {
1034 maybe_set (_player_kdm_directory, p);
1037 void unset_player_kdm_directory () {
1038 if (!_player_kdm_directory) {
1041 _player_kdm_directory = boost::none;
1045 void set_audio_mapping (AudioMapping m);
1046 void set_audio_mapping_to_default ();
1048 void add_custom_language (dcp::LanguageTag tag);
1050 void set_add_files_path (boost::filesystem::path p) {
1051 _add_files_path = p;
1055 void changed (Property p = OTHER);
1056 boost::signals2::signal<void (Property)> Changed;
1057 /** Emitted if read() failed on an existing Config file. There is nothing
1058 a listener can do about it: this is just for information.
1060 static boost::signals2::signal<void ()> FailedToLoad;
1061 /** Emitted if read() issued a warning which the user might want to know about */
1062 static boost::signals2::signal<void (std::string)> Warning;
1063 /** Emitted if there is a something wrong the contents of our config. Handler can call
1064 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1067 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1068 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1069 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1070 BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
1073 static boost::signals2::signal<bool (BadReason)> Bad;
1075 void write () const;
1076 void write_config () const;
1077 void write_cinemas () const;
1078 void write_dkdm_recipients () const;
1079 void link (boost::filesystem::path new_file) const;
1080 void copy_and_link (boost::filesystem::path new_file) const;
1081 bool have_write_permission () const;
1083 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1084 bool existing_template (std::string name) const;
1085 std::list<std::string> templates () const;
1086 boost::filesystem::path template_read_path (std::string name) const;
1087 boost::filesystem::path template_write_path (std::string name) const;
1088 void rename_template (std::string old_name, std::string new_name) const;
1089 void delete_template (std::string name) const;
1091 boost::optional<BadReason> check_certificates () const;
1093 static Config* instance ();
1094 static void drop ();
1095 static void restore_defaults ();
1096 static bool have_existing (std::string);
1097 static boost::filesystem::path config_read_file ();
1098 static boost::filesystem::path config_write_file ();
1103 void set_defaults ();
1104 void set_kdm_email_to_default ();
1105 void set_notification_email_to_default ();
1106 void set_cover_sheet_to_default ();
1107 void read_cinemas (cxml::Document const & f);
1108 void read_dkdm_recipients (cxml::Document const & f);
1109 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1110 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1111 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1112 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1116 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1117 if (member == new_value) {
1125 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1126 if (member && member.get() == new_value) {
1133 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1134 int _master_encoding_threads;
1135 /** number of threads which a server should use for J2K encoding on the local machine */
1136 int _server_encoding_threads;
1137 /** default directory to put new films in */
1138 boost::optional<boost::filesystem::path> _default_directory;
1139 /** base port number to use for J2K encoding servers;
1140 * this port and the two above it will be used.
1142 int _server_port_base;
1143 /** true to broadcast on the `any' address to look for servers */
1144 bool _use_any_servers;
1145 /** J2K encoding servers that should definitely be used */
1146 std::vector<std::string> _servers;
1147 bool _only_servers_encode;
1148 FileTransferProtocol _tms_protocol;
1149 /** The IP address of a TMS that we can copy DCPs to */
1150 std::string _tms_ip;
1151 /** The path on a TMS that we should write DCPs to */
1152 std::string _tms_path;
1153 /** User name to log into the TMS with */
1154 std::string _tms_user;
1155 /** Password to log into the TMS with */
1156 std::string _tms_password;
1157 /** The list of possible DCP frame rates that DCP-o-matic will use */
1158 std::list<int> _allowed_dcp_frame_rates;
1159 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1160 bool _allow_any_dcp_frame_rate;
1161 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1162 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1163 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1165 bool _allow_any_container;
1166 /** Offer the upmixers in the audio processor settings */
1167 bool _show_experimental_audio_processors;
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 std::map<std::string, std::string> _default_metadata;
1184 /** Default directory to offer to write KDMs to; if it's not set,
1185 the home directory will be offered.
1187 boost::optional<boost::filesystem::path> _default_kdm_directory;
1188 bool _upload_after_make_dcp;
1189 std::list<std::shared_ptr<Cinema> > _cinemas;
1190 std::list<std::shared_ptr<DKDMRecipient> > _dkdm_recipients;
1191 std::string _mail_server;
1193 EmailProtocol _mail_protocol;
1194 std::string _mail_user;
1195 std::string _mail_password;
1196 std::string _kdm_subject;
1197 std::string _kdm_from;
1198 std::vector<std::string> _kdm_cc;
1199 std::string _kdm_bcc;
1200 std::string _kdm_email;
1201 std::string _notification_subject;
1202 std::string _notification_from;
1203 std::string _notification_to;
1204 std::vector<std::string> _notification_cc;
1205 std::string _notification_bcc;
1206 std::string _notification_email;
1207 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1208 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1209 * certificate for making KDMs given to DCP-o-matic.
1211 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1212 /** true to check for updates on startup */
1213 bool _check_for_updates;
1214 bool _check_for_test_updates;
1215 /** maximum allowed J2K bandwidth in bits per second */
1216 int _maximum_j2k_bandwidth;
1218 bool _analyse_ebur128;
1219 bool _automatic_audio_analysis;
1220 #ifdef DCPOMATIC_WINDOWS
1221 bool _win32_console;
1223 std::vector<boost::filesystem::path> _history;
1224 std::vector<boost::filesystem::path> _player_history;
1225 std::shared_ptr<DKDMGroup> _dkdms;
1226 boost::filesystem::path _cinemas_file;
1227 boost::filesystem::path _dkdm_recipients_file;
1228 bool _show_hints_before_make_dcp;
1229 bool _confirm_kdm_email;
1230 dcp::NameFormat _kdm_filename_format;
1231 dcp::NameFormat _dkdm_filename_format;
1232 dcp::NameFormat _kdm_container_name_format;
1233 dcp::NameFormat _dcp_metadata_filename_format;
1234 dcp::NameFormat _dcp_asset_filename_format;
1235 bool _jump_to_selected;
1236 bool _nagged[NAG_COUNT];
1238 /** name of a specific sound output stream to use, or empty to use the default */
1239 boost::optional<std::string> _sound_output;
1240 std::string _cover_sheet;
1241 boost::optional<boost::filesystem::path> _last_player_load_directory;
1242 boost::optional<KDMWriteType> _last_kdm_write_type;
1243 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1244 int _frames_in_memory_multiplier;
1245 boost::optional<int> _decode_reduction;
1246 bool _default_notify;
1247 bool _notification[NOTIFICATION_COUNT];
1248 boost::optional<std::string> _barco_username;
1249 boost::optional<std::string> _barco_password;
1250 boost::optional<std::string> _christie_username;
1251 boost::optional<std::string> _christie_password;
1252 boost::optional<std::string> _gdc_username;
1253 boost::optional<std::string> _gdc_password;
1254 PlayerMode _player_mode;
1256 VideoViewType _video_view_type;
1257 bool _respect_kdm_validity_periods;
1258 /** Log file containing debug information for the player */
1259 boost::optional<boost::filesystem::path> _player_debug_log_file;
1260 /** A directory containing DCPs whose contents are presented to the user
1261 in the dual-screen player mode. DCPs on the list can be loaded
1264 boost::optional<boost::filesystem::path> _player_content_directory;
1265 boost::optional<boost::filesystem::path> _player_playlist_directory;
1266 boost::optional<boost::filesystem::path> _player_kdm_directory;
1267 boost::optional<AudioMapping> _audio_mapping;
1268 std::vector<dcp::LanguageTag> _custom_languages;
1269 boost::optional<boost::filesystem::path> _add_files_path;
1271 static int const _current_version;
1273 /** Singleton instance, or 0 */
1274 static Config* _instance;