2 Copyright (C) 2012-2022 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 /** @file src/config.h
22 * @brief Class holding configuration.
26 #ifndef DCPOMATIC_CONFIG_H
27 #define DCPOMATIC_CONFIG_H
30 #include "audio_mapping.h"
31 #include "export_config.h"
32 #include "rough_duration.h"
34 #include <dcp/name_format.h>
35 #include <dcp/certificate_chain.h>
36 #include <dcp/encrypted_kdm.h>
37 #include <dcp/language_tag.h>
38 #include <boost/signals2.hpp>
39 #include <boost/filesystem.hpp>
44 class CinemaSoundProcessor;
52 extern void save_all_config_as_zip (boost::filesystem::path zip_file);
56 * @brief A singleton class holding configuration.
58 class Config : public State
61 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
62 int master_encoding_threads () const {
63 return _master_encoding_threads;
66 /** @return number of threads which a server should use for J2K encoding on the local machine */
67 int server_encoding_threads () const {
68 return _server_encoding_threads;
71 boost::optional<boost::filesystem::path> default_directory () const {
72 return _default_directory;
75 boost::optional<boost::filesystem::path> default_kdm_directory () const {
76 return _default_kdm_directory;
79 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
80 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
89 PLAYER_CONTENT_DIRECTORY,
90 PLAYER_PLAYLIST_DIRECTORY,
93 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
99 /** @return base port number to use for J2K encoding servers */
100 int server_port_base () const {
101 return _server_port_base;
104 void set_use_any_servers (bool u) {
105 _use_any_servers = u;
106 changed (USE_ANY_SERVERS);
109 bool use_any_servers () const {
110 return _use_any_servers;
113 /** @param s New list of servers */
114 void set_servers (std::vector<std::string> s) {
119 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
120 std::vector<std::string> servers () const {
124 bool only_servers_encode () const {
125 return _only_servers_encode;
128 FileTransferProtocol tms_protocol () const {
129 return _tms_protocol;
132 bool tms_passive() const {
136 /** @return The IP address of a TMS that we can copy DCPs to */
137 std::string tms_ip () const {
141 /** @return The path on a TMS that we should changed DCPs to */
142 std::string tms_path () const {
146 /** @return User name to log into the TMS with */
147 std::string tms_user () const {
151 /** @return Password to log into the TMS with */
152 std::string tms_password () const {
153 return _tms_password;
156 std::list<std::shared_ptr<Cinema>> cinemas () const {
160 std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
161 return _dkdm_recipients;
164 std::list<int> allowed_dcp_frame_rates () const {
165 return _allowed_dcp_frame_rates;
168 bool allow_any_dcp_frame_rate () const {
169 return _allow_any_dcp_frame_rate;
172 bool allow_any_container () const {
173 return _allow_any_container;
176 bool allow_96khz_audio () const {
177 return _allow_96khz_audio;
180 bool use_all_audio_channels () const {
181 return _use_all_audio_channels;
184 bool show_experimental_audio_processors () const {
185 return _show_experimental_audio_processors;
188 boost::optional<std::string> language () const {
192 int default_still_length () const {
193 return _default_still_length;
196 DCPContentType const * default_dcp_content_type () const {
197 return _default_dcp_content_type;
200 int default_dcp_audio_channels () const {
201 return _default_dcp_audio_channels;
204 std::string dcp_issuer () const {
208 std::string dcp_creator () const {
212 std::string dcp_company_name () const {
213 return _dcp_company_name;
216 std::string dcp_product_name () const {
217 return _dcp_product_name;
220 std::string dcp_product_version () const {
221 return _dcp_product_version;
224 std::string dcp_j2k_comment () const {
225 return _dcp_j2k_comment;
228 int default_j2k_bandwidth () const {
229 return _default_j2k_bandwidth;
232 int default_audio_delay () const {
233 return _default_audio_delay;
236 bool default_interop () const {
237 return _default_interop;
240 boost::optional<dcp::LanguageTag> default_audio_language() const {
241 return _default_audio_language;
244 boost::optional<dcp::LanguageTag::RegionSubtag> default_territory() const {
245 return _default_territory;
248 std::map<std::string, std::string> default_metadata () const {
249 return _default_metadata;
252 bool upload_after_make_dcp () {
253 return _upload_after_make_dcp;
256 void set_default_kdm_directory (boost::filesystem::path d) {
257 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
260 _default_kdm_directory = d;
264 std::string mail_server () const {
268 int mail_port () const {
272 EmailProtocol mail_protocol () const {
273 return _mail_protocol;
276 std::string mail_user () const {
280 std::string mail_password () const {
281 return _mail_password;
284 std::string kdm_subject () const {
288 std::string kdm_from () const {
292 std::vector<std::string> kdm_cc () const {
296 std::string kdm_bcc () const {
300 std::string kdm_email () const {
304 std::string notification_subject () const {
305 return _notification_subject;
308 std::string notification_from () const {
309 return _notification_from;
312 std::string notification_to () const {
313 return _notification_to;
316 std::vector<std::string> notification_cc () const {
317 return _notification_cc;
320 std::string notification_bcc () const {
321 return _notification_bcc;
324 std::string notification_email () const {
325 return _notification_email;
328 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
329 return _signer_chain;
332 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
333 return _decryption_chain;
336 bool check_for_updates () const {
337 return _check_for_updates;
340 bool check_for_test_updates () const {
341 return _check_for_test_updates;
344 int maximum_j2k_bandwidth () const {
345 return _maximum_j2k_bandwidth;
348 int log_types () const {
352 bool analyse_ebur128 () const {
353 return _analyse_ebur128;
356 bool automatic_audio_analysis () const {
357 return _automatic_audio_analysis;
360 #ifdef DCPOMATIC_WINDOWS
361 bool win32_console () const {
362 return _win32_console;
366 std::vector<boost::filesystem::path> history () const {
370 std::vector<boost::filesystem::path> player_history () const {
371 return _player_history;
374 std::shared_ptr<DKDMGroup> dkdms () const {
378 boost::filesystem::path cinemas_file () const {
379 return _cinemas_file;
382 boost::filesystem::path dkdm_recipients_file () const {
383 return _dkdm_recipients_file;
386 bool show_hints_before_make_dcp () const {
387 return _show_hints_before_make_dcp;
390 bool confirm_kdm_email () const {
391 return _confirm_kdm_email;
394 dcp::NameFormat kdm_container_name_format () const {
395 return _kdm_container_name_format;
398 dcp::NameFormat kdm_filename_format () const {
399 return _kdm_filename_format;
402 dcp::NameFormat dkdm_filename_format () const {
403 return _dkdm_filename_format;
406 dcp::NameFormat dcp_metadata_filename_format () const {
407 return _dcp_metadata_filename_format;
410 dcp::NameFormat dcp_asset_filename_format () const {
411 return _dcp_asset_filename_format;
414 bool jump_to_selected () const {
415 return _jump_to_selected;
418 /* This could be an enum class but we use the enum a lot to index _nagged
419 * so it means a lot of casts.
423 NAG_ENCRYPTED_METADATA,
424 NAG_ALTER_DECRYPTION_CHAIN,
425 NAG_BAD_SIGNER_CHAIN_UTF8,
426 NAG_IMPORT_DECRYPTION_CHAIN,
429 NAG_TOO_MANY_DROPPED_FRAMES,
430 NAG_BAD_SIGNER_CHAIN_VALIDITY,
434 bool nagged (Nag nag) const {
438 bool sound () const {
442 std::string cover_sheet () const {
446 boost::optional<std::string> sound_output () const {
447 return _sound_output;
450 boost::optional<boost::filesystem::path> last_player_load_directory () const {
451 return _last_player_load_directory;
460 boost::optional<KDMWriteType> last_kdm_write_type () const {
461 return _last_kdm_write_type;
469 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
470 return _last_dkdm_write_type;
473 int frames_in_memory_multiplier () const {
474 return _frames_in_memory_multiplier;
477 boost::optional<int> decode_reduction () const {
478 return _decode_reduction;
481 bool default_notify () const {
482 return _default_notify;
491 bool notification (Notification n) const {
492 return _notification[n];
495 boost::optional<std::string> barco_username () const {
496 return _barco_username;
499 boost::optional<std::string> barco_password () const {
500 return _barco_password;
503 boost::optional<std::string> christie_username () const {
504 return _christie_username;
507 boost::optional<std::string> christie_password () const {
508 return _christie_password;
511 boost::optional<std::string> gdc_username () const {
512 return _gdc_username;
515 boost::optional<std::string> gdc_password () const {
516 return _gdc_password;
520 PLAYER_MODE_WINDOW, ///< one window containing image and controls
521 PLAYER_MODE_FULL, ///< just the image filling the screen
522 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
525 PlayerMode player_mode () const {
529 int image_display () const {
530 return _image_display;
538 VideoViewType video_view_type () const {
539 return _video_view_type;
542 bool respect_kdm_validity_periods () const {
543 return _respect_kdm_validity_periods;
546 boost::optional<boost::filesystem::path> player_debug_log_file () const {
547 return _player_debug_log_file;
550 boost::optional<boost::filesystem::path> player_content_directory () const {
551 return _player_content_directory;
554 boost::optional<boost::filesystem::path> player_playlist_directory () const {
555 return _player_playlist_directory;
558 boost::optional<boost::filesystem::path> player_kdm_directory () const {
559 return _player_kdm_directory;
562 AudioMapping audio_mapping (int output_channels);
564 std::vector<dcp::LanguageTag> custom_languages () const {
565 return _custom_languages;
568 boost::optional<boost::filesystem::path> initial_path(std::string id) const;
570 bool use_isdcf_name_by_default () const {
571 return _use_isdcf_name_by_default;
574 bool write_kdms_to_disk () const {
575 return _write_kdms_to_disk;
578 bool email_kdms () const {
582 dcp::Formulation default_kdm_type () const {
583 return _default_kdm_type;
586 RoughDuration default_kdm_duration () const {
587 return _default_kdm_duration;
590 double auto_crop_threshold () const {
591 return _auto_crop_threshold;
594 boost::optional<std::string> last_release_notes_version () const {
595 return _last_release_notes_version;
598 boost::optional<int> main_divider_sash_position() const {
599 return _main_divider_sash_position;
602 boost::optional<int> main_content_divider_sash_position() const {
603 return _main_content_divider_sash_position;
608 void set_master_encoding_threads (int n) {
609 maybe_set (_master_encoding_threads, n);
612 void set_server_encoding_threads (int n) {
613 maybe_set (_server_encoding_threads, n);
616 void set_default_directory (boost::filesystem::path d) {
617 if (_default_directory && *_default_directory == d) {
620 _default_directory = d;
624 /** @param p New server port */
625 void set_server_port_base (int p) {
626 maybe_set (_server_port_base, p);
629 void set_only_servers_encode (bool o) {
630 maybe_set (_only_servers_encode, o);
633 void set_tms_protocol (FileTransferProtocol p) {
634 maybe_set (_tms_protocol, p);
637 void set_tms_passive(bool passive) {
638 maybe_set(_tms_passive, passive);
641 /** @param i IP address of a TMS that we can copy DCPs to */
642 void set_tms_ip (std::string i) {
643 maybe_set (_tms_ip, i);
646 /** @param p Path on a TMS that we should changed DCPs to */
647 void set_tms_path (std::string p) {
648 maybe_set (_tms_path, p);
651 /** @param u User name to log into the TMS with */
652 void set_tms_user (std::string u) {
653 maybe_set (_tms_user, u);
656 /** @param p Password to log into the TMS with */
657 void set_tms_password (std::string p) {
658 maybe_set (_tms_password, p);
661 void add_cinema (std::shared_ptr<Cinema> c) {
662 _cinemas.push_back (c);
666 void remove_cinema (std::shared_ptr<Cinema> c) {
671 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
672 _dkdm_recipients.push_back (c);
673 changed (DKDM_RECIPIENTS);
676 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
677 _dkdm_recipients.remove (c);
678 changed (DKDM_RECIPIENTS);
681 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
682 maybe_set (_allowed_dcp_frame_rates, r);
685 void set_allow_any_dcp_frame_rate (bool a) {
686 maybe_set (_allow_any_dcp_frame_rate, a);
689 void set_allow_any_container (bool a) {
690 maybe_set (_allow_any_container, a);
693 void set_allow_96hhz_audio (bool a) {
694 maybe_set (_allow_96khz_audio, a);
697 void set_use_all_audio_channels (bool a) {
698 maybe_set (_use_all_audio_channels, a);
701 void set_show_experimental_audio_processors (bool e) {
702 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
705 void set_language (std::string l) {
706 if (_language && _language.get() == l) {
713 void unset_language () {
718 _language = boost::none;
722 void set_default_still_length (int s) {
723 maybe_set (_default_still_length, s);
726 void set_default_dcp_content_type (DCPContentType const * t) {
727 maybe_set (_default_dcp_content_type, t);
730 void set_default_dcp_audio_channels (int c) {
731 maybe_set (_default_dcp_audio_channels, c);
734 void set_dcp_issuer (std::string i) {
735 maybe_set (_dcp_issuer, i);
738 void set_dcp_creator (std::string c) {
739 maybe_set (_dcp_creator, c);
742 void set_dcp_company_name (std::string c) {
743 maybe_set (_dcp_company_name, c);
746 void set_dcp_product_name (std::string c) {
747 maybe_set (_dcp_product_name, c);
750 void set_dcp_product_version (std::string c) {
751 maybe_set (_dcp_product_version, c);
754 void set_dcp_j2k_comment (std::string c) {
755 maybe_set (_dcp_j2k_comment, c);
758 void set_default_j2k_bandwidth (int b) {
759 maybe_set (_default_j2k_bandwidth, b);
762 void set_default_audio_delay (int d) {
763 maybe_set (_default_audio_delay, d);
766 void set_default_interop (bool i) {
767 maybe_set (_default_interop, i);
770 void set_default_audio_language(dcp::LanguageTag tag) {
771 maybe_set(_default_audio_language, tag);
774 void unset_default_audio_language() {
775 maybe_set(_default_audio_language, boost::optional<dcp::LanguageTag>());
778 void set_default_territory(dcp::LanguageTag::RegionSubtag tag) {
779 maybe_set(_default_territory, tag);
782 void unset_default_territory() {
783 maybe_set(_default_territory, boost::optional<dcp::LanguageTag::RegionSubtag>());
786 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
787 maybe_set (_default_metadata, metadata);
790 void set_upload_after_make_dcp (bool u) {
791 maybe_set (_upload_after_make_dcp, u);
794 void set_mail_server (std::string s) {
795 maybe_set (_mail_server, s);
798 void set_mail_port (int p) {
799 maybe_set (_mail_port, p);
802 void set_mail_protocol (EmailProtocol p) {
803 maybe_set (_mail_protocol, p);
806 void set_mail_user (std::string u) {
807 maybe_set (_mail_user, u);
810 void set_mail_password (std::string p) {
811 maybe_set (_mail_password, p);
814 void set_kdm_subject (std::string s) {
815 maybe_set (_kdm_subject, s);
818 void set_kdm_from (std::string f) {
819 maybe_set (_kdm_from, f);
822 void set_kdm_cc (std::vector<std::string> f) {
823 maybe_set (_kdm_cc, f);
826 void set_kdm_bcc (std::string f) {
827 maybe_set (_kdm_bcc, f);
830 void set_kdm_email (std::string e) {
831 maybe_set (_kdm_email, e);
834 void reset_kdm_email ();
836 void set_notification_subject (std::string s) {
837 maybe_set (_notification_subject, s);
840 void set_notification_from (std::string f) {
841 maybe_set (_notification_from, f);
844 void set_notification_to (std::string t) {
845 maybe_set (_notification_to, t);
848 void set_notification_cc (std::vector<std::string> f) {
849 maybe_set (_notification_cc, f);
852 void set_notification_bcc (std::string f) {
853 maybe_set (_notification_bcc, f);
856 void set_notification_email (std::string e) {
857 maybe_set (_notification_email, e);
860 void reset_notification_email ();
862 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
863 maybe_set (_signer_chain, s);
866 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
867 maybe_set (_decryption_chain, c);
870 void set_check_for_updates (bool c) {
871 maybe_set (_check_for_updates, c);
873 set_check_for_test_updates (false);
877 void set_check_for_test_updates (bool c) {
878 maybe_set (_check_for_test_updates, c);
881 void set_maximum_j2k_bandwidth (int b) {
882 maybe_set (_maximum_j2k_bandwidth, b);
885 void set_log_types (int t) {
886 maybe_set (_log_types, t);
889 void set_analyse_ebur128 (bool a) {
890 maybe_set (_analyse_ebur128, a);
893 void set_automatic_audio_analysis (bool a) {
894 maybe_set (_automatic_audio_analysis, a);
897 #ifdef DCPOMATIC_WINDOWS
898 void set_win32_console (bool c) {
899 maybe_set (_win32_console, c);
903 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
908 void set_cinemas_file (boost::filesystem::path file);
910 void set_show_hints_before_make_dcp (bool s) {
911 maybe_set (_show_hints_before_make_dcp, s);
914 void set_confirm_kdm_email (bool s) {
915 maybe_set (_confirm_kdm_email, s);
918 void set_sound (bool s) {
919 maybe_set (_sound, s, SOUND);
922 void set_sound_output (std::string o) {
923 maybe_set (_sound_output, o, SOUND_OUTPUT);
926 void set_last_player_load_directory (boost::filesystem::path d) {
927 maybe_set (_last_player_load_directory, d);
930 void set_last_kdm_write_type (KDMWriteType t) {
931 maybe_set (_last_kdm_write_type, t);
934 void set_last_dkdm_write_type (DKDMWriteType t) {
935 maybe_set (_last_dkdm_write_type, t);
938 void unset_sound_output () {
939 if (!_sound_output) {
943 _sound_output = boost::none;
947 void set_kdm_container_name_format (dcp::NameFormat n) {
948 maybe_set (_kdm_container_name_format, n);
951 void set_kdm_filename_format (dcp::NameFormat n) {
952 maybe_set (_kdm_filename_format, n);
955 void set_dkdm_filename_format (dcp::NameFormat n) {
956 maybe_set (_dkdm_filename_format, n);
959 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
960 maybe_set (_dcp_metadata_filename_format, n);
963 void set_dcp_asset_filename_format (dcp::NameFormat n) {
964 maybe_set (_dcp_asset_filename_format, n);
967 void set_frames_in_memory_multiplier (int m) {
968 maybe_set (_frames_in_memory_multiplier, m);
971 void set_decode_reduction (boost::optional<int> r) {
972 maybe_set (_decode_reduction, r);
975 void set_default_notify (bool n) {
976 maybe_set (_default_notify, n);
979 void clear_history () {
984 void clear_player_history () {
985 _player_history.clear ();
989 void add_to_history (boost::filesystem::path p);
990 void clean_history ();
991 void add_to_player_history (boost::filesystem::path p);
992 void clean_player_history ();
994 void set_jump_to_selected (bool j) {
995 maybe_set (_jump_to_selected, j);
998 void set_nagged (Nag nag, bool nagged) {
999 maybe_set (_nagged[nag], nagged);
1002 void set_cover_sheet (std::string s) {
1003 maybe_set (_cover_sheet, s);
1006 void reset_cover_sheet ();
1008 void set_notification (Notification n, bool v) {
1009 maybe_set (_notification[n], v);
1012 void set_barco_username (std::string u) {
1013 maybe_set (_barco_username, u);
1016 void unset_barco_username () {
1017 maybe_set (_barco_username, boost::optional<std::string>());
1020 void set_barco_password (std::string p) {
1021 maybe_set (_barco_password, p);
1024 void unset_barco_password () {
1025 maybe_set (_barco_password, boost::optional<std::string>());
1028 void set_christie_username (std::string u) {
1029 maybe_set (_christie_username, u);
1032 void unset_christie_username () {
1033 maybe_set (_christie_username, boost::optional<std::string>());
1036 void set_christie_password (std::string p) {
1037 maybe_set (_christie_password, p);
1040 void unset_christie_password () {
1041 maybe_set (_christie_password, boost::optional<std::string>());
1044 void set_gdc_username (std::string u) {
1045 maybe_set (_gdc_username, u);
1048 void unset_gdc_username () {
1049 maybe_set (_gdc_username, boost::optional<std::string>());
1052 void set_gdc_password (std::string p) {
1053 maybe_set (_gdc_password, p);
1056 void unset_gdc_password () {
1057 maybe_set (_gdc_password, boost::optional<std::string>());
1060 void set_player_mode (PlayerMode m) {
1061 maybe_set (_player_mode, m);
1064 void set_image_display (int n) {
1065 maybe_set (_image_display, n);
1068 void set_video_view_type (VideoViewType v) {
1069 maybe_set (_video_view_type, v);
1072 void set_respect_kdm_validity_periods (bool r) {
1073 maybe_set (_respect_kdm_validity_periods, r);
1076 void set_player_debug_log_file (boost::filesystem::path p) {
1077 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1080 void unset_player_debug_log_file () {
1081 if (!_player_debug_log_file) {
1084 _player_debug_log_file = boost::none;
1085 changed (PLAYER_DEBUG_LOG);
1088 void set_player_content_directory (boost::filesystem::path p) {
1089 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1092 void unset_player_content_directory () {
1093 if (!_player_content_directory) {
1096 _player_content_directory = boost::none;
1097 changed (PLAYER_CONTENT_DIRECTORY);
1100 void set_player_playlist_directory (boost::filesystem::path p) {
1101 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1104 void unset_player_playlist_directory () {
1105 if (!_player_playlist_directory) {
1108 _player_playlist_directory = boost::none;
1109 changed (PLAYER_PLAYLIST_DIRECTORY);
1112 void set_player_kdm_directory (boost::filesystem::path p) {
1113 maybe_set (_player_kdm_directory, p);
1116 void unset_player_kdm_directory () {
1117 if (!_player_kdm_directory) {
1120 _player_kdm_directory = boost::none;
1124 void set_audio_mapping (AudioMapping m);
1125 void set_audio_mapping_to_default ();
1127 void add_custom_language (dcp::LanguageTag tag);
1129 void set_initial_path(std::string id, boost::filesystem::path path);
1131 void set_use_isdcf_name_by_default (bool use) {
1132 maybe_set (_use_isdcf_name_by_default, use);
1135 void set_write_kdms_to_disk (bool write) {
1136 maybe_set (_write_kdms_to_disk, write);
1139 void set_email_kdms (bool email) {
1140 maybe_set (_email_kdms, email);
1143 void set_default_kdm_type (dcp::Formulation type) {
1144 maybe_set (_default_kdm_type, type);
1147 void set_default_kdm_duration (RoughDuration duration) {
1148 maybe_set (_default_kdm_duration, duration);
1151 void set_auto_crop_threshold (double threshold) {
1152 maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
1155 void set_last_release_notes_version (std::string version) {
1156 maybe_set (_last_release_notes_version, version);
1159 void unset_last_release_notes_version() {
1160 maybe_set(_last_release_notes_version, boost::optional<std::string>());
1163 ExportConfig& export_config() {
1167 void set_main_divider_sash_position(int position) {
1168 maybe_set(_main_divider_sash_position, position);
1171 void set_main_content_divider_sash_position(int position) {
1172 maybe_set(_main_content_divider_sash_position, position);
1175 void changed (Property p = OTHER);
1176 boost::signals2::signal<void (Property)> Changed;
1177 /** Emitted if read() failed on an existing Config file. There is nothing
1178 a listener can do about it: this is just for information.
1180 enum class LoadFailure {
1185 static boost::signals2::signal<void (LoadFailure)> FailedToLoad;
1186 /** Emitted if read() issued a warning which the user might want to know about */
1187 static boost::signals2::signal<void (std::string)> Warning;
1188 /** Emitted if there is a something wrong the contents of our config. Handler can call
1189 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1192 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1193 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1194 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1195 BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
1198 static boost::signals2::signal<bool (BadReason)> Bad;
1200 void write () const override;
1201 void write_config () const;
1202 void write_cinemas () const;
1203 void write_dkdm_recipients () const;
1204 void link (boost::filesystem::path new_file) const;
1205 void copy_and_link (boost::filesystem::path new_file) const;
1206 bool have_write_permission () const;
1208 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1209 bool existing_template (std::string name) const;
1210 std::list<std::string> templates () const;
1211 boost::filesystem::path template_read_path (std::string name) const;
1212 boost::filesystem::path template_write_path (std::string name) const;
1213 void rename_template (std::string old_name, std::string new_name) const;
1214 void delete_template (std::string name) const;
1216 boost::optional<BadReason> check_certificates () const;
1218 static Config* instance ();
1219 static void drop ();
1220 static void restore_defaults ();
1221 static bool have_existing (std::string);
1222 static boost::filesystem::path config_read_file ();
1223 static boost::filesystem::path config_write_file ();
1226 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1227 if (member == new_value) {
1235 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1236 if (member && member.get() == new_value) {
1245 void read () override;
1247 void read_cinemas();
1248 void read_dkdm_recipients();
1249 void set_defaults ();
1250 void set_kdm_email_to_default ();
1251 void set_notification_email_to_default ();
1252 void set_cover_sheet_to_default ();
1253 void read_cinemas (cxml::Document const & f);
1254 void read_dkdm_recipients (cxml::Document const & f);
1255 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1256 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1257 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1258 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1261 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1262 int _master_encoding_threads;
1263 /** number of threads which a server should use for J2K encoding on the local machine */
1264 int _server_encoding_threads;
1265 /** default directory to put new films in */
1266 boost::optional<boost::filesystem::path> _default_directory;
1267 /** base port number to use for J2K encoding servers;
1268 * this port and the two above it will be used.
1270 int _server_port_base;
1271 /** true to broadcast on the `any' address to look for servers */
1272 bool _use_any_servers;
1273 /** J2K encoding servers that should definitely be used */
1274 std::vector<std::string> _servers;
1275 bool _only_servers_encode;
1276 FileTransferProtocol _tms_protocol;
1278 /** The IP address of a TMS that we can copy DCPs to */
1279 std::string _tms_ip;
1280 /** The path on a TMS that we should write DCPs to */
1281 std::string _tms_path;
1282 /** User name to log into the TMS with */
1283 std::string _tms_user;
1284 /** Password to log into the TMS with */
1285 std::string _tms_password;
1286 /** The list of possible DCP frame rates that DCP-o-matic will use */
1287 std::list<int> _allowed_dcp_frame_rates;
1288 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1289 bool _allow_any_dcp_frame_rate;
1290 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1291 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1292 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1294 bool _allow_any_container;
1295 bool _allow_96khz_audio;
1296 bool _use_all_audio_channels;
1297 /** Offer the upmixers in the audio processor settings */
1298 bool _show_experimental_audio_processors;
1299 boost::optional<std::string> _language;
1300 /** Default length of still image content (seconds) */
1301 int _default_still_length;
1302 DCPContentType const * _default_dcp_content_type;
1303 int _default_dcp_audio_channels;
1304 std::string _dcp_issuer;
1305 std::string _dcp_creator;
1306 std::string _dcp_company_name;
1307 std::string _dcp_product_name;
1308 std::string _dcp_product_version;
1309 std::string _dcp_j2k_comment;
1310 int _default_j2k_bandwidth;
1311 int _default_audio_delay;
1312 bool _default_interop;
1313 boost::optional<dcp::LanguageTag> _default_audio_language;
1314 boost::optional<dcp::LanguageTag::RegionSubtag> _default_territory;
1315 std::map<std::string, std::string> _default_metadata;
1316 /** Default directory to offer to write KDMs to; if it's not set,
1317 the home directory will be offered.
1319 boost::optional<boost::filesystem::path> _default_kdm_directory;
1320 bool _upload_after_make_dcp;
1321 std::list<std::shared_ptr<Cinema>> _cinemas;
1322 std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
1323 std::string _mail_server;
1325 EmailProtocol _mail_protocol;
1326 std::string _mail_user;
1327 std::string _mail_password;
1328 std::string _kdm_subject;
1329 std::string _kdm_from;
1330 std::vector<std::string> _kdm_cc;
1331 std::string _kdm_bcc;
1332 std::string _kdm_email;
1333 std::string _notification_subject;
1334 std::string _notification_from;
1335 std::string _notification_to;
1336 std::vector<std::string> _notification_cc;
1337 std::string _notification_bcc;
1338 std::string _notification_email;
1339 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1340 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1341 * certificate for making KDMs given to DCP-o-matic.
1343 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1344 /** true to check for updates on startup */
1345 bool _check_for_updates;
1346 bool _check_for_test_updates;
1347 /** maximum allowed J2K bandwidth in bits per second */
1348 int _maximum_j2k_bandwidth;
1350 bool _analyse_ebur128;
1351 bool _automatic_audio_analysis;
1352 #ifdef DCPOMATIC_WINDOWS
1353 bool _win32_console;
1355 std::vector<boost::filesystem::path> _history;
1356 std::vector<boost::filesystem::path> _player_history;
1357 std::shared_ptr<DKDMGroup> _dkdms;
1358 boost::filesystem::path _cinemas_file;
1359 boost::filesystem::path _dkdm_recipients_file;
1360 bool _show_hints_before_make_dcp;
1361 bool _confirm_kdm_email;
1362 dcp::NameFormat _kdm_filename_format;
1363 dcp::NameFormat _dkdm_filename_format;
1364 dcp::NameFormat _kdm_container_name_format;
1365 dcp::NameFormat _dcp_metadata_filename_format;
1366 dcp::NameFormat _dcp_asset_filename_format;
1367 bool _jump_to_selected;
1368 bool _nagged[NAG_COUNT];
1370 /** name of a specific sound output stream to use, or empty to use the default */
1371 boost::optional<std::string> _sound_output;
1372 std::string _cover_sheet;
1373 boost::optional<boost::filesystem::path> _last_player_load_directory;
1374 boost::optional<KDMWriteType> _last_kdm_write_type;
1375 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1376 int _frames_in_memory_multiplier;
1377 boost::optional<int> _decode_reduction;
1378 bool _default_notify;
1379 bool _notification[NOTIFICATION_COUNT];
1380 boost::optional<std::string> _barco_username;
1381 boost::optional<std::string> _barco_password;
1382 boost::optional<std::string> _christie_username;
1383 boost::optional<std::string> _christie_password;
1384 boost::optional<std::string> _gdc_username;
1385 boost::optional<std::string> _gdc_password;
1386 PlayerMode _player_mode;
1388 VideoViewType _video_view_type;
1389 bool _respect_kdm_validity_periods;
1390 /** Log file containing debug information for the player */
1391 boost::optional<boost::filesystem::path> _player_debug_log_file;
1392 /** A directory containing DCPs whose contents are presented to the user
1393 in the dual-screen player mode. DCPs on the list can be loaded
1396 boost::optional<boost::filesystem::path> _player_content_directory;
1397 boost::optional<boost::filesystem::path> _player_playlist_directory;
1398 boost::optional<boost::filesystem::path> _player_kdm_directory;
1399 boost::optional<AudioMapping> _audio_mapping;
1400 std::vector<dcp::LanguageTag> _custom_languages;
1401 std::map<std::string, boost::optional<boost::filesystem::path>> _initial_paths;
1402 bool _use_isdcf_name_by_default;
1403 bool _write_kdms_to_disk;
1405 dcp::Formulation _default_kdm_type;
1406 RoughDuration _default_kdm_duration;
1407 double _auto_crop_threshold;
1408 boost::optional<std::string> _last_release_notes_version;
1409 boost::optional<int> _main_divider_sash_position;
1410 boost::optional<int> _main_content_divider_sash_position;
1412 ExportConfig _export;
1414 static int const _current_version;
1416 /** Singleton instance, or 0 */
1417 static Config* _instance;