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)
{
}
terminate_threads ();
}
- delete context_;
+ delete _context;
}
void
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)
{
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
}
}
}
}
- delete context_;
- context_ = nullptr;
+ delete _context;
+ _context = nullptr;
}
}
} 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);
}