diff options
Diffstat (limited to 'src/lib/config.h')
| -rw-r--r-- | src/lib/config.h | 187 |
1 files changed, 105 insertions, 82 deletions
diff --git a/src/lib/config.h b/src/lib/config.h index f3d080b0b..1f13381b7 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -28,9 +28,11 @@ #include "audio_mapping.h" +#include "enum_indexed_vector.h" #include "export_config.h" #include "rough_duration.h" #include "state.h" +#include "video_encoding.h" #include <dcp/name_format.h> #include <dcp/certificate_chain.h> #include <dcp/encrypted_kdm.h> @@ -48,6 +50,8 @@ class DKDMRecipient; class Film; class Ratio; +#undef IGNORE + extern void save_all_config_as_zip (boost::filesystem::path zip_file); @@ -79,13 +83,28 @@ public: boost::filesystem::path default_directory_or (boost::filesystem::path a) const; boost::filesystem::path default_kdm_directory_or (boost::filesystem::path a) const; - void load_from_zip(boost::filesystem::path zip_file); + enum class CinemasAction + { + /** Copy the cinemas.{xml,sqlite3} in the ZIP file to the path + * specified in the current config, overwriting whatever is there, + * and use that path. + */ + WRITE_TO_CURRENT_PATH, + /** Copy the cinemas.{xml,sqlite3} in the ZIP file over the path + * specified in the config.xml from the ZIP, overwriting whatever + * is there and creating any required directories, and use + * that path. + */ + WRITE_TO_PATH_IN_ZIPPED_CONFIG, + /** Do nothing with the cinemas.{xml,sqlite3} in the ZIP file */ + IGNORE + }; + + void load_from_zip(boost::filesystem::path zip_file, CinemasAction action); enum Property { USE_ANY_SERVERS, SERVERS, - CINEMAS, - DKDM_RECIPIENTS, SOUND, SOUND_OUTPUT, PLAYER_CONTENT_DIRECTORY, @@ -97,6 +116,10 @@ public: AUTO_CROP_THRESHOLD, ALLOW_SMPTE_BV20, ISDCF_NAME_PART_LENGTH, + ALLOW_ANY_CONTAINER, +#ifdef DCPOMATIC_GROK + GROK, +#endif OTHER }; @@ -157,14 +180,6 @@ public: return _tms_password; } - std::list<std::shared_ptr<Cinema>> cinemas () const { - return _cinemas; - } - - std::list<std::shared_ptr<DKDMRecipient>> dkdm_recipients () const { - return _dkdm_recipients; - } - std::list<int> allowed_dcp_frame_rates () const { return _allowed_dcp_frame_rates; } @@ -229,8 +244,8 @@ public: return _dcp_j2k_comment; } - int default_j2k_bandwidth () const { - return _default_j2k_bandwidth; + int64_t default_video_bit_rate(VideoEncoding encoding) const { + return _default_video_bit_rate[encoding]; } int default_audio_delay () const { @@ -345,8 +360,8 @@ public: return _check_for_test_updates; } - int maximum_j2k_bandwidth () const { - return _maximum_j2k_bandwidth; + int64_t maximum_video_bit_rate(VideoEncoding encoding) const { + return _maximum_video_bit_rate[encoding]; } int log_types () const { @@ -531,6 +546,14 @@ public: return _player_mode; } + bool player_restricted_menus() const { + return _player_restricted_menus; + } + + bool playlist_editor_restricted_menus() const { + return _playlist_editor_restricted_menus; + } + int image_display () const { return _image_display; } @@ -621,10 +644,40 @@ public: return _allow_smpte_bv20; } +#ifdef DCPOMATIC_GROK + class Grok + { + public: + Grok() = default; + Grok(cxml::ConstNodePtr node); + + void as_xml(xmlpp::Element* node) const; + + bool enable = false; + boost::filesystem::path binary_location; + int selected = 0; + std::string licence_server; + int licence_port = 5000; + std::string licence; + }; + + boost::optional<Grok> grok() const { + return _grok; + } +#endif + int isdcf_name_part_length() const { return _isdcf_name_part_length; } + bool enable_player_http_server() const { + return _enable_player_http_server; + } + + int player_http_server_port() const { + return _player_http_server_port; + } + /* SET (mostly) */ void set_master_encoding_threads (int n) { @@ -680,26 +733,6 @@ public: maybe_set (_tms_password, p); } - void add_cinema (std::shared_ptr<Cinema> c) { - _cinemas.push_back (c); - changed (CINEMAS); - } - - void remove_cinema (std::shared_ptr<Cinema> c) { - _cinemas.remove (c); - changed (CINEMAS); - } - - void add_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) { - _dkdm_recipients.push_back (c); - changed (DKDM_RECIPIENTS); - } - - void remove_dkdm_recipient (std::shared_ptr<DKDMRecipient> c) { - _dkdm_recipients.remove (c); - changed (DKDM_RECIPIENTS); - } - void set_allowed_dcp_frame_rates (std::list<int> const & r) { maybe_set (_allowed_dcp_frame_rates, r); } @@ -709,7 +742,7 @@ public: } void set_allow_any_container (bool a) { - maybe_set (_allow_any_container, a); + maybe_set(_allow_any_container, a, ALLOW_ANY_CONTAINER); } void set_allow_96hhz_audio (bool a) { @@ -745,14 +778,6 @@ public: maybe_set (_default_still_length, s); } - void set_default_dcp_content_type (DCPContentType const * t) { - maybe_set (_default_dcp_content_type, t); - } - - void set_default_dcp_audio_channels (int c) { - maybe_set (_default_dcp_audio_channels, c); - } - void set_dcp_issuer (std::string i) { maybe_set (_dcp_issuer, i); } @@ -777,18 +802,10 @@ public: maybe_set (_dcp_j2k_comment, c); } - void set_default_j2k_bandwidth (int b) { - maybe_set (_default_j2k_bandwidth, b); - } - void set_default_audio_delay (int d) { maybe_set (_default_audio_delay, d); } - void set_default_interop (bool i) { - maybe_set (_default_interop, i); - } - void set_default_audio_language(dcp::LanguageTag tag) { maybe_set(_default_audio_language, tag); } @@ -797,18 +814,6 @@ public: maybe_set(_default_audio_language, boost::optional<dcp::LanguageTag>()); } - void set_default_territory(dcp::LanguageTag::RegionSubtag tag) { - maybe_set(_default_territory, tag); - } - - void unset_default_territory() { - maybe_set(_default_territory, boost::optional<dcp::LanguageTag::RegionSubtag>()); - } - - void set_default_metadata (std::map<std::string, std::string> const& metadata) { - maybe_set (_default_metadata, metadata); - } - void set_upload_after_make_dcp (bool u) { maybe_set (_upload_after_make_dcp, u); } @@ -900,8 +905,8 @@ public: maybe_set (_check_for_test_updates, c); } - void set_maximum_j2k_bandwidth (int b) { - maybe_set (_maximum_j2k_bandwidth, b); + void set_maximum_video_bit_rate(VideoEncoding encoding, int64_t b) { + maybe_set(_maximum_video_bit_rate[encoding], b); } void set_log_types (int t) { @@ -929,6 +934,8 @@ public: void set_cinemas_file (boost::filesystem::path file); + void set_dkdm_recipients_file(boost::filesystem::path file); + void set_show_hints_before_make_dcp (bool s) { maybe_set (_show_hints_before_make_dcp, s); } @@ -1202,10 +1209,23 @@ public: maybe_set(_allow_smpte_bv20, allow, ALLOW_SMPTE_BV20); } +#ifdef DCPOMATIC_GROK + void set_grok(Grok const& grok); +#endif + void set_isdcf_name_part_length(int length) { maybe_set(_isdcf_name_part_length, length, ISDCF_NAME_PART_LENGTH); } + void set_enable_player_http_server(bool enable) { + maybe_set(_enable_player_http_server, enable); + } + + void set_player_http_server_port(int port) { + maybe_set(_player_http_server_port, port); + } + + void changed (Property p = OTHER); boost::signals2::signal<void (Property)> Changed; /** Emitted if read() failed on an existing Config file. There is nothing @@ -1213,8 +1233,6 @@ public: */ enum class LoadFailure { CONFIG, - CINEMAS, - DKDM_RECIPIENTS }; static boost::signals2::signal<void (LoadFailure)> FailedToLoad; /** Emitted if read() issued a warning which the user might want to know about */ @@ -1234,17 +1252,17 @@ public: void write () const override; void write_config () const; - void write_cinemas () const; - void write_dkdm_recipients () const; void link (boost::filesystem::path new_file) const; void copy_and_link (boost::filesystem::path new_file) const; bool have_write_permission () const; + void save_default_template(std::shared_ptr<const Film> film) const; void save_template (std::shared_ptr<const Film> film, std::string name) const; bool existing_template (std::string name) const; - std::list<std::string> templates () const; + /** @return Template names (not including the default) */ + std::vector<std::string> templates() const; boost::filesystem::path template_read_path (std::string name) const; - boost::filesystem::path template_write_path (std::string name) const; + boost::filesystem::path default_template_read_path() const; void rename_template (std::string old_name, std::string new_name) const; void delete_template (std::string name) const; @@ -1256,6 +1274,9 @@ public: static bool have_existing (std::string); static boost::filesystem::path config_read_file (); static boost::filesystem::path config_write_file (); + static bool zip_contains_cinemas(boost::filesystem::path zip); + static boost::filesystem::path cinemas_file_from_zip(boost::filesystem::path zip); + template <class T> void maybe_set (T& member, T new_value, Property prop = OTHER) { @@ -1278,20 +1299,16 @@ public: private: Config (); void read () override; - void read_config(); - void read_cinemas(); - void read_dkdm_recipients(); void set_defaults (); void set_kdm_email_to_default (); void set_notification_email_to_default (); void set_cover_sheet_to_default (); - void read_cinemas (cxml::Document const & f); - void read_dkdm_recipients (cxml::Document const & f); std::shared_ptr<dcp::CertificateChain> create_certificate_chain (); boost::filesystem::path directory_or (boost::optional<boost::filesystem::path> dir, boost::filesystem::path a) const; void add_to_history_internal (std::vector<boost::filesystem::path>& h, boost::filesystem::path p); void clean_history_internal (std::vector<boost::filesystem::path>& h); void backup (); + boost::filesystem::path template_write_path(std::string name) const; /** number of threads which a master DoM should use for J2K encoding on the local machine */ int _master_encoding_threads; @@ -1342,7 +1359,7 @@ private: std::string _dcp_product_name; std::string _dcp_product_version; std::string _dcp_j2k_comment; - int _default_j2k_bandwidth; + EnumIndexedVector<int64_t, VideoEncoding> _default_video_bit_rate; int _default_audio_delay; bool _default_interop; boost::optional<dcp::LanguageTag> _default_audio_language; @@ -1353,8 +1370,6 @@ private: */ boost::optional<boost::filesystem::path> _default_kdm_directory; bool _upload_after_make_dcp; - std::list<std::shared_ptr<Cinema>> _cinemas; - std::list<std::shared_ptr<DKDMRecipient>> _dkdm_recipients; std::string _mail_server; int _mail_port; EmailProtocol _mail_protocol; @@ -1379,8 +1394,8 @@ private: /** true to check for updates on startup */ bool _check_for_updates; bool _check_for_test_updates; - /** maximum allowed J2K bandwidth in bits per second */ - int _maximum_j2k_bandwidth; + /** maximum allowed video bit rate in bits per second */ + EnumIndexedVector<int64_t, VideoEncoding> _maximum_video_bit_rate; int _log_types; bool _analyse_ebur128; bool _automatic_audio_analysis; @@ -1419,6 +1434,8 @@ private: boost::optional<std::string> _gdc_username; boost::optional<std::string> _gdc_password; PlayerMode _player_mode; + bool _player_restricted_menus = false; + bool _playlist_editor_restricted_menus = false; int _image_display; VideoViewType _video_view_type; bool _respect_kdm_validity_periods; @@ -1446,6 +1463,12 @@ private: DefaultAddFileLocation _default_add_file_location; bool _allow_smpte_bv20; int _isdcf_name_part_length; + bool _enable_player_http_server; + int _player_http_server_port; + +#ifdef DCPOMATIC_GROK + boost::optional<Grok> _grok; +#endif ExportConfig _export; |
