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,
97 ISDCF_NAME_PART_LENGTH,
101 /** @return base port number to use for J2K encoding servers */
102 int server_port_base () const {
103 return _server_port_base;
106 void set_use_any_servers (bool u) {
107 _use_any_servers = u;
108 changed (USE_ANY_SERVERS);
111 bool use_any_servers () const {
112 return _use_any_servers;
115 /** @param s New list of servers */
116 void set_servers (std::vector<std::string> s) {
121 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
122 std::vector<std::string> servers () const {
126 bool only_servers_encode () const {
127 return _only_servers_encode;
130 FileTransferProtocol tms_protocol () const {
131 return _tms_protocol;
134 bool tms_passive() const {
138 /** @return The IP address of a TMS that we can copy DCPs to */
139 std::string tms_ip () const {
143 /** @return The path on a TMS that we should changed DCPs to */
144 std::string tms_path () const {
148 /** @return User name to log into the TMS with */
149 std::string tms_user () const {
153 /** @return Password to log into the TMS with */
154 std::string tms_password () const {
155 return _tms_password;
158 std::list<std::shared_ptr<Cinema>> cinemas () const {
162 std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const {
163 return _dkdm_recipients;
166 std::list<int> allowed_dcp_frame_rates () const {
167 return _allowed_dcp_frame_rates;
170 bool allow_any_dcp_frame_rate () const {
171 return _allow_any_dcp_frame_rate;
174 bool allow_any_container () const {
175 return _allow_any_container;
178 bool allow_96khz_audio () const {
179 return _allow_96khz_audio;
182 bool use_all_audio_channels () const {
183 return _use_all_audio_channels;
186 bool show_experimental_audio_processors () const {
187 return _show_experimental_audio_processors;
190 boost::optional<std::string> language () const {
194 int default_still_length () const {
195 return _default_still_length;
198 DCPContentType const * default_dcp_content_type () const {
199 return _default_dcp_content_type;
202 int default_dcp_audio_channels () const {
203 return _default_dcp_audio_channels;
206 std::string dcp_issuer () const {
210 std::string dcp_creator () const {
214 std::string dcp_company_name () const {
215 return _dcp_company_name;
218 std::string dcp_product_name () const {
219 return _dcp_product_name;
222 std::string dcp_product_version () const {
223 return _dcp_product_version;
226 std::string dcp_j2k_comment () const {
227 return _dcp_j2k_comment;
230 int default_j2k_bandwidth () const {
231 return _default_j2k_bandwidth;
234 int default_audio_delay () const {
235 return _default_audio_delay;
238 bool default_interop () const {
239 return _default_interop;
242 boost::optional<dcp::LanguageTag> default_audio_language() const {
243 return _default_audio_language;
246 boost::optional<dcp::LanguageTag::RegionSubtag> default_territory() const {
247 return _default_territory;
250 std::map<std::string, std::string> default_metadata () const {
251 return _default_metadata;
254 bool upload_after_make_dcp () {
255 return _upload_after_make_dcp;
258 void set_default_kdm_directory (boost::filesystem::path d) {
259 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
262 _default_kdm_directory = d;
266 std::string mail_server () const {
270 int mail_port () const {
274 EmailProtocol mail_protocol () const {
275 return _mail_protocol;
278 std::string mail_user () const {
282 std::string mail_password () const {
283 return _mail_password;
286 std::string kdm_subject () const {
290 std::string kdm_from () const {
294 std::vector<std::string> kdm_cc () const {
298 std::string kdm_bcc () const {
302 std::string kdm_email () const {
306 std::string notification_subject () const {
307 return _notification_subject;
310 std::string notification_from () const {
311 return _notification_from;
314 std::string notification_to () const {
315 return _notification_to;
318 std::vector<std::string> notification_cc () const {
319 return _notification_cc;
322 std::string notification_bcc () const {
323 return _notification_bcc;
326 std::string notification_email () const {
327 return _notification_email;
330 std::shared_ptr<const dcp::CertificateChain> signer_chain () const {
331 return _signer_chain;
334 std::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
335 return _decryption_chain;
338 bool check_for_updates () const {
339 return _check_for_updates;
342 bool check_for_test_updates () const {
343 return _check_for_test_updates;
346 int maximum_j2k_bandwidth () const {
347 return _maximum_j2k_bandwidth;
350 int log_types () const {
354 bool analyse_ebur128 () const {
355 return _analyse_ebur128;
358 bool automatic_audio_analysis () const {
359 return _automatic_audio_analysis;
362 #ifdef DCPOMATIC_WINDOWS
363 bool win32_console () const {
364 return _win32_console;
368 std::vector<boost::filesystem::path> history () const {
372 std::vector<boost::filesystem::path> player_history () const {
373 return _player_history;
376 std::shared_ptr<DKDMGroup> dkdms () const {
380 boost::filesystem::path cinemas_file () const {
381 return _cinemas_file;
384 boost::filesystem::path dkdm_recipients_file () const {
385 return _dkdm_recipients_file;
388 bool show_hints_before_make_dcp () const {
389 return _show_hints_before_make_dcp;
392 bool confirm_kdm_email () const {
393 return _confirm_kdm_email;
396 dcp::NameFormat kdm_container_name_format () const {
397 return _kdm_container_name_format;
400 dcp::NameFormat kdm_filename_format () const {
401 return _kdm_filename_format;
404 dcp::NameFormat dkdm_filename_format () const {
405 return _dkdm_filename_format;
408 dcp::NameFormat dcp_metadata_filename_format () const {
409 return _dcp_metadata_filename_format;
412 dcp::NameFormat dcp_asset_filename_format () const {
413 return _dcp_asset_filename_format;
416 bool jump_to_selected () const {
417 return _jump_to_selected;
420 /* This could be an enum class but we use the enum a lot to index _nagged
421 * so it means a lot of casts.
425 NAG_ENCRYPTED_METADATA,
426 NAG_ALTER_DECRYPTION_CHAIN,
427 NAG_BAD_SIGNER_CHAIN_UTF8,
428 NAG_IMPORT_DECRYPTION_CHAIN,
431 NAG_TOO_MANY_DROPPED_FRAMES,
432 NAG_BAD_SIGNER_CHAIN_VALIDITY,
436 bool nagged (Nag nag) const {
440 bool sound () const {
444 std::string cover_sheet () const {
448 boost::optional<std::string> sound_output () const {
449 return _sound_output;
452 boost::optional<boost::filesystem::path> last_player_load_directory () const {
453 return _last_player_load_directory;
462 boost::optional<KDMWriteType> last_kdm_write_type () const {
463 return _last_kdm_write_type;
471 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
472 return _last_dkdm_write_type;
475 int frames_in_memory_multiplier () const {
476 return _frames_in_memory_multiplier;
479 boost::optional<int> decode_reduction () const {
480 return _decode_reduction;
483 bool default_notify () const {
484 return _default_notify;
493 bool notification (Notification n) const {
494 return _notification[n];
497 boost::optional<std::string> barco_username () const {
498 return _barco_username;
501 boost::optional<std::string> barco_password () const {
502 return _barco_password;
505 boost::optional<std::string> christie_username () const {
506 return _christie_username;
509 boost::optional<std::string> christie_password () const {
510 return _christie_password;
513 boost::optional<std::string> gdc_username () const {
514 return _gdc_username;
517 boost::optional<std::string> gdc_password () const {
518 return _gdc_password;
522 PLAYER_MODE_WINDOW, ///< one window containing image and controls
523 PLAYER_MODE_FULL, ///< just the image filling the screen
524 PLAYER_MODE_DUAL ///< image on one monitor and extended controls on the other
527 PlayerMode player_mode () const {
531 int image_display () const {
532 return _image_display;
540 VideoViewType video_view_type () const {
541 return _video_view_type;
544 bool respect_kdm_validity_periods () const {
545 return _respect_kdm_validity_periods;
548 boost::optional<boost::filesystem::path> player_debug_log_file () const {
549 return _player_debug_log_file;
552 boost::optional<boost::filesystem::path> player_content_directory () const {
553 return _player_content_directory;
556 boost::optional<boost::filesystem::path> player_playlist_directory () const {
557 return _player_playlist_directory;
560 boost::optional<boost::filesystem::path> player_kdm_directory () const {
561 return _player_kdm_directory;
564 AudioMapping audio_mapping (int output_channels);
566 std::vector<dcp::LanguageTag> custom_languages () const {
567 return _custom_languages;
570 boost::optional<boost::filesystem::path> initial_path(std::string id) const;
572 bool use_isdcf_name_by_default () const {
573 return _use_isdcf_name_by_default;
576 bool write_kdms_to_disk () const {
577 return _write_kdms_to_disk;
580 bool email_kdms () const {
584 dcp::Formulation default_kdm_type () const {
585 return _default_kdm_type;
588 RoughDuration default_kdm_duration () const {
589 return _default_kdm_duration;
592 double auto_crop_threshold () const {
593 return _auto_crop_threshold;
596 boost::optional<std::string> last_release_notes_version () const {
597 return _last_release_notes_version;
600 boost::optional<int> main_divider_sash_position() const {
601 return _main_divider_sash_position;
604 boost::optional<int> main_content_divider_sash_position() const {
605 return _main_content_divider_sash_position;
608 enum class DefaultAddFileLocation {
613 DefaultAddFileLocation default_add_file_location() const {
614 return _default_add_file_location;
617 bool allow_smpte_bv20() const {
618 return _allow_smpte_bv20;
621 std::string gpu_binary_location () const {
622 return _gpu_binary_location;
625 bool enable_gpu () const {
629 int selected_gpu () const {
630 return _selected_gpu;
632 std::string gpu_license_server () const {
633 return _gpu_license_server;
636 int gpu_license_port () const {
637 return _gpu_license_port;
639 std::string gpu_license () const {
643 int isdcf_name_part_length() const {
644 return _isdcf_name_part_length;
649 void set_master_encoding_threads (int n) {
650 maybe_set (_master_encoding_threads, n);
653 void set_server_encoding_threads (int n) {
654 maybe_set (_server_encoding_threads, n);
657 void set_default_directory (boost::filesystem::path d) {
658 if (_default_directory && *_default_directory == d) {
661 _default_directory = d;
665 /** @param p New server port */
666 void set_server_port_base (int p) {
667 maybe_set (_server_port_base, p);
670 void set_only_servers_encode (bool o) {
671 maybe_set (_only_servers_encode, o);
674 void set_tms_protocol (FileTransferProtocol p) {
675 maybe_set (_tms_protocol, p);
678 void set_tms_passive(bool passive) {
679 maybe_set(_tms_passive, passive);
682 /** @param i IP address of a TMS that we can copy DCPs to */
683 void set_tms_ip (std::string i) {
684 maybe_set (_tms_ip, i);
687 /** @param p Path on a TMS that we should changed DCPs to */
688 void set_tms_path (std::string p) {
689 maybe_set (_tms_path, p);
692 /** @param u User name to log into the TMS with */
693 void set_tms_user (std::string u) {
694 maybe_set (_tms_user, u);
697 /** @param p Password to log into the TMS with */
698 void set_tms_password (std::string p) {
699 maybe_set (_tms_password, p);
702 void add_cinema (std::shared_ptr<Cinema> c) {
703 _cinemas.push_back (c);
707 void remove_cinema (std::shared_ptr<Cinema> c) {
712 void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
713 _dkdm_recipients.push_back (c);
714 changed (DKDM_RECIPIENTS);
717 void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) {
718 _dkdm_recipients.remove (c);
719 changed (DKDM_RECIPIENTS);
722 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
723 maybe_set (_allowed_dcp_frame_rates, r);
726 void set_allow_any_dcp_frame_rate (bool a) {
727 maybe_set (_allow_any_dcp_frame_rate, a);
730 void set_allow_any_container (bool a) {
731 maybe_set (_allow_any_container, a);
734 void set_allow_96hhz_audio (bool a) {
735 maybe_set (_allow_96khz_audio, a);
738 void set_use_all_audio_channels (bool a) {
739 maybe_set (_use_all_audio_channels, a);
742 void set_show_experimental_audio_processors (bool e) {
743 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
746 void set_language (std::string l) {
747 if (_language && _language.get() == l) {
754 void unset_language () {
759 _language = boost::none;
763 void set_default_still_length (int s) {
764 maybe_set (_default_still_length, s);
767 void set_default_dcp_content_type (DCPContentType const * t) {
768 maybe_set (_default_dcp_content_type, t);
771 void set_default_dcp_audio_channels (int c) {
772 maybe_set (_default_dcp_audio_channels, c);
775 void set_dcp_issuer (std::string i) {
776 maybe_set (_dcp_issuer, i);
779 void set_dcp_creator (std::string c) {
780 maybe_set (_dcp_creator, c);
783 void set_dcp_company_name (std::string c) {
784 maybe_set (_dcp_company_name, c);
787 void set_dcp_product_name (std::string c) {
788 maybe_set (_dcp_product_name, c);
791 void set_dcp_product_version (std::string c) {
792 maybe_set (_dcp_product_version, c);
795 void set_dcp_j2k_comment (std::string c) {
796 maybe_set (_dcp_j2k_comment, c);
799 void set_default_j2k_bandwidth (int b) {
800 maybe_set (_default_j2k_bandwidth, b);
803 void set_default_audio_delay (int d) {
804 maybe_set (_default_audio_delay, d);
807 void set_default_interop (bool i) {
808 maybe_set (_default_interop, i);
811 void set_default_audio_language(dcp::LanguageTag tag) {
812 maybe_set(_default_audio_language, tag);
815 void unset_default_audio_language() {
816 maybe_set(_default_audio_language, boost::optional<dcp::LanguageTag>());
819 void set_default_territory(dcp::LanguageTag::RegionSubtag tag) {
820 maybe_set(_default_territory, tag);
823 void unset_default_territory() {
824 maybe_set(_default_territory, boost::optional<dcp::LanguageTag::RegionSubtag>());
827 void set_default_metadata (std::map<std::string, std::string> const& metadata) {
828 maybe_set (_default_metadata, metadata);
831 void set_upload_after_make_dcp (bool u) {
832 maybe_set (_upload_after_make_dcp, u);
835 void set_mail_server (std::string s) {
836 maybe_set (_mail_server, s);
839 void set_mail_port (int p) {
840 maybe_set (_mail_port, p);
843 void set_mail_protocol (EmailProtocol p) {
844 maybe_set (_mail_protocol, p);
847 void set_mail_user (std::string u) {
848 maybe_set (_mail_user, u);
851 void set_mail_password (std::string p) {
852 maybe_set (_mail_password, p);
855 void set_kdm_subject (std::string s) {
856 maybe_set (_kdm_subject, s);
859 void set_kdm_from (std::string f) {
860 maybe_set (_kdm_from, f);
863 void set_kdm_cc (std::vector<std::string> f) {
864 maybe_set (_kdm_cc, f);
867 void set_kdm_bcc (std::string f) {
868 maybe_set (_kdm_bcc, f);
871 void set_kdm_email (std::string e) {
872 maybe_set (_kdm_email, e);
875 void reset_kdm_email ();
877 void set_notification_subject (std::string s) {
878 maybe_set (_notification_subject, s);
881 void set_notification_from (std::string f) {
882 maybe_set (_notification_from, f);
885 void set_notification_to (std::string t) {
886 maybe_set (_notification_to, t);
889 void set_notification_cc (std::vector<std::string> f) {
890 maybe_set (_notification_cc, f);
893 void set_notification_bcc (std::string f) {
894 maybe_set (_notification_bcc, f);
897 void set_notification_email (std::string e) {
898 maybe_set (_notification_email, e);
901 void reset_notification_email ();
903 void set_signer_chain (std::shared_ptr<const dcp::CertificateChain> s) {
904 maybe_set (_signer_chain, s);
907 void set_decryption_chain (std::shared_ptr<const dcp::CertificateChain> c) {
908 maybe_set (_decryption_chain, c);
911 void set_check_for_updates (bool c) {
912 maybe_set (_check_for_updates, c);
914 set_check_for_test_updates (false);
918 void set_check_for_test_updates (bool c) {
919 maybe_set (_check_for_test_updates, c);
922 void set_maximum_j2k_bandwidth (int b) {
923 maybe_set (_maximum_j2k_bandwidth, b);
926 void set_log_types (int t) {
927 maybe_set (_log_types, t);
930 void set_analyse_ebur128 (bool a) {
931 maybe_set (_analyse_ebur128, a);
934 void set_automatic_audio_analysis (bool a) {
935 maybe_set (_automatic_audio_analysis, a);
938 #ifdef DCPOMATIC_WINDOWS
939 void set_win32_console (bool c) {
940 maybe_set (_win32_console, c);
944 void set_dkdms (std::shared_ptr<DKDMGroup> dkdms) {
949 void set_cinemas_file (boost::filesystem::path file);
951 void set_show_hints_before_make_dcp (bool s) {
952 maybe_set (_show_hints_before_make_dcp, s);
955 void set_confirm_kdm_email (bool s) {
956 maybe_set (_confirm_kdm_email, s);
959 void set_sound (bool s) {
960 maybe_set (_sound, s, SOUND);
963 void set_sound_output (std::string o) {
964 maybe_set (_sound_output, o, SOUND_OUTPUT);
967 void set_last_player_load_directory (boost::filesystem::path d) {
968 maybe_set (_last_player_load_directory, d);
971 void set_last_kdm_write_type (KDMWriteType t) {
972 maybe_set (_last_kdm_write_type, t);
975 void set_last_dkdm_write_type (DKDMWriteType t) {
976 maybe_set (_last_dkdm_write_type, t);
979 void unset_sound_output () {
980 if (!_sound_output) {
984 _sound_output = boost::none;
988 void set_kdm_container_name_format (dcp::NameFormat n) {
989 maybe_set (_kdm_container_name_format, n);
992 void set_kdm_filename_format (dcp::NameFormat n) {
993 maybe_set (_kdm_filename_format, n);
996 void set_dkdm_filename_format (dcp::NameFormat n) {
997 maybe_set (_dkdm_filename_format, n);
1000 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
1001 maybe_set (_dcp_metadata_filename_format, n);
1004 void set_dcp_asset_filename_format (dcp::NameFormat n) {
1005 maybe_set (_dcp_asset_filename_format, n);
1008 void set_frames_in_memory_multiplier (int m) {
1009 maybe_set (_frames_in_memory_multiplier, m);
1012 void set_decode_reduction (boost::optional<int> r) {
1013 maybe_set (_decode_reduction, r);
1016 void set_default_notify (bool n) {
1017 maybe_set (_default_notify, n);
1020 void clear_history () {
1025 void clear_player_history () {
1026 _player_history.clear ();
1030 void add_to_history (boost::filesystem::path p);
1031 void clean_history ();
1032 void add_to_player_history (boost::filesystem::path p);
1033 void clean_player_history ();
1035 void set_jump_to_selected (bool j) {
1036 maybe_set (_jump_to_selected, j);
1039 void set_nagged (Nag nag, bool nagged) {
1040 maybe_set (_nagged[nag], nagged);
1043 void set_cover_sheet (std::string s) {
1044 maybe_set (_cover_sheet, s);
1047 void reset_cover_sheet ();
1049 void set_notification (Notification n, bool v) {
1050 maybe_set (_notification[n], v);
1053 void set_barco_username (std::string u) {
1054 maybe_set (_barco_username, u);
1057 void unset_barco_username () {
1058 maybe_set (_barco_username, boost::optional<std::string>());
1061 void set_barco_password (std::string p) {
1062 maybe_set (_barco_password, p);
1065 void unset_barco_password () {
1066 maybe_set (_barco_password, boost::optional<std::string>());
1069 void set_christie_username (std::string u) {
1070 maybe_set (_christie_username, u);
1073 void unset_christie_username () {
1074 maybe_set (_christie_username, boost::optional<std::string>());
1077 void set_christie_password (std::string p) {
1078 maybe_set (_christie_password, p);
1081 void unset_christie_password () {
1082 maybe_set (_christie_password, boost::optional<std::string>());
1085 void set_gdc_username (std::string u) {
1086 maybe_set (_gdc_username, u);
1089 void unset_gdc_username () {
1090 maybe_set (_gdc_username, boost::optional<std::string>());
1093 void set_gdc_password (std::string p) {
1094 maybe_set (_gdc_password, p);
1097 void unset_gdc_password () {
1098 maybe_set (_gdc_password, boost::optional<std::string>());
1101 void set_player_mode (PlayerMode m) {
1102 maybe_set (_player_mode, m);
1105 void set_image_display (int n) {
1106 maybe_set (_image_display, n);
1109 void set_video_view_type (VideoViewType v) {
1110 maybe_set (_video_view_type, v);
1113 void set_respect_kdm_validity_periods (bool r) {
1114 maybe_set (_respect_kdm_validity_periods, r);
1117 void set_player_debug_log_file (boost::filesystem::path p) {
1118 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
1121 void unset_player_debug_log_file () {
1122 if (!_player_debug_log_file) {
1125 _player_debug_log_file = boost::none;
1126 changed (PLAYER_DEBUG_LOG);
1129 void set_player_content_directory (boost::filesystem::path p) {
1130 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1133 void unset_player_content_directory () {
1134 if (!_player_content_directory) {
1137 _player_content_directory = boost::none;
1138 changed (PLAYER_CONTENT_DIRECTORY);
1141 void set_player_playlist_directory (boost::filesystem::path p) {
1142 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1145 void unset_player_playlist_directory () {
1146 if (!_player_playlist_directory) {
1149 _player_playlist_directory = boost::none;
1150 changed (PLAYER_PLAYLIST_DIRECTORY);
1153 void set_player_kdm_directory (boost::filesystem::path p) {
1154 maybe_set (_player_kdm_directory, p);
1157 void unset_player_kdm_directory () {
1158 if (!_player_kdm_directory) {
1161 _player_kdm_directory = boost::none;
1165 void set_audio_mapping (AudioMapping m);
1166 void set_audio_mapping_to_default ();
1168 void add_custom_language (dcp::LanguageTag tag);
1170 void set_initial_path(std::string id, boost::filesystem::path path);
1172 void set_use_isdcf_name_by_default (bool use) {
1173 maybe_set (_use_isdcf_name_by_default, use);
1176 void set_write_kdms_to_disk (bool write) {
1177 maybe_set (_write_kdms_to_disk, write);
1180 void set_email_kdms (bool email) {
1181 maybe_set (_email_kdms, email);
1184 void set_default_kdm_type (dcp::Formulation type) {
1185 maybe_set (_default_kdm_type, type);
1188 void set_default_kdm_duration (RoughDuration duration) {
1189 maybe_set (_default_kdm_duration, duration);
1192 void set_auto_crop_threshold (double threshold) {
1193 maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD);
1196 void set_last_release_notes_version (std::string version) {
1197 maybe_set (_last_release_notes_version, version);
1200 void unset_last_release_notes_version() {
1201 maybe_set(_last_release_notes_version, boost::optional<std::string>());
1204 ExportConfig& export_config() {
1208 void set_main_divider_sash_position(int position) {
1209 maybe_set(_main_divider_sash_position, position);
1212 void set_main_content_divider_sash_position(int position) {
1213 maybe_set(_main_content_divider_sash_position, position);
1216 void set_default_add_file_location(DefaultAddFileLocation location) {
1217 maybe_set(_default_add_file_location, location);
1220 void set_allow_smpte_bv20(bool allow) {
1221 maybe_set(_allow_smpte_bv20, allow, ALLOW_SMPTE_BV20);
1223 void set_gpu_binary_location (std::string location) {
1224 maybe_set (_gpu_binary_location, location);
1226 void set_enable_gpu (bool enable) {
1227 maybe_set (_enable_gpu, enable);
1229 void set_selected_gpu (int selected) {
1230 maybe_set (_selected_gpu, selected);
1232 void set_gpu_license_server (std::string s) {
1233 maybe_set (_gpu_license_server, s);
1235 void set_gpu_license_port (int p) {
1236 maybe_set (_gpu_license_port, p);
1238 void set_gpu_license (std::string p) {
1239 maybe_set (_gpu_license, p);
1241 void set_isdcf_name_part_length(int length) {
1242 maybe_set(_isdcf_name_part_length, length, ISDCF_NAME_PART_LENGTH);
1246 void changed (Property p = OTHER);
1247 boost::signals2::signal<void (Property)> Changed;
1248 /** Emitted if read() failed on an existing Config file. There is nothing
1249 a listener can do about it: this is just for information.
1251 enum class LoadFailure {
1256 static boost::signals2::signal<void (LoadFailure)> FailedToLoad;
1257 /** Emitted if read() issued a warning which the user might want to know about */
1258 static boost::signals2::signal<void (std::string)> Warning;
1259 /** Emitted if there is a something wrong the contents of our config. Handler can call
1260 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1263 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1264 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1265 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1266 BAD_SIGNER_VALIDITY_TOO_LONG, ///< signer certificate validity periods are >10 years
1269 static boost::signals2::signal<bool (BadReason)> Bad;
1271 void write () const override;
1272 void write_config () const;
1273 void write_cinemas () const;
1274 void write_dkdm_recipients () const;
1275 void link (boost::filesystem::path new_file) const;
1276 void copy_and_link (boost::filesystem::path new_file) const;
1277 bool have_write_permission () const;
1279 void save_template (std::shared_ptr<const Film> film, std::string name) const;
1280 bool existing_template (std::string name) const;
1281 std::list<std::string> templates () const;
1282 boost::filesystem::path template_read_path (std::string name) const;
1283 boost::filesystem::path template_write_path (std::string name) const;
1284 void rename_template (std::string old_name, std::string new_name) const;
1285 void delete_template (std::string name) const;
1287 boost::optional<BadReason> check_certificates () const;
1289 static Config* instance ();
1290 static void drop ();
1291 static void restore_defaults ();
1292 static bool have_existing (std::string);
1293 static boost::filesystem::path config_read_file ();
1294 static boost::filesystem::path config_write_file ();
1297 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1298 if (member == new_value) {
1306 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1307 if (member && member.get() == new_value) {
1316 void read () override;
1318 void read_cinemas();
1319 void read_dkdm_recipients();
1320 void set_defaults ();
1321 void set_kdm_email_to_default ();
1322 void set_notification_email_to_default ();
1323 void set_cover_sheet_to_default ();
1324 void read_cinemas (cxml::Document const & f);
1325 void read_dkdm_recipients (cxml::Document const & f);
1326 std::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1327 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1328 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1329 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1332 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1333 int _master_encoding_threads;
1334 /** number of threads which a server should use for J2K encoding on the local machine */
1335 int _server_encoding_threads;
1336 /** default directory to put new films in */
1337 boost::optional<boost::filesystem::path> _default_directory;
1338 /** base port number to use for J2K encoding servers;
1339 * this port and the two above it will be used.
1341 int _server_port_base;
1342 /** true to broadcast on the `any' address to look for servers */
1343 bool _use_any_servers;
1344 /** J2K encoding servers that should definitely be used */
1345 std::vector<std::string> _servers;
1346 bool _only_servers_encode;
1347 FileTransferProtocol _tms_protocol;
1349 /** The IP address of a TMS that we can copy DCPs to */
1350 std::string _tms_ip;
1351 /** The path on a TMS that we should write DCPs to */
1352 std::string _tms_path;
1353 /** User name to log into the TMS with */
1354 std::string _tms_user;
1355 /** Password to log into the TMS with */
1356 std::string _tms_password;
1357 /** The list of possible DCP frame rates that DCP-o-matic will use */
1358 std::list<int> _allowed_dcp_frame_rates;
1359 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1360 bool _allow_any_dcp_frame_rate;
1361 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1362 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1363 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1365 bool _allow_any_container;
1366 bool _allow_96khz_audio;
1367 bool _use_all_audio_channels;
1368 /** Offer the upmixers in the audio processor settings */
1369 bool _show_experimental_audio_processors;
1370 boost::optional<std::string> _language;
1371 /** Default length of still image content (seconds) */
1372 int _default_still_length;
1373 DCPContentType const * _default_dcp_content_type;
1374 int _default_dcp_audio_channels;
1375 std::string _dcp_issuer;
1376 std::string _dcp_creator;
1377 std::string _dcp_company_name;
1378 std::string _dcp_product_name;
1379 std::string _dcp_product_version;
1380 std::string _dcp_j2k_comment;
1381 int _default_j2k_bandwidth;
1382 int _default_audio_delay;
1383 bool _default_interop;
1384 boost::optional<dcp::LanguageTag> _default_audio_language;
1385 boost::optional<dcp::LanguageTag::RegionSubtag> _default_territory;
1386 std::map<std::string, std::string> _default_metadata;
1387 /** Default directory to offer to write KDMs to; if it's not set,
1388 the home directory will be offered.
1390 boost::optional<boost::filesystem::path> _default_kdm_directory;
1391 bool _upload_after_make_dcp;
1392 std::list<std::shared_ptr<Cinema>> _cinemas;
1393 std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients;
1394 std::string _mail_server;
1396 EmailProtocol _mail_protocol;
1397 std::string _mail_user;
1398 std::string _mail_password;
1399 std::string _kdm_subject;
1400 std::string _kdm_from;
1401 std::vector<std::string> _kdm_cc;
1402 std::string _kdm_bcc;
1403 std::string _kdm_email;
1404 std::string _notification_subject;
1405 std::string _notification_from;
1406 std::string _notification_to;
1407 std::vector<std::string> _notification_cc;
1408 std::string _notification_bcc;
1409 std::string _notification_email;
1410 std::shared_ptr<const dcp::CertificateChain> _signer_chain;
1411 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1412 * certificate for making KDMs given to DCP-o-matic.
1414 std::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1415 /** true to check for updates on startup */
1416 bool _check_for_updates;
1417 bool _check_for_test_updates;
1418 /** maximum allowed J2K bandwidth in bits per second */
1419 int _maximum_j2k_bandwidth;
1421 bool _analyse_ebur128;
1422 bool _automatic_audio_analysis;
1423 #ifdef DCPOMATIC_WINDOWS
1424 bool _win32_console;
1426 std::vector<boost::filesystem::path> _history;
1427 std::vector<boost::filesystem::path> _player_history;
1428 std::shared_ptr<DKDMGroup> _dkdms;
1429 boost::filesystem::path _cinemas_file;
1430 boost::filesystem::path _dkdm_recipients_file;
1431 bool _show_hints_before_make_dcp;
1432 bool _confirm_kdm_email;
1433 dcp::NameFormat _kdm_filename_format;
1434 dcp::NameFormat _dkdm_filename_format;
1435 dcp::NameFormat _kdm_container_name_format;
1436 dcp::NameFormat _dcp_metadata_filename_format;
1437 dcp::NameFormat _dcp_asset_filename_format;
1438 bool _jump_to_selected;
1439 bool _nagged[NAG_COUNT];
1441 /** name of a specific sound output stream to use, or empty to use the default */
1442 boost::optional<std::string> _sound_output;
1443 std::string _cover_sheet;
1444 boost::optional<boost::filesystem::path> _last_player_load_directory;
1445 boost::optional<KDMWriteType> _last_kdm_write_type;
1446 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1447 int _frames_in_memory_multiplier;
1448 boost::optional<int> _decode_reduction;
1449 bool _default_notify;
1450 bool _notification[NOTIFICATION_COUNT];
1451 boost::optional<std::string> _barco_username;
1452 boost::optional<std::string> _barco_password;
1453 boost::optional<std::string> _christie_username;
1454 boost::optional<std::string> _christie_password;
1455 boost::optional<std::string> _gdc_username;
1456 boost::optional<std::string> _gdc_password;
1457 PlayerMode _player_mode;
1459 VideoViewType _video_view_type;
1460 bool _respect_kdm_validity_periods;
1461 /** Log file containing debug information for the player */
1462 boost::optional<boost::filesystem::path> _player_debug_log_file;
1463 /** A directory containing DCPs whose contents are presented to the user
1464 in the dual-screen player mode. DCPs on the list can be loaded
1467 boost::optional<boost::filesystem::path> _player_content_directory;
1468 boost::optional<boost::filesystem::path> _player_playlist_directory;
1469 boost::optional<boost::filesystem::path> _player_kdm_directory;
1470 boost::optional<AudioMapping> _audio_mapping;
1471 std::vector<dcp::LanguageTag> _custom_languages;
1472 std::map<std::string, boost::optional<boost::filesystem::path>> _initial_paths;
1473 bool _use_isdcf_name_by_default;
1474 bool _write_kdms_to_disk;
1476 dcp::Formulation _default_kdm_type;
1477 RoughDuration _default_kdm_duration;
1478 double _auto_crop_threshold;
1479 boost::optional<std::string> _last_release_notes_version;
1480 boost::optional<int> _main_divider_sash_position;
1481 boost::optional<int> _main_content_divider_sash_position;
1482 DefaultAddFileLocation _default_add_file_location;
1483 bool _allow_smpte_bv20;
1484 int _isdcf_name_part_length;
1488 std::string _gpu_binary_location;
1490 std::string _gpu_license_server;
1491 int _gpu_license_port;
1492 std::string _gpu_license;
1494 ExportConfig _export;
1496 static int const _current_version;
1498 /** Singleton instance, or 0 */
1499 static Config* _instance;