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"
33 #include <dcp/name_format.h>
34 #include <dcp/certificate_chain.h>
35 #include <dcp/encrypted_kdm.h>
36 #include <dcp/language_tag.h>
37 #include <boost/signals2.hpp>
38 #include <boost/filesystem.hpp>
43 class CinemaSoundProcessor;
51 extern void save_all_config_as_zip (boost::filesystem::path zip_file);
55 * @brief A singleton class holding configuration.
57 class Config : public State
60 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
61 int master_encoding_threads () const {
62 return _master_encoding_threads;
65 /** @return number of threads which a server should use for J2K encoding on the local machine */
66 int server_encoding_threads () const {
67 return _server_encoding_threads;
70 boost::optional<boost::filesystem::path> default_directory () const {
71 return _default_directory;
74 boost::optional<boost::filesystem::path> default_kdm_directory () const {
75 return _default_kdm_directory;
78 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
79 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
88 PLAYER_CONTENT_DIRECTORY,
89 PLAYER_PLAYLIST_DIRECTORY,
92 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
98 /** @return base port number to use for J2K encoding servers */
99 int server_port_base () const {
100 return _server_port_base;
103 void set_use_any_servers (bool u) {
104 _use_any_servers = u;
105 changed (USE_ANY_SERVERS);
108 bool use_any_servers () const {
109 return _use_any_servers;
112 /** @param s New list of servers */
113 void set_servers (std::vector<std::string> s) {
118 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
119 std::vector<std::string> servers () const {
123 bool only_servers_encode () const {
124 return _only_servers_encode;
127 FileTransferProtocol tms_protocol () const {
128 return _tms_protocol;
131 /** @return The IP address of a TMS that we can copy DCPs to */
132 std::string tms_ip () const {
136 /** @return The path on a TMS that we should changed DCPs to */
137 std::string tms_path () const {
141 /** @return User name to log into the TMS with */
142 std::string tms_user () const {
146 /** @return Password to log into the TMS with */
147 std::string tms_password () const {
148 return _tms_password;
151 std::list<std::shared_ptr<Cinema>> cinemas () const {
155 std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
156 return _dkdm_recipients;
159 std::list<int> allowed_dcp_frame_rates () const {
160 return _allowed_dcp_frame_rates;
163 bool allow_any_dcp_frame_rate () const {
164 return _allow_any_dcp_frame_rate;
167 bool allow_any_container () const {
168 return _allow_any_container;
171 bool allow_96khz_audio () const {
172 return _allow_96khz_audio;
175 bool show_experimental_audio_processors () const {
176 return _show_experimental_audio_processors;
179 boost::optional<std::string> language () const {
183 int default_still_length () const {
184 return _default_still_length;
187 Ratio const * default_container () const {
188 return _default_container;
191 DCPContentType const * default_dcp_content_type () const {
192 return _default_dcp_content_type;
195 int default_dcp_audio_channels () const {
196 return _default_dcp_audio_channels;
199 std::string dcp_issuer () const {
203 std::string dcp_creator () const {
207 std::string dcp_company_name () const {
208 return _dcp_company_name;
211 std::string dcp_product_name () const {
212 return _dcp_product_name;
215 std::string dcp_product_version () const {
216 return _dcp_product_version;
219 std::string dcp_j2k_comment () const {
220 return _dcp_j2k_comment;
223 int default_j2k_bandwidth () const {
224 return _default_j2k_bandwidth;
227 int default_audio_delay () const {
228 return _default_audio_delay;
231 bool default_interop () const {
232 return _default_interop;
235 std::map<std::string, std::string> default_metadata () const {
236 return _default_metadata;
239 bool upload_after_make_dcp () {
240 return _upload_after_make_dcp;
243 void set_default_kdm_directory (boost::filesystem::path d) {
244 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
247 _default_kdm_directory = d;
251 std::string mail_server () const {
255 int mail_port () const {
259 EmailProtocol mail_protocol () const {
260 return _mail_protocol;
263 std::string mail_user () const {
267 std::string mail_password () const {
268 return _mail_password;
271 std::string kdm_subject () const {
275 std::string kdm_from () const {
279 std::vector<std::string> kdm_cc () const {
283 std::string kdm_bcc () const {
287 std::string kdm_email () const {
291 std::string notification_subject () const {
292 return _notification_subject;
295 std::string notification_from () const {
296 return _notification_from;
299 std::string notification_to () const {
300 return _notification_to;
303 std::vector<std::string> notification_cc () const {
304 return _notification_cc;
307 std::string notification_bcc () const {
308 return _notification_bcc;
311 std::string notification_email () const {
312 return _notification_email;
315 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
316 return _signer_chain;
319 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
320 return _decryption_chain;
323 bool check_for_updates () const {
324 return _check_for_updates;
327 bool check_for_test_updates () const {
328 return _check_for_test_updates;
331 int maximum_j2k_bandwidth () const {
332 return _maximum_j2k_bandwidth;
335 int log_types () const {
339 bool analyse_ebur128 () const {
340 return _analyse_ebur128;
343 bool automatic_audio_analysis () const {
344 return _automatic_audio_analysis;
347 #ifdef DCPOMATIC_WINDOWS
348 bool win32_console () const {
349 return _win32_console;
353 std::vector<boost::filesystem::path> history () const {
357 std::vector<boost::filesystem::path> player_history () const {
358 return _player_history;
361 std::shared_ptr<DKDMGroup> dkdms () const {
365 boost::filesystem::path cinemas_file () const {
366 return _cinemas_file;
369 boost::filesystem::path dkdm_recipients_file () const {
370 return _dkdm_recipients_file;
373 bool show_hints_before_make_dcp () const {
374 return _show_hints_before_make_dcp;
377 bool confirm_kdm_email () const {
378 return _confirm_kdm_email;
381 dcp::NameFormat kdm_container_name_format () const {
382 return _kdm_container_name_format;
385 dcp::NameFormat kdm_filename_format () const {
386 return _kdm_filename_format;
389 dcp::NameFormat dkdm_filename_format () const {
390 return _dkdm_filename_format;
393 dcp::NameFormat dcp_metadata_filename_format () const {
394 return _dcp_metadata_filename_format;
397 dcp::NameFormat dcp_asset_filename_format () const {
398 return _dcp_asset_filename_format;
401 bool jump_to_selected () const {
402 return _jump_to_selected;
405 /* This could be an enum class but we use the enum a lot to index _nagged
406 * so it means a lot of casts.
410 NAG_ENCRYPTED_METADATA,
411 NAG_ALTER_DECRYPTION_CHAIN,
412 NAG_BAD_SIGNER_CHAIN_UTF8,
413 NAG_IMPORT_DECRYPTION_CHAIN,
416 NAG_TOO_MANY_DROPPED_FRAMES,
417 NAG_BAD_SIGNER_CHAIN_VALIDITY,
421 bool nagged (Nag nag) const {
425 bool sound () const {
429 std::string cover_sheet () const {
433 boost::optional<std::string> sound_output () const {
434 return _sound_output;
437 boost::optional<boost::filesystem::path> last_player_load_directory () const {
438 return _last_player_load_directory;
447 boost::optional<KDMWriteType> last_kdm_write_type () const {
448 return _last_kdm_write_type;
456 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
457 return _last_dkdm_write_type;
460 int frames_in_memory_multiplier () const {
461 return _frames_in_memory_multiplier;
464 boost::optional<int> decode_reduction () const {
465 return _decode_reduction;
468 bool default_notify () const {
469 return _default_notify;
478 bool notification (Notification n) const {
479 return _notification[n];
482 boost::optional<std::string> barco_username () const {
483 return _barco_username;
486 boost::optional<std::string> barco_password () const {
487 return _barco_password;
490 boost::optional<std::string> christie_username () const {
491 return _christie_username;
494 boost::optional<std::string> christie_password () const {
495 return _christie_password;
498 boost::optional<std::string> gdc_username () const {
499 return _gdc_username;
502 boost::optional<std::string> gdc_password () const {
503 return _gdc_password;
507 PLAYER_MODE_WINDOW, ///< one window containing image and controls
508 PLAYER_MODE_FULL, ///< just the image filling the screen
509 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
512 PlayerMode player_mode () const {
516 int image_display () const {
517 return _image_display;
525 VideoViewType video_view_type () const {
526 return _video_view_type;
529 bool respect_kdm_validity_periods () const {
530 return _respect_kdm_validity_periods;
533 boost::optional<boost::filesystem::path> player_debug_log_file () const {
534 return _player_debug_log_file;
537 boost::optional<boost::filesystem::path> player_content_directory () const {
538 return _player_content_directory;
541 boost::optional<boost::filesystem::path> player_playlist_directory () const {
542 return _player_playlist_directory;
545 boost::optional<boost::filesystem::path> player_kdm_directory () const {
546 return _player_kdm_directory;
549 AudioMapping audio_mapping (int output_channels);
551 std::vector<dcp::LanguageTag> custom_languages () const {
552 return _custom_languages;
555 boost::optional<boost::filesystem::path> add_files_path () const {
556 return _add_files_path;
559 bool use_isdcf_name_by_default () const {
560 return _use_isdcf_name_by_default;
563 bool write_kdms_to_disk () const {
564 return _write_kdms_to_disk;
567 bool email_kdms () const {
571 dcp::Formulation default_kdm_type () const {
572 return _default_kdm_type;
575 double auto_crop_threshold () const {
576 return _auto_crop_threshold;
581 void set_master_encoding_threads (int n) {
582 maybe_set (_master_encoding_threads, n);
585 void set_server_encoding_threads (int n) {
586 maybe_set (_server_encoding_threads, n);
589 void set_default_directory (boost::filesystem::path d) {
590 if (_default_directory && *_default_directory == d) {
593 _default_directory = d;
597 /** @param p New server port */
598 void set_server_port_base (int p) {
599 maybe_set (_server_port_base, p);
602 void set_only_servers_encode (bool o) {
603 maybe_set (_only_servers_encode, o);
606 void set_tms_protocol (FileTransferProtocol p) {
607 maybe_set (_tms_protocol, p);
610 /** @param i IP address of a TMS that we can copy DCPs to */
611 void set_tms_ip (std::string i) {
612 maybe_set (_tms_ip, i);
615 /** @param p Path on a TMS that we should changed DCPs to */
616 void set_tms_path (std::string p) {
617 maybe_set (_tms_path, p);
620 /** @param u User name to log into the TMS with */
621 void set_tms_user (std::string u) {
622 maybe_set (_tms_user, u);
625 /** @param p Password to log into the TMS with */
626 void set_tms_password (std::string p) {
627 maybe_set (_tms_password, p);
630 void add_cinema (std::shared_ptr<Cinema> c) {
631 _cinemas.push_back (c);
635 void remove_cinema (std::shared_ptr<Cinema> c) {
640 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
641 _dkdm_recipients.push_back (c);
642 changed (DKDM_RECIPIENTS);
645 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
646 _dkdm_recipients.remove (c);
647 changed (DKDM_RECIPIENTS);
650 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
651 maybe_set (_allowed_dcp_frame_rates, r);
654 void set_allow_any_dcp_frame_rate (bool a) {
655 maybe_set (_allow_any_dcp_frame_rate, a);
658 void set_allow_any_container (bool a) {
659 maybe_set (_allow_any_container, a);
662 void set_allow_96hhz_audio (bool a) {
663 maybe_set (_allow_96khz_audio, a);
666 void set_show_experimental_audio_processors (bool e) {
667 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
670 void set_language (std::string l) {
671 if (_language && _language.get() == l) {
678 void unset_language () {
683 _language = boost::none;
687 void set_default_still_length (int s) {
688 maybe_set (_default_still_length, s);
691 void set_default_container (Ratio const * c) {
692 maybe_set (_default_container, c);
695 void set_default_dcp_content_type (DCPContentType const * t) {
696 maybe_set (_default_dcp_content_type, t);
699 void set_default_dcp_audio_channels (int c) {
700 maybe_set (_default_dcp_audio_channels, c);
703 void set_dcp_issuer (std::string i) {
704 maybe_set (_dcp_issuer, i);
707 void set_dcp_creator (std::string c) {
708 maybe_set (_dcp_creator, c);
711 void set_dcp_company_name (std::string c) {
712 maybe_set (_dcp_company_name, c);
715 void set_dcp_product_name (std::string c) {
716 maybe_set (_dcp_product_name, c);
719 void set_dcp_product_version (std::string c) {
720 maybe_set (_dcp_product_version, c);
723 void set_dcp_j2k_comment (std::string c) {
724 maybe_set (_dcp_j2k_comment, c);
727 void set_default_j2k_bandwidth (int b) {
728 maybe_set (_default_j2k_bandwidth, b);
731 void set_default_audio_delay (int d) {
732 maybe_set (_default_audio_delay, d);
735 void set_default_interop (bool i) {
736 maybe_set (_default_interop, i);
739 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
740 maybe_set (_default_metadata, metadata);
743 void set_upload_after_make_dcp (bool u) {
744 maybe_set (_upload_after_make_dcp, u);
747 void set_mail_server (std::string s) {
748 maybe_set (_mail_server, s);
751 void set_mail_port (int p) {
752 maybe_set (_mail_port, p);
755 void set_mail_protocol (EmailProtocol p) {
756 maybe_set (_mail_protocol, p);
759 void set_mail_user (std::string u) {
760 maybe_set (_mail_user, u);
763 void set_mail_password (std::string p) {
764 maybe_set (_mail_password, p);
767 void set_kdm_subject (std::string s) {
768 maybe_set (_kdm_subject, s);
771 void set_kdm_from (std::string f) {
772 maybe_set (_kdm_from, f);
775 void set_kdm_cc (std::vector<std::string> f) {
776 maybe_set (_kdm_cc, f);
779 void set_kdm_bcc (std::string f) {
780 maybe_set (_kdm_bcc, f);
783 void set_kdm_email (std::string e) {
784 maybe_set (_kdm_email, e);
787 void reset_kdm_email ();
789 void set_notification_subject (std::string s) {
790 maybe_set (_notification_subject, s);
793 void set_notification_from (std::string f) {
794 maybe_set (_notification_from, f);
797 void set_notification_to (std::string t) {
798 maybe_set (_notification_to, t);
801 void set_notification_cc (std::vector<std::string> f) {
802 maybe_set (_notification_cc, f);
805 void set_notification_bcc (std::string f) {
806 maybe_set (_notification_bcc, f);
809 void set_notification_email (std::string e) {
810 maybe_set (_notification_email, e);
813 void reset_notification_email ();
815 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
816 maybe_set (_signer_chain, s);
819 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
820 maybe_set (_decryption_chain, c);
823 void set_check_for_updates (bool c) {
824 maybe_set (_check_for_updates, c);
826 set_check_for_test_updates (false);
830 void set_check_for_test_updates (bool c) {
831 maybe_set (_check_for_test_updates, c);
834 void set_maximum_j2k_bandwidth (int b) {
835 maybe_set (_maximum_j2k_bandwidth, b);
838 void set_log_types (int t) {
839 maybe_set (_log_types, t);
842 void set_analyse_ebur128 (bool a) {
843 maybe_set (_analyse_ebur128, a);
846 void set_automatic_audio_analysis (bool a) {
847 maybe_set (_automatic_audio_analysis, a);
850 #ifdef DCPOMATIC_WINDOWS
851 void set_win32_console (bool c) {
852 maybe_set (_win32_console, c);
856 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
861 void set_cinemas_file (boost::filesystem::path file);
863 void set_show_hints_before_make_dcp (bool s) {
864 maybe_set (_show_hints_before_make_dcp, s);
867 void set_confirm_kdm_email (bool s) {
868 maybe_set (_confirm_kdm_email, s);
871 void set_sound (bool s) {
872 maybe_set (_sound, s, SOUND);
875 void set_sound_output (std::string o) {
876 maybe_set (_sound_output, o, SOUND_OUTPUT);
879 void set_last_player_load_directory (boost::filesystem::path d) {
880 maybe_set (_last_player_load_directory, d);
883 void set_last_kdm_write_type (KDMWriteType t) {
884 maybe_set (_last_kdm_write_type, t);
887 void set_last_dkdm_write_type (DKDMWriteType t) {
888 maybe_set (_last_dkdm_write_type, t);
891 void unset_sound_output () {
892 if (!_sound_output) {
896 _sound_output = boost::none;
900 void set_kdm_container_name_format (dcp::NameFormat n) {
901 maybe_set (_kdm_container_name_format, n);
904 void set_kdm_filename_format (dcp::NameFormat n) {
905 maybe_set (_kdm_filename_format, n);
908 void set_dkdm_filename_format (dcp::NameFormat n) {
909 maybe_set (_dkdm_filename_format, n);
912 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
913 maybe_set (_dcp_metadata_filename_format, n);
916 void set_dcp_asset_filename_format (dcp::NameFormat n) {
917 maybe_set (_dcp_asset_filename_format, n);
920 void set_frames_in_memory_multiplier (int m) {
921 maybe_set (_frames_in_memory_multiplier, m);
924 void set_decode_reduction (boost::optional<int> r) {
925 maybe_set (_decode_reduction, r);
928 void set_default_notify (bool n) {
929 maybe_set (_default_notify, n);
932 void clear_history () {
937 void clear_player_history () {
938 _player_history.clear ();
942 void add_to_history (boost::filesystem::path p);
943 void clean_history ();
944 void add_to_player_history (boost::filesystem::path p);
945 void clean_player_history ();
947 void set_jump_to_selected (bool j) {
948 maybe_set (_jump_to_selected, j);
951 void set_nagged (Nag nag, bool nagged) {
952 maybe_set (_nagged[nag], nagged);
955 void set_cover_sheet (std::string s) {
956 maybe_set (_cover_sheet, s);
959 void reset_cover_sheet ();
961 void set_notification (Notification n, bool v) {
962 maybe_set (_notification[n], v);
965 void set_barco_username (std::string u) {
966 maybe_set (_barco_username, u);
969 void unset_barco_username () {
970 maybe_set (_barco_username, boost::optional<std::string>());
973 void set_barco_password (std::string p) {
974 maybe_set (_barco_password, p);
977 void unset_barco_password () {
978 maybe_set (_barco_password, boost::optional<std::string>());
981 void set_christie_username (std::string u) {
982 maybe_set (_christie_username, u);
985 void unset_christie_username () {
986 maybe_set (_christie_username, boost::optional<std::string>());
989 void set_christie_password (std::string p) {
990 maybe_set (_christie_password, p);
993 void unset_christie_password () {
994 maybe_set (_christie_password, boost::optional<std::string>());
997 void set_gdc_username (std::string u) {
998 maybe_set (_gdc_username, u);
1001 void unset_gdc_username () {
1002 maybe_set (_gdc_username, boost::optional<std::string>());
1005 void set_gdc_password (std::string p) {
1006 maybe_set (_gdc_password, p);
1009 void unset_gdc_password () {
1010 maybe_set (_gdc_password, boost::optional<std::string>());
1013 void set_player_mode (PlayerMode m) {
1014 maybe_set (_player_mode, m);
1017 void set_image_display (int n) {
1018 maybe_set (_image_display, n);
1021 void set_video_view_type (VideoViewType v) {
1022 maybe_set (_video_view_type, v);
1025 void set_respect_kdm_validity_periods (bool r) {
1026 maybe_set (_respect_kdm_validity_periods, r);
1029 void set_player_debug_log_file (boost::filesystem::path p) {
1030 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1033 void unset_player_debug_log_file () {
1034 if (!_player_debug_log_file) {
1037 _player_debug_log_file = boost::none;
1038 changed (PLAYER_DEBUG_LOG);
1041 void set_player_content_directory (boost::filesystem::path p) {
1042 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1045 void unset_player_content_directory () {
1046 if (!_player_content_directory) {
1049 _player_content_directory = boost::none;
1050 changed (PLAYER_CONTENT_DIRECTORY);
1053 void set_player_playlist_directory (boost::filesystem::path p) {
1054 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1057 void unset_player_playlist_directory () {
1058 if (!_player_playlist_directory) {
1061 _player_playlist_directory = boost::none;
1062 changed (PLAYER_PLAYLIST_DIRECTORY);
1065 void set_player_kdm_directory (boost::filesystem::path p) {
1066 maybe_set (_player_kdm_directory, p);
1069 void unset_player_kdm_directory () {
1070 if (!_player_kdm_directory) {
1073 _player_kdm_directory = boost::none;
1077 void set_audio_mapping (AudioMapping m);
1078 void set_audio_mapping_to_default ();
1080 void add_custom_language (dcp::LanguageTag tag);
1082 void set_add_files_path (boost::filesystem::path p) {
1083 _add_files_path = p;
1087 void set_use_isdcf_name_by_default (bool use) {
1088 maybe_set (_use_isdcf_name_by_default, use);
1091 void set_write_kdms_to_disk (bool write) {
1092 maybe_set (_write_kdms_to_disk, write);
1095 void set_email_kdms (bool email) {
1096 maybe_set (_email_kdms, email);
1099 void set_default_kdm_type (dcp::Formulation type) {
1100 maybe_set (_default_kdm_type, type);
1103 void set_auto_crop_threshold (double threshold) {
1104 maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
1107 void changed (Property p = OTHER);
1108 boost::signals2::signal<void (Property)> Changed;
1109 /** Emitted if read() failed on an existing Config file. There is nothing
1110 a listener can do about it: this is just for information.
1112 static boost::signals2::signal<void ()> FailedToLoad;
1113 /** Emitted if read() issued a warning which the user might want to know about */
1114 static boost::signals2::signal<void (std::string)> Warning;
1115 /** Emitted if there is a something wrong the contents of our config. Handler can call
1116 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1119 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1120 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1121 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1122 BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
1125 static boost::signals2::signal<bool (BadReason)> Bad;
1127 void write () const override;
1128 void write_config () const;
1129 void write_cinemas () const;
1130 void write_dkdm_recipients () const;
1131 void link (boost::filesystem::path new_file) const;
1132 void copy_and_link (boost::filesystem::path new_file) const;
1133 bool have_write_permission () const;
1135 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1136 bool existing_template (std::string name) const;
1137 std::list<std::string> templates () const;
1138 boost::filesystem::path template_read_path (std::string name) const;
1139 boost::filesystem::path template_write_path (std::string name) const;
1140 void rename_template (std::string old_name, std::string new_name) const;
1141 void delete_template (std::string name) const;
1143 boost::optional<BadReason> check_certificates () const;
1145 static Config* instance ();
1146 static void drop ();
1147 static void restore_defaults ();
1148 static bool have_existing (std::string);
1149 static boost::filesystem::path config_read_file ();
1150 static boost::filesystem::path config_write_file ();
1154 void read () override;
1155 void set_defaults ();
1156 void set_kdm_email_to_default ();
1157 void set_notification_email_to_default ();
1158 void set_cover_sheet_to_default ();
1159 void read_cinemas (cxml::Document const & f);
1160 void read_dkdm_recipients (cxml::Document const & f);
1161 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1162 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1163 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1164 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1168 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1169 if (member == new_value) {
1177 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1178 if (member && member.get() == new_value) {
1185 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1186 int _master_encoding_threads;
1187 /** number of threads which a server should use for J2K encoding on the local machine */
1188 int _server_encoding_threads;
1189 /** default directory to put new films in */
1190 boost::optional<boost::filesystem::path> _default_directory;
1191 /** base port number to use for J2K encoding servers;
1192 * this port and the two above it will be used.
1194 int _server_port_base;
1195 /** true to broadcast on the `any' address to look for servers */
1196 bool _use_any_servers;
1197 /** J2K encoding servers that should definitely be used */
1198 std::vector<std::string> _servers;
1199 bool _only_servers_encode;
1200 FileTransferProtocol _tms_protocol;
1201 /** The IP address of a TMS that we can copy DCPs to */
1202 std::string _tms_ip;
1203 /** The path on a TMS that we should write DCPs to */
1204 std::string _tms_path;
1205 /** User name to log into the TMS with */
1206 std::string _tms_user;
1207 /** Password to log into the TMS with */
1208 std::string _tms_password;
1209 /** The list of possible DCP frame rates that DCP-o-matic will use */
1210 std::list<int> _allowed_dcp_frame_rates;
1211 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1212 bool _allow_any_dcp_frame_rate;
1213 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1214 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1215 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1217 bool _allow_any_container;
1218 bool _allow_96khz_audio;
1219 /** Offer the upmixers in the audio processor settings */
1220 bool _show_experimental_audio_processors;
1221 boost::optional<std::string> _language;
1222 /** Default length of still image content (seconds) */
1223 int _default_still_length;
1224 Ratio const * _default_container;
1225 DCPContentType const * _default_dcp_content_type;
1226 int _default_dcp_audio_channels;
1227 std::string _dcp_issuer;
1228 std::string _dcp_creator;
1229 std::string _dcp_company_name;
1230 std::string _dcp_product_name;
1231 std::string _dcp_product_version;
1232 std::string _dcp_j2k_comment;
1233 int _default_j2k_bandwidth;
1234 int _default_audio_delay;
1235 bool _default_interop;
1236 std::map<std::string, std::string> _default_metadata;
1237 /** Default directory to offer to write KDMs to; if it's not set,
1238 the home directory will be offered.
1240 boost::optional<boost::filesystem::path> _default_kdm_directory;
1241 bool _upload_after_make_dcp;
1242 std::list<std::shared_ptr<Cinema>> _cinemas;
1243 std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
1244 std::string _mail_server;
1246 EmailProtocol _mail_protocol;
1247 std::string _mail_user;
1248 std::string _mail_password;
1249 std::string _kdm_subject;
1250 std::string _kdm_from;
1251 std::vector<std::string> _kdm_cc;
1252 std::string _kdm_bcc;
1253 std::string _kdm_email;
1254 std::string _notification_subject;
1255 std::string _notification_from;
1256 std::string _notification_to;
1257 std::vector<std::string> _notification_cc;
1258 std::string _notification_bcc;
1259 std::string _notification_email;
1260 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1261 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1262 * certificate for making KDMs given to DCP-o-matic.
1264 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1265 /** true to check for updates on startup */
1266 bool _check_for_updates;
1267 bool _check_for_test_updates;
1268 /** maximum allowed J2K bandwidth in bits per second */
1269 int _maximum_j2k_bandwidth;
1271 bool _analyse_ebur128;
1272 bool _automatic_audio_analysis;
1273 #ifdef DCPOMATIC_WINDOWS
1274 bool _win32_console;
1276 std::vector<boost::filesystem::path> _history;
1277 std::vector<boost::filesystem::path> _player_history;
1278 std::shared_ptr<DKDMGroup> _dkdms;
1279 boost::filesystem::path _cinemas_file;
1280 boost::filesystem::path _dkdm_recipients_file;
1281 bool _show_hints_before_make_dcp;
1282 bool _confirm_kdm_email;
1283 dcp::NameFormat _kdm_filename_format;
1284 dcp::NameFormat _dkdm_filename_format;
1285 dcp::NameFormat _kdm_container_name_format;
1286 dcp::NameFormat _dcp_metadata_filename_format;
1287 dcp::NameFormat _dcp_asset_filename_format;
1288 bool _jump_to_selected;
1289 bool _nagged[NAG_COUNT];
1291 /** name of a specific sound output stream to use, or empty to use the default */
1292 boost::optional<std::string> _sound_output;
1293 std::string _cover_sheet;
1294 boost::optional<boost::filesystem::path> _last_player_load_directory;
1295 boost::optional<KDMWriteType> _last_kdm_write_type;
1296 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1297 int _frames_in_memory_multiplier;
1298 boost::optional<int> _decode_reduction;
1299 bool _default_notify;
1300 bool _notification[NOTIFICATION_COUNT];
1301 boost::optional<std::string> _barco_username;
1302 boost::optional<std::string> _barco_password;
1303 boost::optional<std::string> _christie_username;
1304 boost::optional<std::string> _christie_password;
1305 boost::optional<std::string> _gdc_username;
1306 boost::optional<std::string> _gdc_password;
1307 PlayerMode _player_mode;
1309 VideoViewType _video_view_type;
1310 bool _respect_kdm_validity_periods;
1311 /** Log file containing debug information for the player */
1312 boost::optional<boost::filesystem::path> _player_debug_log_file;
1313 /** A directory containing DCPs whose contents are presented to the user
1314 in the dual-screen player mode. DCPs on the list can be loaded
1317 boost::optional<boost::filesystem::path> _player_content_directory;
1318 boost::optional<boost::filesystem::path> _player_playlist_directory;
1319 boost::optional<boost::filesystem::path> _player_kdm_directory;
1320 boost::optional<AudioMapping> _audio_mapping;
1321 std::vector<dcp::LanguageTag> _custom_languages;
1322 boost::optional<boost::filesystem::path> _add_files_path;
1323 bool _use_isdcf_name_by_default;
1324 bool _write_kdms_to_disk;
1326 dcp::Formulation _default_kdm_type;
1327 double _auto_crop_threshold;
1329 static int const _current_version;
1331 /** Singleton instance, or 0 */
1332 static Config* _instance;