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"
35 #include <dcp/name_format.h>
36 #include <dcp/certificate_chain.h>
37 #include <dcp/encrypted_kdm.h>
38 #include <dcp/language_tag.h>
39 #include <boost/signals2.hpp>
40 #include <boost/filesystem.hpp>
45 class CinemaSoundProcessor;
53 extern void save_all_config_as_zip (boost::filesystem::path zip_file);
57 * @brief A singleton class holding configuration.
59 class Config : public State
62 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
63 int master_encoding_threads () const {
64 return _master_encoding_threads;
67 /** @return number of threads which a server should use for J2K encoding on the local machine */
68 int server_encoding_threads () const {
69 return _server_encoding_threads;
72 boost::optional<boost::filesystem::path> default_directory () const {
73 return _default_directory;
76 boost::optional<boost::filesystem::path> default_kdm_directory () const {
77 return _default_kdm_directory;
80 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
81 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
90 PLAYER_CONTENT_DIRECTORY,
91 PLAYER_PLAYLIST_DIRECTORY,
94 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
100 /** @return base port number to use for J2K encoding servers */
101 int server_port_base () const {
102 return _server_port_base;
105 void set_use_any_servers (bool u) {
106 _use_any_servers = u;
107 changed (USE_ANY_SERVERS);
110 bool use_any_servers () const {
111 return _use_any_servers;
114 /** @param s New list of servers */
115 void set_servers (std::vector<std::string> s) {
120 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
121 std::vector<std::string> servers () const {
125 bool only_servers_encode () const {
126 return _only_servers_encode;
129 FileTransferProtocol tms_protocol () const {
130 return _tms_protocol;
133 bool tms_passive() const {
137 /** @return The IP address of a TMS that we can copy DCPs to */
138 std::string tms_ip () const {
142 /** @return The path on a TMS that we should changed DCPs to */
143 std::string tms_path () const {
147 /** @return User name to log into the TMS with */
148 std::string tms_user () const {
152 /** @return Password to log into the TMS with */
153 std::string tms_password () const {
154 return _tms_password;
157 std::list<std::shared_ptr<Cinema>> cinemas () const {
161 std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
162 return _dkdm_recipients;
165 std::list<int> allowed_dcp_frame_rates () const {
166 return _allowed_dcp_frame_rates;
169 bool allow_any_dcp_frame_rate () const {
170 return _allow_any_dcp_frame_rate;
173 bool allow_any_container () const {
174 return _allow_any_container;
177 bool allow_96khz_audio () const {
178 return _allow_96khz_audio;
181 bool use_all_audio_channels () const {
182 return _use_all_audio_channels;
185 bool show_experimental_audio_processors () const {
186 return _show_experimental_audio_processors;
189 boost::optional<std::string> language () const {
193 int default_still_length () const {
194 return _default_still_length;
197 DCPContentType const * default_dcp_content_type () const {
198 return _default_dcp_content_type;
201 int default_dcp_audio_channels () const {
202 return _default_dcp_audio_channels;
205 std::string dcp_issuer () const {
209 std::string dcp_creator () const {
213 std::string dcp_company_name () const {
214 return _dcp_company_name;
217 std::string dcp_product_name () const {
218 return _dcp_product_name;
221 std::string dcp_product_version () const {
222 return _dcp_product_version;
225 std::string dcp_j2k_comment () const {
226 return _dcp_j2k_comment;
229 int default_j2k_bandwidth () const {
230 return _default_j2k_bandwidth;
233 int default_audio_delay () const {
234 return _default_audio_delay;
237 bool default_interop () const {
238 return _default_interop;
241 boost::optional<dcp::LanguageTag> default_audio_language() const {
242 return _default_audio_language;
245 std::map<std::string, std::string> default_metadata () const {
246 return _default_metadata;
249 bool upload_after_make_dcp () {
250 return _upload_after_make_dcp;
253 void set_default_kdm_directory (boost::filesystem::path d) {
254 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
257 _default_kdm_directory = d;
261 std::string mail_server () const {
265 int mail_port () const {
269 EmailProtocol mail_protocol () const {
270 return _mail_protocol;
273 std::string mail_user () const {
277 std::string mail_password () const {
278 return _mail_password;
281 std::string kdm_subject () const {
285 std::string kdm_from () const {
289 std::vector<std::string> kdm_cc () const {
293 std::string kdm_bcc () const {
297 std::string kdm_email () const {
301 std::string notification_subject () const {
302 return _notification_subject;
305 std::string notification_from () const {
306 return _notification_from;
309 std::string notification_to () const {
310 return _notification_to;
313 std::vector<std::string> notification_cc () const {
314 return _notification_cc;
317 std::string notification_bcc () const {
318 return _notification_bcc;
321 std::string notification_email () const {
322 return _notification_email;
325 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
326 return _signer_chain;
329 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
330 return _decryption_chain;
333 bool check_for_updates () const {
334 return _check_for_updates;
337 bool check_for_test_updates () const {
338 return _check_for_test_updates;
341 int maximum_j2k_bandwidth () const {
342 return _maximum_j2k_bandwidth;
345 int log_types () const {
349 bool analyse_ebur128 () const {
350 return _analyse_ebur128;
353 bool automatic_audio_analysis () const {
354 return _automatic_audio_analysis;
357 #ifdef DCPOMATIC_WINDOWS
358 bool win32_console () const {
359 return _win32_console;
363 std::vector<boost::filesystem::path> history () const {
367 std::vector<boost::filesystem::path> player_history () const {
368 return _player_history;
371 std::shared_ptr<DKDMGroup> dkdms () const {
375 boost::filesystem::path cinemas_file () const {
376 return _cinemas_file;
379 boost::filesystem::path dkdm_recipients_file () const {
380 return _dkdm_recipients_file;
383 bool show_hints_before_make_dcp () const {
384 return _show_hints_before_make_dcp;
387 bool confirm_kdm_email () const {
388 return _confirm_kdm_email;
391 dcp::NameFormat kdm_container_name_format () const {
392 return _kdm_container_name_format;
395 dcp::NameFormat kdm_filename_format () const {
396 return _kdm_filename_format;
399 dcp::NameFormat dkdm_filename_format () const {
400 return _dkdm_filename_format;
403 dcp::NameFormat dcp_metadata_filename_format () const {
404 return _dcp_metadata_filename_format;
407 dcp::NameFormat dcp_asset_filename_format () const {
408 return _dcp_asset_filename_format;
411 bool jump_to_selected () const {
412 return _jump_to_selected;
415 /* This could be an enum class but we use the enum a lot to index _nagged
416 * so it means a lot of casts.
420 NAG_ENCRYPTED_METADATA,
421 NAG_ALTER_DECRYPTION_CHAIN,
422 NAG_BAD_SIGNER_CHAIN_UTF8,
423 NAG_IMPORT_DECRYPTION_CHAIN,
426 NAG_TOO_MANY_DROPPED_FRAMES,
427 NAG_BAD_SIGNER_CHAIN_VALIDITY,
431 bool nagged (Nag nag) const {
435 bool sound () const {
439 std::string cover_sheet () const {
443 boost::optional<std::string> sound_output () const {
444 return _sound_output;
447 boost::optional<boost::filesystem::path> last_player_load_directory () const {
448 return _last_player_load_directory;
457 boost::optional<KDMWriteType> last_kdm_write_type () const {
458 return _last_kdm_write_type;
466 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
467 return _last_dkdm_write_type;
470 int frames_in_memory_multiplier () const {
471 return _frames_in_memory_multiplier;
474 boost::optional<int> decode_reduction () const {
475 return _decode_reduction;
478 bool default_notify () const {
479 return _default_notify;
488 bool notification (Notification n) const {
489 return _notification[n];
492 boost::optional<std::string> barco_username () const {
493 return _barco_username;
496 boost::optional<std::string> barco_password () const {
497 return _barco_password;
500 boost::optional<std::string> christie_username () const {
501 return _christie_username;
504 boost::optional<std::string> christie_password () const {
505 return _christie_password;
508 boost::optional<std::string> gdc_username () const {
509 return _gdc_username;
512 boost::optional<std::string> gdc_password () const {
513 return _gdc_password;
517 PLAYER_MODE_WINDOW, ///< one window containing image and controls
518 PLAYER_MODE_FULL, ///< just the image filling the screen
519 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
522 PlayerMode player_mode () const {
526 int image_display () const {
527 return _image_display;
535 VideoViewType video_view_type () const {
536 return _video_view_type;
539 bool respect_kdm_validity_periods () const {
540 return _respect_kdm_validity_periods;
543 boost::optional<boost::filesystem::path> player_debug_log_file () const {
544 return _player_debug_log_file;
547 boost::optional<boost::filesystem::path> player_content_directory () const {
548 return _player_content_directory;
551 boost::optional<boost::filesystem::path> player_playlist_directory () const {
552 return _player_playlist_directory;
555 boost::optional<boost::filesystem::path> player_kdm_directory () const {
556 return _player_kdm_directory;
559 AudioMapping audio_mapping (int output_channels);
561 std::vector<dcp::LanguageTag> custom_languages () const {
562 return _custom_languages;
565 boost::optional<boost::filesystem::path> add_files_path () const {
566 return _add_files_path;
569 bool use_isdcf_name_by_default () const {
570 return _use_isdcf_name_by_default;
573 bool write_kdms_to_disk () const {
574 return _write_kdms_to_disk;
577 bool email_kdms () const {
581 dcp::Formulation default_kdm_type () const {
582 return _default_kdm_type;
585 RoughDuration default_kdm_duration () const {
586 return _default_kdm_duration;
589 double auto_crop_threshold () const {
590 return _auto_crop_threshold;
593 boost::optional<std::string> last_release_notes_version () const {
594 return _last_release_notes_version;
597 boost::optional<int> main_divider_sash_position() const {
598 return _main_divider_sash_position;
601 boost::optional<int> main_content_divider_sash_position() const {
602 return _main_content_divider_sash_position;
607 void set_master_encoding_threads (int n) {
608 maybe_set (_master_encoding_threads, n);
611 void set_server_encoding_threads (int n) {
612 maybe_set (_server_encoding_threads, n);
615 void set_default_directory (boost::filesystem::path d) {
616 if (_default_directory && *_default_directory == d) {
619 _default_directory = d;
623 /** @param p New server port */
624 void set_server_port_base (int p) {
625 maybe_set (_server_port_base, p);
628 void set_only_servers_encode (bool o) {
629 maybe_set (_only_servers_encode, o);
632 void set_tms_protocol (FileTransferProtocol p) {
633 maybe_set (_tms_protocol, p);
636 void set_tms_passive(bool passive) {
637 maybe_set(_tms_passive, passive);
640 /** @param i IP address of a TMS that we can copy DCPs to */
641 void set_tms_ip (std::string i) {
642 maybe_set (_tms_ip, i);
645 /** @param p Path on a TMS that we should changed DCPs to */
646 void set_tms_path (std::string p) {
647 maybe_set (_tms_path, p);
650 /** @param u User name to log into the TMS with */
651 void set_tms_user (std::string u) {
652 maybe_set (_tms_user, u);
655 /** @param p Password to log into the TMS with */
656 void set_tms_password (std::string p) {
657 maybe_set (_tms_password, p);
660 void add_cinema (std::shared_ptr<Cinema> c) {
661 _cinemas.push_back (c);
665 void remove_cinema (std::shared_ptr<Cinema> c) {
670 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
671 _dkdm_recipients.push_back (c);
672 changed (DKDM_RECIPIENTS);
675 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
676 _dkdm_recipients.remove (c);
677 changed (DKDM_RECIPIENTS);
680 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
681 maybe_set (_allowed_dcp_frame_rates, r);
684 void set_allow_any_dcp_frame_rate (bool a) {
685 maybe_set (_allow_any_dcp_frame_rate, a);
688 void set_allow_any_container (bool a) {
689 maybe_set (_allow_any_container, a);
692 void set_allow_96hhz_audio (bool a) {
693 maybe_set (_allow_96khz_audio, a);
696 void set_use_all_audio_channels (bool a) {
697 maybe_set (_use_all_audio_channels, a);
700 void set_show_experimental_audio_processors (bool e) {
701 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
704 void set_language (std::string l) {
705 if (_language && _language.get() == l) {
712 void unset_language () {
717 _language = boost::none;
721 void set_default_still_length (int s) {
722 maybe_set (_default_still_length, s);
725 void set_default_dcp_content_type (DCPContentType const * t) {
726 maybe_set (_default_dcp_content_type, t);
729 void set_default_dcp_audio_channels (int c) {
730 maybe_set (_default_dcp_audio_channels, c);
733 void set_dcp_issuer (std::string i) {
734 maybe_set (_dcp_issuer, i);
737 void set_dcp_creator (std::string c) {
738 maybe_set (_dcp_creator, c);
741 void set_dcp_company_name (std::string c) {
742 maybe_set (_dcp_company_name, c);
745 void set_dcp_product_name (std::string c) {
746 maybe_set (_dcp_product_name, c);
749 void set_dcp_product_version (std::string c) {
750 maybe_set (_dcp_product_version, c);
753 void set_dcp_j2k_comment (std::string c) {
754 maybe_set (_dcp_j2k_comment, c);
757 void set_default_j2k_bandwidth (int b) {
758 maybe_set (_default_j2k_bandwidth, b);
761 void set_default_audio_delay (int d) {
762 maybe_set (_default_audio_delay, d);
765 void set_default_interop (bool i) {
766 maybe_set (_default_interop, i);
769 void set_default_audio_language(dcp::LanguageTag tag) {
770 maybe_set(_default_audio_language, tag);
773 void unset_default_audio_language() {
774 maybe_set(_default_audio_language, boost::optional<dcp::LanguageTag>());
777 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
778 maybe_set (_default_metadata, metadata);
781 void set_upload_after_make_dcp (bool u) {
782 maybe_set (_upload_after_make_dcp, u);
785 void set_mail_server (std::string s) {
786 maybe_set (_mail_server, s);
789 void set_mail_port (int p) {
790 maybe_set (_mail_port, p);
793 void set_mail_protocol (EmailProtocol p) {
794 maybe_set (_mail_protocol, p);
797 void set_mail_user (std::string u) {
798 maybe_set (_mail_user, u);
801 void set_mail_password (std::string p) {
802 maybe_set (_mail_password, p);
805 void set_kdm_subject (std::string s) {
806 maybe_set (_kdm_subject, s);
809 void set_kdm_from (std::string f) {
810 maybe_set (_kdm_from, f);
813 void set_kdm_cc (std::vector<std::string> f) {
814 maybe_set (_kdm_cc, f);
817 void set_kdm_bcc (std::string f) {
818 maybe_set (_kdm_bcc, f);
821 void set_kdm_email (std::string e) {
822 maybe_set (_kdm_email, e);
825 void reset_kdm_email ();
827 void set_notification_subject (std::string s) {
828 maybe_set (_notification_subject, s);
831 void set_notification_from (std::string f) {
832 maybe_set (_notification_from, f);
835 void set_notification_to (std::string t) {
836 maybe_set (_notification_to, t);
839 void set_notification_cc (std::vector<std::string> f) {
840 maybe_set (_notification_cc, f);
843 void set_notification_bcc (std::string f) {
844 maybe_set (_notification_bcc, f);
847 void set_notification_email (std::string e) {
848 maybe_set (_notification_email, e);
851 void reset_notification_email ();
853 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
854 maybe_set (_signer_chain, s);
857 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
858 maybe_set (_decryption_chain, c);
861 void set_check_for_updates (bool c) {
862 maybe_set (_check_for_updates, c);
864 set_check_for_test_updates (false);
868 void set_check_for_test_updates (bool c) {
869 maybe_set (_check_for_test_updates, c);
872 void set_maximum_j2k_bandwidth (int b) {
873 maybe_set (_maximum_j2k_bandwidth, b);
876 void set_log_types (int t) {
877 maybe_set (_log_types, t);
880 void set_analyse_ebur128 (bool a) {
881 maybe_set (_analyse_ebur128, a);
884 void set_automatic_audio_analysis (bool a) {
885 maybe_set (_automatic_audio_analysis, a);
888 #ifdef DCPOMATIC_WINDOWS
889 void set_win32_console (bool c) {
890 maybe_set (_win32_console, c);
894 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
899 void set_cinemas_file (boost::filesystem::path file);
901 void set_show_hints_before_make_dcp (bool s) {
902 maybe_set (_show_hints_before_make_dcp, s);
905 void set_confirm_kdm_email (bool s) {
906 maybe_set (_confirm_kdm_email, s);
909 void set_sound (bool s) {
910 maybe_set (_sound, s, SOUND);
913 void set_sound_output (std::string o) {
914 maybe_set (_sound_output, o, SOUND_OUTPUT);
917 void set_last_player_load_directory (boost::filesystem::path d) {
918 maybe_set (_last_player_load_directory, d);
921 void set_last_kdm_write_type (KDMWriteType t) {
922 maybe_set (_last_kdm_write_type, t);
925 void set_last_dkdm_write_type (DKDMWriteType t) {
926 maybe_set (_last_dkdm_write_type, t);
929 void unset_sound_output () {
930 if (!_sound_output) {
934 _sound_output = boost::none;
938 void set_kdm_container_name_format (dcp::NameFormat n) {
939 maybe_set (_kdm_container_name_format, n);
942 void set_kdm_filename_format (dcp::NameFormat n) {
943 maybe_set (_kdm_filename_format, n);
946 void set_dkdm_filename_format (dcp::NameFormat n) {
947 maybe_set (_dkdm_filename_format, n);
950 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
951 maybe_set (_dcp_metadata_filename_format, n);
954 void set_dcp_asset_filename_format (dcp::NameFormat n) {
955 maybe_set (_dcp_asset_filename_format, n);
958 void set_frames_in_memory_multiplier (int m) {
959 maybe_set (_frames_in_memory_multiplier, m);
962 void set_decode_reduction (boost::optional<int> r) {
963 maybe_set (_decode_reduction, r);
966 void set_default_notify (bool n) {
967 maybe_set (_default_notify, n);
970 void clear_history () {
975 void clear_player_history () {
976 _player_history.clear ();
980 void add_to_history (boost::filesystem::path p);
981 void clean_history ();
982 void add_to_player_history (boost::filesystem::path p);
983 void clean_player_history ();
985 void set_jump_to_selected (bool j) {
986 maybe_set (_jump_to_selected, j);
989 void set_nagged (Nag nag, bool nagged) {
990 maybe_set (_nagged[nag], nagged);
993 void set_cover_sheet (std::string s) {
994 maybe_set (_cover_sheet, s);
997 void reset_cover_sheet ();
999 void set_notification (Notification n, bool v) {
1000 maybe_set (_notification[n], v);
1003 void set_barco_username (std::string u) {
1004 maybe_set (_barco_username, u);
1007 void unset_barco_username () {
1008 maybe_set (_barco_username, boost::optional<std::string>());
1011 void set_barco_password (std::string p) {
1012 maybe_set (_barco_password, p);
1015 void unset_barco_password () {
1016 maybe_set (_barco_password, boost::optional<std::string>());
1019 void set_christie_username (std::string u) {
1020 maybe_set (_christie_username, u);
1023 void unset_christie_username () {
1024 maybe_set (_christie_username, boost::optional<std::string>());
1027 void set_christie_password (std::string p) {
1028 maybe_set (_christie_password, p);
1031 void unset_christie_password () {
1032 maybe_set (_christie_password, boost::optional<std::string>());
1035 void set_gdc_username (std::string u) {
1036 maybe_set (_gdc_username, u);
1039 void unset_gdc_username () {
1040 maybe_set (_gdc_username, boost::optional<std::string>());
1043 void set_gdc_password (std::string p) {
1044 maybe_set (_gdc_password, p);
1047 void unset_gdc_password () {
1048 maybe_set (_gdc_password, boost::optional<std::string>());
1051 void set_player_mode (PlayerMode m) {
1052 maybe_set (_player_mode, m);
1055 void set_image_display (int n) {
1056 maybe_set (_image_display, n);
1059 void set_video_view_type (VideoViewType v) {
1060 maybe_set (_video_view_type, v);
1063 void set_respect_kdm_validity_periods (bool r) {
1064 maybe_set (_respect_kdm_validity_periods, r);
1067 void set_player_debug_log_file (boost::filesystem::path p) {
1068 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1071 void unset_player_debug_log_file () {
1072 if (!_player_debug_log_file) {
1075 _player_debug_log_file = boost::none;
1076 changed (PLAYER_DEBUG_LOG);
1079 void set_player_content_directory (boost::filesystem::path p) {
1080 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1083 void unset_player_content_directory () {
1084 if (!_player_content_directory) {
1087 _player_content_directory = boost::none;
1088 changed (PLAYER_CONTENT_DIRECTORY);
1091 void set_player_playlist_directory (boost::filesystem::path p) {
1092 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1095 void unset_player_playlist_directory () {
1096 if (!_player_playlist_directory) {
1099 _player_playlist_directory = boost::none;
1100 changed (PLAYER_PLAYLIST_DIRECTORY);
1103 void set_player_kdm_directory (boost::filesystem::path p) {
1104 maybe_set (_player_kdm_directory, p);
1107 void unset_player_kdm_directory () {
1108 if (!_player_kdm_directory) {
1111 _player_kdm_directory = boost::none;
1115 void set_audio_mapping (AudioMapping m);
1116 void set_audio_mapping_to_default ();
1118 void add_custom_language (dcp::LanguageTag tag);
1120 void set_add_files_path (boost::filesystem::path p) {
1121 _add_files_path = p;
1125 void set_use_isdcf_name_by_default (bool use) {
1126 maybe_set (_use_isdcf_name_by_default, use);
1129 void set_write_kdms_to_disk (bool write) {
1130 maybe_set (_write_kdms_to_disk, write);
1133 void set_email_kdms (bool email) {
1134 maybe_set (_email_kdms, email);
1137 void set_default_kdm_type (dcp::Formulation type) {
1138 maybe_set (_default_kdm_type, type);
1141 void set_default_kdm_duration (RoughDuration duration) {
1142 maybe_set (_default_kdm_duration, duration);
1145 void set_auto_crop_threshold (double threshold) {
1146 maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
1149 void set_last_release_notes_version (std::string version) {
1150 maybe_set (_last_release_notes_version, version);
1153 void unset_last_release_notes_version() {
1154 maybe_set(_last_release_notes_version, boost::optional<std::string>());
1157 ExportConfig& export_config() {
1161 void set_main_divider_sash_position(int position) {
1162 maybe_set(_main_divider_sash_position, position);
1165 void set_main_content_divider_sash_position(int position) {
1166 maybe_set(_main_content_divider_sash_position, position);
1169 void changed (Property p = OTHER);
1170 boost::signals2::signal<void (Property)> Changed;
1171 /** Emitted if read() failed on an existing Config file. There is nothing
1172 a listener can do about it: this is just for information.
1174 enum class LoadFailure {
1179 static boost::signals2::signal<void (LoadFailure)> FailedToLoad;
1180 /** Emitted if read() issued a warning which the user might want to know about */
1181 static boost::signals2::signal<void (std::string)> Warning;
1182 /** Emitted if there is a something wrong the contents of our config. Handler can call
1183 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1186 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1187 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1188 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1189 BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
1192 static boost::signals2::signal<bool (BadReason)> Bad;
1194 void write () const override;
1195 void write_config () const;
1196 void write_cinemas () const;
1197 void write_dkdm_recipients () const;
1198 void link (boost::filesystem::path new_file) const;
1199 void copy_and_link (boost::filesystem::path new_file) const;
1200 bool have_write_permission () const;
1202 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1203 bool existing_template (std::string name) const;
1204 std::list<std::string> templates () const;
1205 boost::filesystem::path template_read_path (std::string name) const;
1206 boost::filesystem::path template_write_path (std::string name) const;
1207 void rename_template (std::string old_name, std::string new_name) const;
1208 void delete_template (std::string name) const;
1210 boost::optional<BadReason> check_certificates () const;
1212 static Config* instance ();
1213 static void drop ();
1214 static void restore_defaults ();
1215 static bool have_existing (std::string);
1216 static boost::filesystem::path config_read_file ();
1217 static boost::filesystem::path config_write_file ();
1220 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1221 if (member == new_value) {
1229 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1230 if (member && member.get() == new_value) {
1239 void read () override;
1241 void read_cinemas();
1242 void read_dkdm_recipients();
1243 void set_defaults ();
1244 void set_kdm_email_to_default ();
1245 void set_notification_email_to_default ();
1246 void set_cover_sheet_to_default ();
1247 void read_cinemas (cxml::Document const & f);
1248 void read_dkdm_recipients (cxml::Document const & f);
1249 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1250 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1251 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1252 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1255 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1256 int _master_encoding_threads;
1257 /** number of threads which a server should use for J2K encoding on the local machine */
1258 int _server_encoding_threads;
1259 /** default directory to put new films in */
1260 boost::optional<boost::filesystem::path> _default_directory;
1261 /** base port number to use for J2K encoding servers;
1262 * this port and the two above it will be used.
1264 int _server_port_base;
1265 /** true to broadcast on the `any' address to look for servers */
1266 bool _use_any_servers;
1267 /** J2K encoding servers that should definitely be used */
1268 std::vector<std::string> _servers;
1269 bool _only_servers_encode;
1270 FileTransferProtocol _tms_protocol;
1272 /** The IP address of a TMS that we can copy DCPs to */
1273 std::string _tms_ip;
1274 /** The path on a TMS that we should write DCPs to */
1275 std::string _tms_path;
1276 /** User name to log into the TMS with */
1277 std::string _tms_user;
1278 /** Password to log into the TMS with */
1279 std::string _tms_password;
1280 /** The list of possible DCP frame rates that DCP-o-matic will use */
1281 std::list<int> _allowed_dcp_frame_rates;
1282 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1283 bool _allow_any_dcp_frame_rate;
1284 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1285 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1286 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1288 bool _allow_any_container;
1289 bool _allow_96khz_audio;
1290 bool _use_all_audio_channels;
1291 /** Offer the upmixers in the audio processor settings */
1292 bool _show_experimental_audio_processors;
1293 boost::optional<std::string> _language;
1294 /** Default length of still image content (seconds) */
1295 int _default_still_length;
1296 DCPContentType const * _default_dcp_content_type;
1297 int _default_dcp_audio_channels;
1298 std::string _dcp_issuer;
1299 std::string _dcp_creator;
1300 std::string _dcp_company_name;
1301 std::string _dcp_product_name;
1302 std::string _dcp_product_version;
1303 std::string _dcp_j2k_comment;
1304 int _default_j2k_bandwidth;
1305 int _default_audio_delay;
1306 bool _default_interop;
1307 boost::optional<dcp::LanguageTag> _default_audio_language;
1308 std::map<std::string, std::string> _default_metadata;
1309 /** Default directory to offer to write KDMs to; if it's not set,
1310 the home directory will be offered.
1312 boost::optional<boost::filesystem::path> _default_kdm_directory;
1313 bool _upload_after_make_dcp;
1314 std::list<std::shared_ptr<Cinema>> _cinemas;
1315 std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
1316 std::string _mail_server;
1318 EmailProtocol _mail_protocol;
1319 std::string _mail_user;
1320 std::string _mail_password;
1321 std::string _kdm_subject;
1322 std::string _kdm_from;
1323 std::vector<std::string> _kdm_cc;
1324 std::string _kdm_bcc;
1325 std::string _kdm_email;
1326 std::string _notification_subject;
1327 std::string _notification_from;
1328 std::string _notification_to;
1329 std::vector<std::string> _notification_cc;
1330 std::string _notification_bcc;
1331 std::string _notification_email;
1332 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1333 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1334 * certificate for making KDMs given to DCP-o-matic.
1336 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1337 /** true to check for updates on startup */
1338 bool _check_for_updates;
1339 bool _check_for_test_updates;
1340 /** maximum allowed J2K bandwidth in bits per second */
1341 int _maximum_j2k_bandwidth;
1343 bool _analyse_ebur128;
1344 bool _automatic_audio_analysis;
1345 #ifdef DCPOMATIC_WINDOWS
1346 bool _win32_console;
1348 std::vector<boost::filesystem::path> _history;
1349 std::vector<boost::filesystem::path> _player_history;
1350 std::shared_ptr<DKDMGroup> _dkdms;
1351 boost::filesystem::path _cinemas_file;
1352 boost::filesystem::path _dkdm_recipients_file;
1353 bool _show_hints_before_make_dcp;
1354 bool _confirm_kdm_email;
1355 dcp::NameFormat _kdm_filename_format;
1356 dcp::NameFormat _dkdm_filename_format;
1357 dcp::NameFormat _kdm_container_name_format;
1358 dcp::NameFormat _dcp_metadata_filename_format;
1359 dcp::NameFormat _dcp_asset_filename_format;
1360 bool _jump_to_selected;
1361 bool _nagged[NAG_COUNT];
1363 /** name of a specific sound output stream to use, or empty to use the default */
1364 boost::optional<std::string> _sound_output;
1365 std::string _cover_sheet;
1366 boost::optional<boost::filesystem::path> _last_player_load_directory;
1367 boost::optional<KDMWriteType> _last_kdm_write_type;
1368 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1369 int _frames_in_memory_multiplier;
1370 boost::optional<int> _decode_reduction;
1371 bool _default_notify;
1372 bool _notification[NOTIFICATION_COUNT];
1373 boost::optional<std::string> _barco_username;
1374 boost::optional<std::string> _barco_password;
1375 boost::optional<std::string> _christie_username;
1376 boost::optional<std::string> _christie_password;
1377 boost::optional<std::string> _gdc_username;
1378 boost::optional<std::string> _gdc_password;
1379 PlayerMode _player_mode;
1381 VideoViewType _video_view_type;
1382 bool _respect_kdm_validity_periods;
1383 /** Log file containing debug information for the player */
1384 boost::optional<boost::filesystem::path> _player_debug_log_file;
1385 /** A directory containing DCPs whose contents are presented to the user
1386 in the dual-screen player mode. DCPs on the list can be loaded
1389 boost::optional<boost::filesystem::path> _player_content_directory;
1390 boost::optional<boost::filesystem::path> _player_playlist_directory;
1391 boost::optional<boost::filesystem::path> _player_kdm_directory;
1392 boost::optional<AudioMapping> _audio_mapping;
1393 std::vector<dcp::LanguageTag> _custom_languages;
1394 boost::optional<boost::filesystem::path> _add_files_path;
1395 bool _use_isdcf_name_by_default;
1396 bool _write_kdms_to_disk;
1398 dcp::Formulation _default_kdm_type;
1399 RoughDuration _default_kdm_duration;
1400 double _auto_crop_threshold;
1401 boost::optional<std::string> _last_release_notes_version;
1402 boost::optional<int> _main_divider_sash_position;
1403 boost::optional<int> _main_content_divider_sash_position;
1405 ExportConfig _export;
1407 static int const _current_version;
1409 /** Singleton instance, or 0 */
1410 static Config* _instance;