2 Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 /** @file src/config.h
22 * @brief Class holding configuration.
25 #ifndef DCPOMATIC_CONFIG_H
26 #define DCPOMATIC_CONFIG_H
28 #include "isdcf_metadata.h"
32 #include <dcp/name_format.h>
33 #include <dcp/certificate_chain.h>
34 #include <dcp/encrypted_kdm.h>
35 #include <boost/shared_ptr.hpp>
36 #include <boost/signals2.hpp>
37 #include <boost/filesystem.hpp>
40 class CinemaSoundProcessor;
48 * @brief A singleton class holding configuration.
50 class Config : public State
53 /** @return number of threads which a master DoM should use for J2K encoding on the local machine */
54 int master_encoding_threads () const {
55 return _master_encoding_threads;
58 /** @return number of threads which a server should use for J2K encoding on the local machine */
59 int server_encoding_threads () const {
60 return _server_encoding_threads;
63 boost::optional<boost::filesystem::path> default_directory () const {
64 return _default_directory;
67 boost::optional<boost::filesystem::path> default_kdm_directory () const {
68 return _default_kdm_directory;
71 boost::filesystem::path default_directory_or (boost::filesystem::path a) const;
72 boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const;
81 PLAYER_CONTENT_DIRECTORY,
82 PLAYER_PLAYLIST_DIRECTORY,
85 SHOW_EXPERIMENTAL_AUDIO_PROCESSORS,
86 #ifdef DCPOMATIC_VARIANT_SWAROOP
87 PLAYER_BACKGROUND_IMAGE,
92 /** @return base port number to use for J2K encoding servers */
93 int server_port_base () const {
94 return _server_port_base;
97 void set_use_any_servers (bool u) {
99 changed (USE_ANY_SERVERS);
102 bool use_any_servers () const {
103 return _use_any_servers;
106 /** @param s New list of servers */
107 void set_servers (std::vector<std::string> s) {
112 /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */
113 std::vector<std::string> servers () const {
117 bool only_servers_encode () const {
118 return _only_servers_encode;
121 FileTransferProtocol tms_protocol () const {
122 return _tms_protocol;
125 /** @return The IP address of a TMS that we can copy DCPs to */
126 std::string tms_ip () const {
130 /** @return The path on a TMS that we should changed DCPs to */
131 std::string tms_path () const {
135 /** @return User name to log into the TMS with */
136 std::string tms_user () const {
140 /** @return Password to log into the TMS with */
141 std::string tms_password () const {
142 return _tms_password;
145 std::list<boost::shared_ptr<Cinema> > cinemas () const {
149 std::list<int> allowed_dcp_frame_rates () const {
150 return _allowed_dcp_frame_rates;
153 bool allow_any_dcp_frame_rate () const {
154 return _allow_any_dcp_frame_rate;
157 bool allow_any_container () const {
158 return _allow_any_container;
161 bool show_experimental_audio_processors () const {
162 return _show_experimental_audio_processors;
165 ISDCFMetadata default_isdcf_metadata () const {
166 return _default_isdcf_metadata;
169 boost::optional<std::string> language () const {
173 int default_still_length () const {
174 return _default_still_length;
177 Ratio const * default_container () const {
178 return _default_container;
181 Ratio const * default_scale_to () const {
182 return _default_scale_to;
185 DCPContentType const * default_dcp_content_type () const {
186 return _default_dcp_content_type;
189 int default_dcp_audio_channels () const {
190 return _default_dcp_audio_channels;
193 std::string dcp_issuer () const {
197 std::string dcp_creator () const {
201 int default_j2k_bandwidth () const {
202 return _default_j2k_bandwidth;
205 int default_audio_delay () const {
206 return _default_audio_delay;
209 bool default_interop () const {
210 return _default_interop;
213 bool default_upload_after_make_dcp () {
214 return _default_upload_after_make_dcp;
217 void set_default_kdm_directory (boost::filesystem::path d) {
218 if (_default_kdm_directory && _default_kdm_directory.get() == d) {
221 _default_kdm_directory = d;
225 std::string mail_server () const {
229 int mail_port () const {
233 EmailProtocol mail_protocol () const {
234 return _mail_protocol;
237 std::string mail_user () const {
241 std::string mail_password () const {
242 return _mail_password;
245 std::string kdm_subject () const {
249 std::string kdm_from () const {
253 std::vector<std::string> kdm_cc () const {
257 std::string kdm_bcc () const {
261 std::string kdm_email () const {
265 std::string notification_subject () const {
266 return _notification_subject;
269 std::string notification_from () const {
270 return _notification_from;
273 std::string notification_to () const {
274 return _notification_to;
277 std::vector<std::string> notification_cc () const {
278 return _notification_cc;
281 std::string notification_bcc () const {
282 return _notification_bcc;
285 std::string notification_email () const {
286 return _notification_email;
289 boost::shared_ptr<const dcp::CertificateChain> signer_chain () const {
290 return _signer_chain;
293 boost::shared_ptr<const dcp::CertificateChain> decryption_chain () const {
294 return _decryption_chain;
297 bool check_for_updates () const {
298 return _check_for_updates;
301 bool check_for_test_updates () const {
302 return _check_for_test_updates;
305 int maximum_j2k_bandwidth () const {
306 return _maximum_j2k_bandwidth;
309 int log_types () const {
313 bool analyse_ebur128 () const {
314 return _analyse_ebur128;
317 bool automatic_audio_analysis () const {
318 return _automatic_audio_analysis;
321 #ifdef DCPOMATIC_WINDOWS
322 bool win32_console () const {
323 return _win32_console;
327 std::vector<boost::filesystem::path> history () const {
331 std::vector<boost::filesystem::path> player_history () const {
332 return _player_history;
335 boost::shared_ptr<DKDMGroup> dkdms () const {
339 boost::filesystem::path cinemas_file () const {
340 return _cinemas_file;
343 bool show_hints_before_make_dcp () const {
344 return _show_hints_before_make_dcp;
347 bool confirm_kdm_email () const {
348 return _confirm_kdm_email;
351 dcp::NameFormat kdm_container_name_format () const {
352 return _kdm_container_name_format;
355 dcp::NameFormat kdm_filename_format () const {
356 return _kdm_filename_format;
359 dcp::NameFormat dcp_metadata_filename_format () const {
360 return _dcp_metadata_filename_format;
363 dcp::NameFormat dcp_asset_filename_format () const {
364 return _dcp_asset_filename_format;
367 bool jump_to_selected () const {
368 return _jump_to_selected;
373 NAG_ENCRYPTED_METADATA,
374 NAG_ALTER_DECRYPTION_CHAIN,
375 NAG_BAD_SIGNER_CHAIN,
376 /* Not really a nag but it's the same idea */
378 NAG_IMPORT_DECRYPTION_CHAIN,
384 bool nagged (Nag nag) const {
388 bool sound () const {
392 std::string cover_sheet () const {
396 boost::optional<std::string> sound_output () const {
397 return _sound_output;
400 boost::optional<boost::filesystem::path> last_player_load_directory () const {
401 return _last_player_load_directory;
410 boost::optional<KDMWriteType> last_kdm_write_type () const {
411 return _last_kdm_write_type;
419 boost::optional<DKDMWriteType> last_dkdm_write_type () const {
420 return _last_dkdm_write_type;
423 int frames_in_memory_multiplier () const {
424 return _frames_in_memory_multiplier;
427 boost::optional<int> decode_reduction () const {
428 return _decode_reduction;
431 bool default_notify () const {
432 return _default_notify;
441 bool notification (Notification n) const {
442 return _notification[n];
445 boost::optional<std::string> barco_username () const {
446 return _barco_username;
449 boost::optional<std::string> barco_password () const {
450 return _barco_password;
453 boost::optional<std::string> christie_username () const {
454 return _christie_username;
457 boost::optional<std::string> christie_password () const {
458 return _christie_password;
461 boost::optional<std::string> gdc_username () const {
462 return _gdc_username;
465 boost::optional<std::string> gdc_password () const {
466 return _gdc_password;
474 Interface interface_complexity () const {
475 return _interface_complexity;
484 PlayerMode player_mode () const {
488 int image_display () const {
489 return _image_display;
497 VideoViewType video_view_type () const {
498 return _video_view_type;
501 bool respect_kdm_validity_periods () const {
502 return _respect_kdm_validity_periods;
505 boost::optional<boost::filesystem::path> player_activity_log_file () const {
506 return _player_activity_log_file;
509 boost::optional<boost::filesystem::path> player_debug_log_file () const {
510 return _player_debug_log_file;
513 boost::optional<boost::filesystem::path> player_content_directory () const {
514 return _player_content_directory;
517 boost::optional<boost::filesystem::path> player_playlist_directory () const {
518 return _player_playlist_directory;
521 boost::optional<boost::filesystem::path> player_kdm_directory () const {
522 return _player_kdm_directory;
525 #ifdef DCPOMATIC_VARIANT_SWAROOP
526 boost::optional<boost::filesystem::path> player_background_image () const {
527 return _player_background_image;
530 std::string kdm_server_url () const {
531 return _kdm_server_url;
534 std::string player_watermark_theatre () const {
535 return _player_watermark_theatre;
538 int player_watermark_period () const {
539 return _player_watermark_period;
542 int player_watermark_duration () const {
543 return _player_watermark_duration;
546 std::vector<Monitor> required_monitors () const {
547 return _required_monitors;
550 boost::optional<boost::filesystem::path> player_lock_file () const {
551 return _player_lock_file;
557 void set_master_encoding_threads (int n) {
558 maybe_set (_master_encoding_threads, n);
561 void set_server_encoding_threads (int n) {
562 maybe_set (_server_encoding_threads, n);
565 void set_default_directory (boost::filesystem::path d) {
566 if (_default_directory && *_default_directory == d) {
569 _default_directory = d;
573 /** @param p New server port */
574 void set_server_port_base (int p) {
575 maybe_set (_server_port_base, p);
578 void set_only_servers_encode (bool o) {
579 maybe_set (_only_servers_encode, o);
582 void set_tms_protocol (FileTransferProtocol p) {
583 maybe_set (_tms_protocol, p);
586 /** @param i IP address of a TMS that we can copy DCPs to */
587 void set_tms_ip (std::string i) {
588 maybe_set (_tms_ip, i);
591 /** @param p Path on a TMS that we should changed DCPs to */
592 void set_tms_path (std::string p) {
593 maybe_set (_tms_path, p);
596 /** @param u User name to log into the TMS with */
597 void set_tms_user (std::string u) {
598 maybe_set (_tms_user, u);
601 /** @param p Password to log into the TMS with */
602 void set_tms_password (std::string p) {
603 maybe_set (_tms_password, p);
606 void add_cinema (boost::shared_ptr<Cinema> c) {
607 _cinemas.push_back (c);
611 void remove_cinema (boost::shared_ptr<Cinema> c) {
616 void set_allowed_dcp_frame_rates (std::list<int> const & r) {
617 maybe_set (_allowed_dcp_frame_rates, r);
620 void set_allow_any_dcp_frame_rate (bool a) {
621 maybe_set (_allow_any_dcp_frame_rate, a);
624 void set_allow_any_container (bool a) {
625 maybe_set (_allow_any_container, a);
628 void set_show_experimental_audio_processors (bool e) {
629 maybe_set (_show_experimental_audio_processors, e, SHOW_EXPERIMENTAL_AUDIO_PROCESSORS);
632 void set_default_isdcf_metadata (ISDCFMetadata d) {
633 maybe_set (_default_isdcf_metadata, d);
636 void set_language (std::string l) {
637 if (_language && _language.get() == l) {
644 void unset_language () {
649 _language = boost::none;
653 void set_default_still_length (int s) {
654 maybe_set (_default_still_length, s);
657 void set_default_container (Ratio const * c) {
658 maybe_set (_default_container, c);
661 void set_default_scale_to (Ratio const * c) {
662 maybe_set (_default_scale_to, c);
665 void set_default_dcp_content_type (DCPContentType const * t) {
666 maybe_set (_default_dcp_content_type, t);
669 void set_default_dcp_audio_channels (int c) {
670 maybe_set (_default_dcp_audio_channels, c);
673 void set_dcp_issuer (std::string i) {
674 maybe_set (_dcp_issuer, i);
677 void set_dcp_creator (std::string c) {
678 maybe_set (_dcp_creator, c);
681 void set_default_j2k_bandwidth (int b) {
682 maybe_set (_default_j2k_bandwidth, b);
685 void set_default_audio_delay (int d) {
686 maybe_set (_default_audio_delay, d);
689 void set_default_interop (bool i) {
690 maybe_set (_default_interop, i);
693 void set_default_upload_after_make_dcp (bool u) {
694 maybe_set (_default_upload_after_make_dcp, u);
697 void set_mail_server (std::string s) {
698 maybe_set (_mail_server, s);
701 void set_mail_port (int p) {
702 maybe_set (_mail_port, p);
705 void set_mail_protocol (EmailProtocol p) {
706 maybe_set (_mail_protocol, p);
709 void set_mail_user (std::string u) {
710 maybe_set (_mail_user, u);
713 void set_mail_password (std::string p) {
714 maybe_set (_mail_password, p);
717 void set_kdm_subject (std::string s) {
718 maybe_set (_kdm_subject, s);
721 void set_kdm_from (std::string f) {
722 maybe_set (_kdm_from, f);
725 void set_kdm_cc (std::vector<std::string> f) {
726 maybe_set (_kdm_cc, f);
729 void set_kdm_bcc (std::string f) {
730 maybe_set (_kdm_bcc, f);
733 void set_kdm_email (std::string e) {
734 maybe_set (_kdm_email, e);
737 void reset_kdm_email ();
739 void set_notification_subject (std::string s) {
740 maybe_set (_notification_subject, s);
743 void set_notification_from (std::string f) {
744 maybe_set (_notification_from, f);
747 void set_notification_to (std::string t) {
748 maybe_set (_notification_to, t);
751 void set_notification_cc (std::vector<std::string> f) {
752 maybe_set (_notification_cc, f);
755 void set_notification_bcc (std::string f) {
756 maybe_set (_notification_bcc, f);
759 void set_notification_email (std::string e) {
760 maybe_set (_notification_email, e);
763 void reset_notification_email ();
765 void set_signer_chain (boost::shared_ptr<const dcp::CertificateChain> s) {
766 maybe_set (_signer_chain, s);
769 void set_decryption_chain (boost::shared_ptr<const dcp::CertificateChain> c) {
770 maybe_set (_decryption_chain, c);
773 void set_check_for_updates (bool c) {
774 maybe_set (_check_for_updates, c);
776 set_check_for_test_updates (false);
780 void set_check_for_test_updates (bool c) {
781 maybe_set (_check_for_test_updates, c);
784 void set_maximum_j2k_bandwidth (int b) {
785 maybe_set (_maximum_j2k_bandwidth, b);
788 void set_log_types (int t) {
789 maybe_set (_log_types, t);
792 void set_analyse_ebur128 (bool a) {
793 maybe_set (_analyse_ebur128, a);
796 void set_automatic_audio_analysis (bool a) {
797 maybe_set (_automatic_audio_analysis, a);
800 #ifdef DCPOMATIC_WINDOWS
801 void set_win32_console (bool c) {
802 maybe_set (_win32_console, c);
806 void set_dkdms (boost::shared_ptr<DKDMGroup> dkdms) {
811 void set_cinemas_file (boost::filesystem::path file);
813 void set_show_hints_before_make_dcp (bool s) {
814 maybe_set (_show_hints_before_make_dcp, s);
817 void set_confirm_kdm_email (bool s) {
818 maybe_set (_confirm_kdm_email, s);
821 void set_sound (bool s) {
822 maybe_set (_sound, s, SOUND);
825 void set_sound_output (std::string o) {
826 maybe_set (_sound_output, o, SOUND_OUTPUT);
829 void set_last_player_load_directory (boost::filesystem::path d) {
830 maybe_set (_last_player_load_directory, d);
833 void set_last_kdm_write_type (KDMWriteType t) {
834 maybe_set (_last_kdm_write_type, t);
837 void set_last_dkdm_write_type (DKDMWriteType t) {
838 maybe_set (_last_dkdm_write_type, t);
841 void unset_sound_output () {
842 if (!_sound_output) {
846 _sound_output = boost::none;
850 void set_kdm_container_name_format (dcp::NameFormat n) {
851 maybe_set (_kdm_container_name_format, n);
854 void set_kdm_filename_format (dcp::NameFormat n) {
855 maybe_set (_kdm_filename_format, n);
858 void set_dcp_metadata_filename_format (dcp::NameFormat n) {
859 maybe_set (_dcp_metadata_filename_format, n);
862 void set_dcp_asset_filename_format (dcp::NameFormat n) {
863 maybe_set (_dcp_asset_filename_format, n);
866 void set_frames_in_memory_multiplier (int m) {
867 maybe_set (_frames_in_memory_multiplier, m);
870 void set_decode_reduction (boost::optional<int> r) {
871 maybe_set (_decode_reduction, r);
874 void set_default_notify (bool n) {
875 maybe_set (_default_notify, n);
878 void clear_history () {
883 void clear_player_history () {
884 _player_history.clear ();
888 void add_to_history (boost::filesystem::path p);
889 void clean_history ();
890 void add_to_player_history (boost::filesystem::path p);
891 void clean_player_history ();
893 void set_jump_to_selected (bool j) {
894 maybe_set (_jump_to_selected, j);
897 void set_nagged (Nag nag, bool nagged) {
898 maybe_set (_nagged[nag], nagged);
901 void set_cover_sheet (std::string s) {
902 maybe_set (_cover_sheet, s);
905 void reset_cover_sheet ();
907 void set_notification (Notification n, bool v) {
908 maybe_set (_notification[n], v);
911 void set_barco_username (std::string u) {
912 maybe_set (_barco_username, u);
915 void unset_barco_username () {
916 maybe_set (_barco_username, boost::optional<std::string>());
919 void set_barco_password (std::string p) {
920 maybe_set (_barco_password, p);
923 void unset_barco_password () {
924 maybe_set (_barco_password, boost::optional<std::string>());
927 void set_christie_username (std::string u) {
928 maybe_set (_christie_username, u);
931 void unset_christie_username () {
932 maybe_set (_christie_username, boost::optional<std::string>());
935 void set_christie_password (std::string p) {
936 maybe_set (_christie_password, p);
939 void unset_christie_password () {
940 maybe_set (_christie_password, boost::optional<std::string>());
943 void set_gdc_username (std::string u) {
944 maybe_set (_gdc_username, u);
947 void unset_gdc_username () {
948 maybe_set (_gdc_username, boost::optional<std::string>());
951 void set_gdc_password (std::string p) {
952 maybe_set (_gdc_password, p);
955 void unset_gdc_password () {
956 maybe_set (_gdc_password, boost::optional<std::string>());
959 void set_interface_complexity (Interface i) {
960 maybe_set (_interface_complexity, i, INTERFACE_COMPLEXITY);
963 void set_player_mode (PlayerMode m) {
964 maybe_set (_player_mode, m);
967 void set_image_display (int n) {
968 maybe_set (_image_display, n);
971 void set_video_view_type (VideoViewType v) {
972 maybe_set (_video_view_type, v);
975 void set_respect_kdm_validity_periods (bool r) {
976 maybe_set (_respect_kdm_validity_periods, r);
979 void set_player_activity_log_file (boost::filesystem::path p) {
980 maybe_set (_player_activity_log_file, p);
983 void unset_player_activity_log_file () {
984 if (!_player_activity_log_file) {
987 _player_activity_log_file = boost::none;
991 void set_player_debug_log_file (boost::filesystem::path p) {
992 maybe_set (_player_debug_log_file, p, PLAYER_DEBUG_LOG);
995 void unset_player_debug_log_file () {
996 if (!_player_debug_log_file) {
999 _player_debug_log_file = boost::none;
1000 changed (PLAYER_DEBUG_LOG);
1003 void set_player_content_directory (boost::filesystem::path p) {
1004 maybe_set (_player_content_directory, p, PLAYER_CONTENT_DIRECTORY);
1007 void unset_player_content_directory () {
1008 if (!_player_content_directory) {
1011 _player_content_directory = boost::none;
1012 changed (PLAYER_CONTENT_DIRECTORY);
1015 void set_player_playlist_directory (boost::filesystem::path p) {
1016 maybe_set (_player_playlist_directory, p, PLAYER_PLAYLIST_DIRECTORY);
1019 void unset_player_playlist_directory () {
1020 if (!_player_playlist_directory) {
1023 _player_playlist_directory = boost::none;
1024 changed (PLAYER_PLAYLIST_DIRECTORY);
1027 void set_player_kdm_directory (boost::filesystem::path p) {
1028 maybe_set (_player_kdm_directory, p);
1031 void unset_player_kdm_directory () {
1032 if (!_player_kdm_directory) {
1035 _player_kdm_directory = boost::none;
1039 #ifdef DCPOMATIC_VARIANT_SWAROOP
1040 void set_player_background_image (boost::filesystem::path p) {
1041 maybe_set (_player_background_image, p, PLAYER_BACKGROUND_IMAGE);
1044 void unset_player_background_image () {
1045 if (!_player_background_image) {
1048 _player_background_image = boost::none;
1049 changed (PLAYER_BACKGROUND_IMAGE);
1052 void set_kdm_server_url (std::string s) {
1053 maybe_set (_kdm_server_url, s);
1056 void set_player_watermark_theatre (std::string p) {
1057 maybe_set (_player_watermark_theatre, p);
1060 void set_player_watermark_period (int minutes) {
1061 maybe_set (_player_watermark_period, minutes);
1064 void set_player_watermark_duration (int milliseconds) {
1065 maybe_set (_player_watermark_duration, milliseconds);
1068 void set_required_monitors (std::vector<Monitor> monitors) {
1069 maybe_set (_required_monitors, monitors);
1072 void set_player_lock_file (boost::filesystem::path p) {
1073 maybe_set (_player_lock_file, p);
1076 void unset_player_lock_file () {
1077 if (!_player_lock_file) {
1080 _player_lock_file = boost::none;
1085 void changed (Property p = OTHER);
1086 boost::signals2::signal<void (Property)> Changed;
1087 /** Emitted if read() failed on an existing Config file. There is nothing
1088 a listener can do about it: this is just for information.
1090 static boost::signals2::signal<void ()> FailedToLoad;
1091 /** Emitted if read() issued a warning which the user might want to know about */
1092 static boost::signals2::signal<void (std::string)> Warning;
1093 /** Emitted if there is a something wrong the contents of our config. Handler can call
1094 * true to ask Config to solve the problem (by discarding and recreating the bad thing)
1097 BAD_SIGNER_UTF8_STRINGS, ///< signer chain contains UTF-8 strings (not PRINTABLESTRING)
1098 BAD_SIGNER_INCONSISTENT, ///< signer chain is somehow inconsistent
1099 BAD_DECRYPTION_INCONSISTENT, ///< KDM decryption chain is somehow inconsistent
1102 static boost::signals2::signal<bool (BadReason)> Bad;
1104 void write () const;
1105 void write_config () const;
1106 void write_cinemas () const;
1107 void link (boost::filesystem::path new_file) const;
1108 void copy_and_link (boost::filesystem::path new_file) const;
1109 bool have_write_permission () const;
1111 void save_template (boost::shared_ptr<const Film> film, std::string name) const;
1112 bool existing_template (std::string name) const;
1113 std::list<std::string> templates () const;
1114 boost::filesystem::path template_path (std::string name) const;
1115 void rename_template (std::string old_name, std::string new_name) const;
1116 void delete_template (std::string name) const;
1118 static Config* instance ();
1119 static void drop ();
1120 static void restore_defaults ();
1121 static bool have_existing (std::string);
1122 static boost::filesystem::path config_file ();
1127 void set_defaults ();
1128 void set_kdm_email_to_default ();
1129 void set_notification_email_to_default ();
1130 void set_cover_sheet_to_default ();
1131 void read_cinemas (cxml::Document const & f);
1132 boost::shared_ptr<dcp::CertificateChain> create_certificate_chain ();
1133 boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const;
1134 void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p);
1135 void clean_history_internal (std::vector<boost::filesystem::path>& h);
1139 void maybe_set (T& member, T new_value, Property prop = OTHER) {
1140 if (member == new_value) {
1148 void maybe_set (boost::optional<T>& member, T new_value, Property prop = OTHER) {
1149 if (member && member.get() == new_value) {
1156 /** number of threads which a master DoM should use for J2K encoding on the local machine */
1157 int _master_encoding_threads;
1158 /** number of threads which a server should use for J2K encoding on the local machine */
1159 int _server_encoding_threads;
1160 /** default directory to put new films in */
1161 boost::optional<boost::filesystem::path> _default_directory;
1162 /** base port number to use for J2K encoding servers;
1163 * this port and the two above it will be used.
1165 int _server_port_base;
1166 /** true to broadcast on the `any' address to look for servers */
1167 bool _use_any_servers;
1168 /** J2K encoding servers that should definitely be used */
1169 std::vector<std::string> _servers;
1170 bool _only_servers_encode;
1171 FileTransferProtocol _tms_protocol;
1172 /** The IP address of a TMS that we can copy DCPs to */
1173 std::string _tms_ip;
1174 /** The path on a TMS that we should write DCPs to */
1175 std::string _tms_path;
1176 /** User name to log into the TMS with */
1177 std::string _tms_user;
1178 /** Password to log into the TMS with */
1179 std::string _tms_password;
1180 /** The list of possible DCP frame rates that DCP-o-matic will use */
1181 std::list<int> _allowed_dcp_frame_rates;
1182 /** Allow any video frame rate for the DCP; if true, overrides _allowed_dcp_frame_rates */
1183 bool _allow_any_dcp_frame_rate;
1184 /** Allow any container ratio, not just the standard ones. GDC SX-2001 will not play Flat
1185 DCPs at 25fps but will play 16:9, so this is very useful for some users.
1186 https://www.dcpomatic.com/forum/viewtopic.php?f=2&t=1119&p=4468
1188 bool _allow_any_container;
1189 /** Offer the upmixers in the audio processor settings */
1190 bool _show_experimental_audio_processors;
1191 /** Default ISDCF metadata for newly-created Films */
1192 ISDCFMetadata _default_isdcf_metadata;
1193 boost::optional<std::string> _language;
1194 /** Default length of still image content (seconds) */
1195 int _default_still_length;
1196 Ratio const * _default_container;
1197 Ratio const * _default_scale_to;
1198 DCPContentType const * _default_dcp_content_type;
1199 int _default_dcp_audio_channels;
1200 std::string _dcp_issuer;
1201 std::string _dcp_creator;
1202 int _default_j2k_bandwidth;
1203 int _default_audio_delay;
1204 bool _default_interop;
1205 /** Default directory to offer to write KDMs to; if it's not set,
1206 the home directory will be offered.
1208 boost::optional<boost::filesystem::path> _default_kdm_directory;
1209 bool _default_upload_after_make_dcp;
1210 std::list<boost::shared_ptr<Cinema> > _cinemas;
1211 std::string _mail_server;
1213 EmailProtocol _mail_protocol;
1214 std::string _mail_user;
1215 std::string _mail_password;
1216 std::string _kdm_subject;
1217 std::string _kdm_from;
1218 std::vector<std::string> _kdm_cc;
1219 std::string _kdm_bcc;
1220 std::string _kdm_email;
1221 std::string _notification_subject;
1222 std::string _notification_from;
1223 std::string _notification_to;
1224 std::vector<std::string> _notification_cc;
1225 std::string _notification_bcc;
1226 std::string _notification_email;
1227 boost::shared_ptr<const dcp::CertificateChain> _signer_chain;
1228 #ifdef DCPOMATIC_VARIANT_SWAROOP
1229 boost::filesystem::path _signer_chain_path;
1231 /** Chain used to decrypt KDMs; the leaf of this chain is the target
1232 * certificate for making KDMs given to DCP-o-matic.
1234 boost::shared_ptr<const dcp::CertificateChain> _decryption_chain;
1235 #ifdef DCPOMATIC_VARIANT_SWAROOP
1236 boost::filesystem::path _decryption_chain_path;
1238 /** true to check for updates on startup */
1239 bool _check_for_updates;
1240 bool _check_for_test_updates;
1241 /** maximum allowed J2K bandwidth in bits per second */
1242 int _maximum_j2k_bandwidth;
1244 bool _analyse_ebur128;
1245 bool _automatic_audio_analysis;
1246 #ifdef DCPOMATIC_WINDOWS
1247 bool _win32_console;
1249 std::vector<boost::filesystem::path> _history;
1250 std::vector<boost::filesystem::path> _player_history;
1251 boost::shared_ptr<DKDMGroup> _dkdms;
1252 boost::filesystem::path _cinemas_file;
1253 bool _show_hints_before_make_dcp;
1254 bool _confirm_kdm_email;
1255 dcp::NameFormat _kdm_filename_format;
1256 dcp::NameFormat _kdm_container_name_format;
1257 dcp::NameFormat _dcp_metadata_filename_format;
1258 dcp::NameFormat _dcp_asset_filename_format;
1259 bool _jump_to_selected;
1260 bool _nagged[NAG_COUNT];
1262 /** name of a specific sound output stream to use, or empty to use the default */
1263 boost::optional<std::string> _sound_output;
1264 std::string _cover_sheet;
1265 boost::optional<boost::filesystem::path> _last_player_load_directory;
1266 boost::optional<KDMWriteType> _last_kdm_write_type;
1267 boost::optional<DKDMWriteType> _last_dkdm_write_type;
1268 int _frames_in_memory_multiplier;
1269 boost::optional<int> _decode_reduction;
1270 bool _default_notify;
1271 bool _notification[NOTIFICATION_COUNT];
1272 boost::optional<std::string> _barco_username;
1273 boost::optional<std::string> _barco_password;
1274 boost::optional<std::string> _christie_username;
1275 boost::optional<std::string> _christie_password;
1276 boost::optional<std::string> _gdc_username;
1277 boost::optional<std::string> _gdc_password;
1278 Interface _interface_complexity;
1279 PlayerMode _player_mode;
1281 VideoViewType _video_view_type;
1282 bool _respect_kdm_validity_periods;
1283 /** Log file containing things the player does (e.g. started, stopped, loaded
1284 playlist etc.) Does not contain debugging information.
1286 boost::optional<boost::filesystem::path> _player_activity_log_file;
1287 /** Log file containing debug information for the player */
1288 boost::optional<boost::filesystem::path> _player_debug_log_file;
1289 /** A directory containing DCPs whose contents are presented to the user
1290 in the dual-screen player mode. DCPs on the list can be loaded
1293 boost::optional<boost::filesystem::path> _player_content_directory;
1294 boost::optional<boost::filesystem::path> _player_playlist_directory;
1295 boost::optional<boost::filesystem::path> _player_kdm_directory;
1296 #ifdef DCPOMATIC_VARIANT_SWAROOP
1297 boost::optional<boost::filesystem::path> _player_background_image;
1298 std::string _kdm_server_url;
1299 std::string _player_watermark_theatre;
1300 /** watermark period in minutes */
1301 int _player_watermark_period;
1302 /** watermark duration in milliseconds */
1303 int _player_watermark_duration;
1304 std::vector<Monitor> _required_monitors;
1305 /** a file which, if specified, must be present for the player to work */
1306 boost::optional<boost::filesystem::path> _player_lock_file;
1309 static int const _current_version;
1311 /** Singleton instance, or 0 */
1312 static Config* _instance;