: _film (film)
, _history (200)
, _writer (writer)
+{
#ifdef DCPOMATIC_GROK
- , _dcpomatic_context(new grk_plugin::DcpomaticContext(film, writer, _history, Config::instance()->gpu_binary_location()))
- , _context(Config::instance()->enable_gpu() ? new grk_plugin::GrokContext(_dcpomatic_context) : nullptr)
+ auto grok = Config::instance()->grok().get_value_or({});
+ _dcpomatic_context = new grk_plugin::DcpomaticContext(film, writer, _history, grok.binary_location);
+ if (grok.enable) {
+ _context = new grk_plugin::GrokContext(_dcpomatic_context);
+ }
#endif
-{
}
J2KEncoder::servers_list_changed()
{
auto config = Config::instance();
+#ifdef DCPOMATIC_GROK
+ auto const grok_enable = config->grok().get_value_or({}).enable;
+#else
+ auto const grok_enable = false;
+#endif
- auto const cpu = (config->enable_gpu() || config->only_servers_encode()) ? 0 : config->master_encoding_threads();
- auto const gpu = config->enable_gpu() ? config->master_encoding_threads() : 0;
+ auto const cpu = (grok_enable || config->only_servers_encode()) ? 0 : config->master_encoding_threads();
+ auto const gpu = grok_enable ? config->master_encoding_threads() : 0;
remake_threads(cpu, gpu, EncodeServerFinder::instance()->servers());
}
void
J2KEncoder::pause()
{
- if (!Config::instance()->enable_gpu()) {
+#ifdef DCPOMATIC_GROK
+ if (!Config::instance()->grok().get_value_or({}).enable) {
return;
}
+ return;
terminate_threads ();
/* Something might have been thrown during terminate_threads */
rethrow ();
-#ifdef DCPOMATIC_GROK
delete _context;
_context = nullptr;
#endif
void J2KEncoder::resume()
{
- if (!Config::instance()->enable_gpu()) {
+#ifdef DCPOMATIC_GROK
+ if (!Config::instance()->grok().get_value_or({}).enable) {
return;
}
-#ifdef DCPOMATIC_GROK
_context = new grk_plugin::GrokContext(_dcpomatic_context);
-#endif
servers_list_changed();
+#endif
}
*/
for (auto & i: _queue) {
#ifdef DCPOMATIC_GROK
- if (Config::instance()->enable_gpu ()) {
+ if (Config::instance()->grok().get_value_or({}).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
void
-#ifdef DCPOMATIC_GROK
J2KEncoder::remake_threads(int cpu, int gpu, list<EncodeServerDescription> servers)
-#else
-J2KEncoder::remake_threads(int cpu, int, list<EncodeServerDescription> servers)
-#endif
{
+ LOG_GENERAL("Making threads: CPU=%1, GPU=%2, Remote=%3", cpu, gpu, servers.size());
+
boost::mutex::scoped_lock lm (_threads_mutex);
if (_ending) {
return;