summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-09-24 12:09:16 +0200
committerCarl Hetherington <cth@carlh.net>2024-01-28 02:01:57 +0100
commita72355666ed6abbd02bc6b124fddd24f598f89de (patch)
tree2875ac4d9120bf76cb6d09957466e0a5ea51aa5e /src/lib
parentd2350127d51cb6afa2892d888aea6fea06be074d (diff)
Only build grok for Ubuntu 22.04.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/j2k_encoder.cc27
-rw-r--r--src/lib/j2k_encoder.h6
-rw-r--r--src/lib/writer.h1
-rw-r--r--src/lib/wscript4
4 files changed, 32 insertions, 6 deletions
diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc
index c023e4bf3..7d695245a 100644
--- a/src/lib/j2k_encoder.cc
+++ b/src/lib/j2k_encoder.cc
@@ -33,7 +33,9 @@
#include "encode_server_finder.h"
#include "film.h"
#include "cpu_j2k_encoder_thread.h"
+#ifdef DCPOMATIC_GROK
#include "grok_j2k_encoder_thread.h"
+#endif
#include "remote_j2k_encoder_thread.h"
#include "j2k_encoder.h"
#include "log.h"
@@ -65,8 +67,10 @@ J2KEncoder::J2KEncoder(shared_ptr<const Film> film, Writer& writer)
: _film (film)
, _history (200)
, _writer (writer)
+#ifdef DCPOMATIC_GROK
, _dcpomatic_context(film, writer, _history, Config::instance()->gpu_binary_location())
, _context(Config::instance()->enable_gpu() ? new grk_plugin::GrokContext(_dcpomatic_context) : nullptr)
+#endif
{
}
@@ -77,7 +81,9 @@ J2KEncoder::~J2KEncoder ()
terminate_threads();
+#ifdef DCPOMATIC_GROK
delete _context;
+#endif
}
@@ -115,8 +121,10 @@ J2KEncoder::pause()
/* Something might have been thrown during terminate_threads */
rethrow ();
+#ifdef DCPOMATIC_GROK
delete _context;
_context = nullptr;
+#endif
}
@@ -126,7 +134,9 @@ void J2KEncoder::resume()
return;
}
+#ifdef DCPOMATIC_GROK
_context = new grk_plugin::GrokContext(_dcpomatic_context);
+#endif
servers_list_changed();
}
@@ -163,13 +173,16 @@ J2KEncoder::end()
So just mop up anything left in the queue here.
*/
for (auto & i: _queue) {
+#ifdef DCPOMATIC_GROK
if (Config::instance()->enable_gpu ()) {
if (!_context->scheduleCompress(i)){
LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), i.index());
// handle error
}
- }
- else {
+ } else {
+#else
+ {
+#endif
LOG_GENERAL(N_("Encode left-over frame %1"), i.index());
try {
_writer.write(
@@ -184,8 +197,10 @@ J2KEncoder::end()
}
}
+#ifdef DCPOMATIC_GROK
delete _context;
_context = nullptr;
+#endif
}
@@ -311,7 +326,11 @@ J2KEncoder::terminate_threads ()
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
{
boost::mutex::scoped_lock lm (_threads_mutex);
if (_ending) {
@@ -345,7 +364,7 @@ J2KEncoder::remake_threads(int cpu, int gpu, list<EncodeServerDescription> serve
remove_threads(cpu, current_cpu_threads, is_cpu_thread);
-
+#ifdef DCPOMATIC_GROK
/* GPU */
auto const is_grok_thread = [](shared_ptr<J2KEncoderThread> thread) {
@@ -361,7 +380,7 @@ J2KEncoder::remake_threads(int cpu, int gpu, list<EncodeServerDescription> serve
}
remove_threads(gpu, current_gpu_threads, is_grok_thread);
-
+#endif
/* Remote */
diff --git a/src/lib/j2k_encoder.h b/src/lib/j2k_encoder.h
index a6e190dcf..9d9d85894 100644
--- a/src/lib/j2k_encoder.h
+++ b/src/lib/j2k_encoder.h
@@ -28,11 +28,13 @@
*/
-#include "grok/context.h"
#include "cross.h"
#include "enum_indexed_vector.h"
#include "event_history.h"
#include "exception_store.h"
+#ifdef DCPOMATIC_GROK
+#include "grok/context.h"
+#endif
#include "j2k_encoder_thread.h"
#include "writer.h"
#include <boost/optional.hpp>
@@ -122,8 +124,10 @@ private:
boost::signals2::scoped_connection _server_found_connection;
+#ifdef DCPOMATIC_GROK
grk_plugin::DcpomaticContext _dcpomatic_context;
grk_plugin::GrokContext *_context;
+#endif
bool _ending = false;
};
diff --git a/src/lib/writer.h b/src/lib/writer.h
index efb6a17d8..1cd278221 100644
--- a/src/lib/writer.h
+++ b/src/lib/writer.h
@@ -34,6 +34,7 @@
#include "exception_store.h"
#include "font_id_map.h"
#include "player_text.h"
+#include "text_type.h"
#include "weak_film.h"
#include <dcp/atmos_frame.h>
#include <boost/thread.hpp>
diff --git a/src/lib/wscript b/src/lib/wscript
index 00d50b279..89a7531b0 100644
--- a/src/lib/wscript
+++ b/src/lib/wscript
@@ -123,7 +123,6 @@ sources = """
font_id_map.cc
frame_interval_checker.cc
frame_rate_change.cc
- grok_j2k_encoder_thread.cc
guess_crop.cc
hints.cc
internet.cc
@@ -248,6 +247,9 @@ def build(bld):
if bld.env.TARGET_LINUX:
obj.uselib += ' POLKIT'
+ if bld.env.ENABLE_GROK:
+ obj.source += ' grok_j2k_encoder_thread.cc'
+
if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32:
obj.uselib += ' WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE SETUPAPI OLE32 UUID'
obj.source += ' cross_windows.cc'