Allow specification of video bit rate separately for J2K and MPEG2.
[dcpomatic.git] / src / lib / config.h
index 527bf4de8255f520648c664529bf014bc8104532..a7b238c04099c0c5dec736cb3d298325254350ec 100644 (file)
 
 
 #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>
@@ -79,6 +81,8 @@ 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 Property {
                USE_ANY_SERVERS,
                SERVERS,
@@ -95,6 +99,10 @@ public:
                AUTO_CROP_THRESHOLD,
                ALLOW_SMPTE_BV20,
                ISDCF_NAME_PART_LENGTH,
+               ALLOW_ANY_CONTAINER,
+#ifdef DCPOMATIC_GROK
+               GROK,
+#endif
                OTHER
        };
 
@@ -227,8 +235,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 {
@@ -343,8 +351,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 {
@@ -529,6 +537,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;
        }
@@ -619,27 +635,27 @@ public:
                return _allow_smpte_bv20;
        }
 
-       std::string gpu_binary_location () const {
-               return _gpu_binary_location;
-       }
+#ifdef DCPOMATIC_GROK
+       class Grok
+       {
+       public:
+               Grok() = default;
+               Grok(cxml::ConstNodePtr node);
 
-       bool enable_gpu () const {
-               return _enable_gpu;
-       }
+               void as_xml(xmlpp::Element* node) const;
 
-       int selected_gpu () const {
-               return _selected_gpu;
-       }
-       std::string gpu_license_server () const {
-               return _gpu_license_server;
-       }
+               bool enable = false;
+               boost::filesystem::path binary_location;
+               int selected = 0;
+               std::string licence_server;
+               int licence_port = 5000;
+               std::string licence;
+       };
 
-       int gpu_license_port () const {
-               return _gpu_license_port;
-       }
-       std::string gpu_license () const {
-               return _gpu_license;
+       boost::optional<Grok> grok() const {
+               return _grok;
        }
+#endif
 
        int isdcf_name_part_length() const {
                return _isdcf_name_part_length;
@@ -729,7 +745,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) {
@@ -797,8 +813,8 @@ public:
                maybe_set (_dcp_j2k_comment, c);
        }
 
-       void set_default_j2k_bandwidth (int b) {
-               maybe_set (_default_j2k_bandwidth, b);
+       void set_default_video_bit_rate(VideoEncoding encoding, int64_t b) {
+               maybe_set(_default_video_bit_rate[encoding], b);
        }
 
        void set_default_audio_delay (int d) {
@@ -920,8 +936,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) {
@@ -1221,24 +1237,11 @@ public:
        void set_allow_smpte_bv20(bool allow) {
                maybe_set(_allow_smpte_bv20, allow, ALLOW_SMPTE_BV20);
        }
-       void set_gpu_binary_location (std::string location) {
-               maybe_set (_gpu_binary_location, location);
-       }
-       void set_enable_gpu (bool enable) {
-               maybe_set (_enable_gpu, enable);
-       }
-       void set_selected_gpu (int selected) {
-               maybe_set (_selected_gpu, selected);
-       }
-       void set_gpu_license_server (std::string s) {
-               maybe_set (_gpu_license_server, s);
-       }
-       void set_gpu_license_port (int p) {
-               maybe_set (_gpu_license_port, p);
-       }
-       void set_gpu_license (std::string p) {
-               maybe_set (_gpu_license, p);
-       }
+
+#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);
        }
@@ -1380,7 +1383,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;
@@ -1417,8 +1420,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;
@@ -1457,6 +1460,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;
@@ -1485,13 +1490,9 @@ private:
        bool _allow_smpte_bv20;
        int _isdcf_name_part_length;
 
-       /* GPU */
-       bool _enable_gpu;
-       std::string _gpu_binary_location;
-       int _selected_gpu;
-       std::string _gpu_license_server;
-       int _gpu_license_port;
-       std::string _gpu_license;
+#ifdef DCPOMATIC_GROK
+       boost::optional<Grok> _grok;
+#endif
 
        ExportConfig _export;