diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-07-08 00:20:15 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-01-28 02:01:57 +0100 |
| commit | b054a6fe8359d91ed6afd5a250abd766cfafa196 (patch) | |
| tree | 9259fe00b1f7fec6df0ae04d58896df61f1ea8ee /src/lib/j2k_encoder.cc | |
| parent | d76a9783fcc97a8a833ae060f70b12c144994651 (diff) | |
Formatting, variable name tidying and some const correctness.
Diffstat (limited to 'src/lib/j2k_encoder.cc')
| -rw-r--r-- | src/lib/j2k_encoder.cc | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index e2fca09b1..defde2227 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -61,9 +61,9 @@ static grk_plugin::GrokInitializer grokInitializer; J2KEncoder::J2KEncoder(shared_ptr<const Film> film, Writer& writer) : _film (film) , _history (200) - , _writer (writer) , - dcpomaticContext_(film,writer,_history, Config::instance()->gpu_binary_location ()), - context_(Config::instance()->enable_gpu () ? new grk_plugin::GrokContext(dcpomaticContext_) : nullptr) + , _writer (writer) + , _dcpomatic_context(film, writer, _history, Config::instance()->gpu_binary_location()) + , _context(Config::instance()->enable_gpu() ? new grk_plugin::GrokContext(_dcpomatic_context) : nullptr) { } @@ -77,7 +77,7 @@ J2KEncoder::~J2KEncoder () terminate_threads (); } - delete context_; + delete _context; } void @@ -89,18 +89,25 @@ J2KEncoder::begin () servers_list_changed (); } -void J2KEncoder::pause(void){ - if (Config::instance()->enable_gpu ()) + +void +J2KEncoder::pause() +{ + if (Config::instance()->enable_gpu()) { end(false); + } } -void J2KEncoder::resume(void){ - if (Config::instance()->enable_gpu ()) { - context_ = new grk_plugin::GrokContext(dcpomaticContext_); - servers_list_changed (); + +void J2KEncoder::resume() +{ + if (Config::instance()->enable_gpu()) { + _context = new grk_plugin::GrokContext(_dcpomatic_context); + servers_list_changed(); } } + void J2KEncoder::end (bool isFinal) { @@ -141,7 +148,7 @@ J2KEncoder::end (bool isFinal) if (isFinal) { for (auto & i: _queue) { if (Config::instance()->enable_gpu ()) { - if (!context_->scheduleCompress(i)){ + if (!_context->scheduleCompress(i)){ LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), i.index()); // handle error } @@ -161,8 +168,8 @@ J2KEncoder::end (bool isFinal) } } } - delete context_; - context_ = nullptr; + delete _context; + _context = nullptr; } @@ -367,8 +374,8 @@ try } } else { - if (context_) { - if (!context_->launch(vf, config->selected_gpu()) || !context_->scheduleCompress(vf)) { + if (_context) { + if (!_context->launch(vf, config->selected_gpu()) || !_context->scheduleCompress(vf)) { LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), vf.index()); _queue.push_front (vf); } |
