diff options
| author | Carl Hetherington <cth@carlh.net> | 2018-02-10 22:43:09 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2018-02-10 23:00:15 +0000 |
| commit | 0af38a850f967fd1848850a18432abc6314e9cc4 (patch) | |
| tree | 0796f547efd4174b5f8fdb1c9b0bf0fa88c9be49 | |
| parent | 17f9254f68fabfe5d8136d256b69a65fc58724ee (diff) | |
Save decoding resolution reduction between launches (#1195).
| -rw-r--r-- | src/lib/config.cc | 7 | ||||
| -rw-r--r-- | src/lib/config.h | 11 | ||||
| -rw-r--r-- | src/tools/dcpomatic_player.cc | 10 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index a54858cdb..16df3779f 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -144,6 +144,7 @@ Config::set_defaults () use about 240Mb with 72 encoding threads. */ _frames_in_memory_multiplier = 3; + _decode_reduction = optional<int>(); _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -392,6 +393,7 @@ try } } _frames_in_memory_multiplier = f.optional_number_child<int>("FramesInMemoryMultiplier").get_value_or(3); + _decode_reduction = f.optional_number_child<int>("DecodeReduction"); /* Replace any cinemas from config.xml with those from the configured file */ if (boost::filesystem::exists (_cinemas_file)) { @@ -714,6 +716,11 @@ Config::write_config () const */ root->add_child("FramesInMemoryMultiplier")->add_child_text(raw_convert<string>(_frames_in_memory_multiplier)); + /* [XML] DecodeReduction power of 2 to reduce DCP images by before decoding in the player */ + if (_decode_reduction) { + root->add_child("DecodeReduction")->add_child_text(raw_convert<string>(_decode_reduction.get())); + } + try { doc.write_to_file_formatted(config_file().string()); } catch (xmlpp::exception& e) { diff --git a/src/lib/config.h b/src/lib/config.h index db32c58a0..d50e585e3 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -376,6 +376,12 @@ public: return _frames_in_memory_multiplier; } + boost::optional<int> decode_reduction () const { + return _decode_reduction; + } + + /* SET (mostly) */ + void set_master_encoding_threads (int n) { maybe_set (_master_encoding_threads, n); } @@ -651,6 +657,10 @@ public: maybe_set (_frames_in_memory_multiplier, m); } + void set_decode_reduction (boost::optional<int> r) { + maybe_set (_decode_reduction, r); + } + void clear_history () { _history.clear (); changed (); @@ -832,6 +842,7 @@ private: boost::optional<KDMWriteType> _last_kdm_write_type; boost::optional<DKDMWriteType> _last_dkdm_write_type; int _frames_in_memory_multiplier; + boost::optional<int> _decode_reduction; /** Singleton instance, or 0 */ static Config* _instance; diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc index 0f77e3bc3..bbfdc4ae4 100644 --- a/src/tools/dcpomatic_player.cc +++ b/src/tools/dcpomatic_player.cc @@ -149,6 +149,7 @@ public: { _viewer->set_dcp_decode_reduction (reduction); _info->triggered_update (); + Config::instance()->set_decode_reduction (reduction); } void load_dcp (boost::filesystem::path dir) @@ -230,10 +231,11 @@ private: #endif wxMenu* view = new wxMenu; - view->AppendRadioItem (ID_view_scale_appropriate, _("Set decode resolution to match display")); - view->AppendRadioItem (ID_view_scale_full, _("Decode at full resolution")); - view->AppendRadioItem (ID_view_scale_half, _("Decode at half resolution")); - view->AppendRadioItem (ID_view_scale_quarter, _("Decode at quarter resolution")); + optional<int> c = Config::instance()->decode_reduction(); + view->AppendRadioItem(ID_view_scale_appropriate, _("Set decode resolution to match display"))->Check(!static_cast<bool>(c)); + view->AppendRadioItem(ID_view_scale_full, _("Decode at full resolution"))->Check(c && c.get() == 0); + view->AppendRadioItem(ID_view_scale_half, _("Decode at half resolution"))->Check(c && c.get() == 1); + view->AppendRadioItem(ID_view_scale_quarter, _("Decode at quarter resolution"))->Check(c && c.get() == 2); wxMenu* tools = new wxMenu; tools->Append (ID_tools_check_for_updates, _("Check for updates")); |
