diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-03-03 20:51:48 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-03-08 00:12:07 +0100 |
| commit | 3f2675aab119e55f958563e2fe6949192a2b976d (patch) | |
| tree | 2ed8c7e2a0eb7147ab9b798e934d1f7a4ce453a9 /src/lib | |
| parent | f180d199dcb0217ea9750ab0a788217689733c41 (diff) | |
Don't use an optional for the Grok config object.
I'm not sure why I did it like this in the first place - perhaps so that
if the API endpoint changes there aren't so many old values stuck in
config files all over the place? Anyway, it seems cleaner to do it like
this, as it's how we handle the other config.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 6 | ||||
| -rw-r--r-- | src/lib/config.h | 4 | ||||
| -rw-r--r-- | src/lib/grok/context.h | 4 | ||||
| -rw-r--r-- | src/lib/grok_j2k_encoder_thread.cc | 2 | ||||
| -rw-r--r-- | src/lib/j2k_encoder.cc | 10 | ||||
| -rw-r--r-- | src/lib/util.cc | 4 |
6 files changed, 14 insertions, 16 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 3227ea433..49c64e5b6 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -238,7 +238,7 @@ Config::set_defaults() set_cover_sheet_to_default(); #ifdef DCPOMATIC_GROK - _grok = boost::none; + _grok = {}; #endif _main_divider_sash_position = {}; @@ -1151,9 +1151,7 @@ Config::write_config() const cxml::add_text_child(root, "LayoutForShortScreen", _layout_for_short_screen ? "1" : "0"); #ifdef DCPOMATIC_GROK - if (_grok) { - _grok->as_xml(cxml::add_child(root, "Grok")); - } + _grok.as_xml(cxml::add_child(root, "Grok")); #endif _export.write(cxml::add_child(root, "Export")); diff --git a/src/lib/config.h b/src/lib/config.h index d9a95ebfd..b2a979ffa 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -666,7 +666,7 @@ public: std::string licence; }; - boost::optional<Grok> grok() const { + Grok grok() const { return _grok; } #endif @@ -1495,7 +1495,7 @@ private: bool _layout_for_short_screen; #ifdef DCPOMATIC_GROK - boost::optional<Grok> _grok; + Grok _grok; #endif ExportConfig _export; diff --git a/src/lib/grok/context.h b/src/lib/grok/context.h index 602c8b13f..b31867cf6 100644 --- a/src/lib/grok/context.h +++ b/src/lib/grok/context.h @@ -99,7 +99,7 @@ public: explicit GrokContext(DcpomaticContext* dcpomatic_context) : _dcpomatic_context(dcpomatic_context) { - auto grok = Config::instance()->grok().get_value_or({}); + auto grok = Config::instance()->grok(); if (!grok.enable) { return; } @@ -216,7 +216,7 @@ public: auto s = dcpv.get_size(); _dcpomatic_context->set_dimensions(s.width, s.height); - auto grok = Config::instance()->grok().get_value_or({}); + auto grok = Config::instance()->grok(); if (!_messenger->launch_grok( _dcpomatic_context->location, _dcpomatic_context->width, diff --git a/src/lib/grok_j2k_encoder_thread.cc b/src/lib/grok_j2k_encoder_thread.cc index e6c256f11..d6825113c 100644 --- a/src/lib/grok_j2k_encoder_thread.cc +++ b/src/lib/grok_j2k_encoder_thread.cc @@ -62,7 +62,7 @@ try LOG_TIMING("encoder-pop thread=%1 frame=%2 eyes=%3", thread_id(), frame.index(), static_cast<int>(frame.eyes())); - auto grok = Config::instance()->grok().get_value_or({}); + auto grok = Config::instance()->grok(); if (_context->launch(frame, grok.selected) && _context->scheduleCompress(frame)) { frame_guard.cancel(); diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index 309fce0b3..50452fbad 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -98,7 +98,7 @@ J2KEncoder::J2KEncoder(shared_ptr<const Film> film, Writer& writer) #endif { #ifdef DCPOMATIC_GROK - auto grok = Config::instance()->grok().get_value_or({}); + auto grok = Config::instance()->grok(); _dcpomatic_context = new grk_plugin::DcpomaticContext(film, writer, _history, grok.binary_location); if (grok.enable) { _context = new grk_plugin::GrokContext(_dcpomatic_context); @@ -135,7 +135,7 @@ J2KEncoder::servers_list_changed() { auto config = Config::instance(); #ifdef DCPOMATIC_GROK - auto const grok_enable = config->grok().get_value_or({}).enable; + auto const grok_enable = config->grok().enable; #else auto const grok_enable = false; #endif @@ -162,7 +162,7 @@ void J2KEncoder::pause() { #ifdef DCPOMATIC_GROK - if (!Config::instance()->grok().get_value_or({}).enable) { + if (!Config::instance()->grok().enable) { return; } return; @@ -183,7 +183,7 @@ J2KEncoder::pause() void J2KEncoder::resume() { #ifdef DCPOMATIC_GROK - if (!Config::instance()->grok().get_value_or({}).enable) { + if (!Config::instance()->grok().enable) { return; } @@ -226,7 +226,7 @@ J2KEncoder::end() */ for (auto & i: _queue) { #ifdef DCPOMATIC_GROK - if (Config::instance()->grok().get_value_or({}).enable) { + if (Config::instance()->grok().enable) { if (!_context->scheduleCompress(i)){ LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), i.index()); // handle error diff --git a/src/lib/util.cc b/src/lib/util.cc index df15e1abb..1e2f7d61f 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -1146,7 +1146,7 @@ setup_grok_library_path() } } auto const grok = Config::instance()->grok(); - if (!grok || grok->binary_location.empty()) { + if (grok.binary_location.empty()) { setenv("LD_LIRARY_PATH", old_path.c_str(), 1); return; } @@ -1155,7 +1155,7 @@ setup_grok_library_path() if (!new_path.empty()) { new_path += ":"; } - new_path += grok->binary_location.string(); + new_path += grok.binary_location.string(); setenv("LD_LIBRARY_PATH", new_path.c_str(), 1); } |
