summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-05-16 22:59:25 +0200
committerCarl Hetherington <cth@carlh.net>2025-05-28 00:33:55 +0200
commitec66fd6126bc1a29539a65ace35bbae8c03796f6 (patch)
treebde3f48d607b8574b3a7dcd12a1f8f1f4972d343
parent59a6f3dcb71d58f999f5719cdea4c8ff5b65fd90 (diff)
Cleanup: remove templates that are only instantiated once.
-rw-r--r--src/lib/grok/context.h4
-rw-r--r--src/lib/grok/messenger.h25
2 files changed, 16 insertions, 13 deletions
diff --git a/src/lib/grok/context.h b/src/lib/grok/context.h
index 4c7e4304a..ef87a2af5 100644
--- a/src/lib/grok/context.h
+++ b/src/lib/grok/context.h
@@ -161,7 +161,7 @@ public:
std::thread::hardware_concurrency()
);
- _messenger = new ScheduledMessenger<DCPVideo>(clientInit);
+ _messenger = new ScheduledMessenger(clientInit);
}
~GrokContext()
@@ -263,7 +263,7 @@ private:
}
DcpomaticContext* _dcpomatic_context;
- ScheduledMessenger<DCPVideo>* _messenger = nullptr;
+ ScheduledMessenger* _messenger = nullptr;
bool _launched = false;
bool _launch_failed = false;
};
diff --git a/src/lib/grok/messenger.h b/src/lib/grok/messenger.h
index 6b0571655..99c9b35ac 100644
--- a/src/lib/grok/messenger.h
+++ b/src/lib/grok/messenger.h
@@ -19,6 +19,8 @@
*/
#pragma once
+#include "../dcp_video.h"
+
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
@@ -51,6 +53,8 @@
#include <signal.h>
#endif
+
+
namespace grk_plugin
{
static std::string grokToClientMessageBuf = "Global\\grok_to_client_message";
@@ -546,24 +550,23 @@ struct Msg
};
-template<typename F>
struct ScheduledFrames
{
- void store(F const& val)
+ void store(DCPVideo const& val)
{
std::unique_lock<std::mutex> lk(mapMutex_);
auto it = map_.find(val.index());
if (it == map_.end())
map_.emplace(std::make_pair(val.index(), val));
}
- boost::optional<F> retrieve(size_t index)
+ boost::optional<DCPVideo> retrieve(size_t index)
{
std::unique_lock<std::mutex> lk(mapMutex_);
auto it = map_.find(index);
if(it == map_.end())
return {};
- F val = it->second;
+ DCPVideo val = it->second;
map_.erase(index);
return val;
@@ -571,10 +574,10 @@ struct ScheduledFrames
private:
std::mutex mapMutex_;
- std::map<size_t, F> map_;
+ std::map<size_t, DCPVideo> map_;
};
-template<typename F>
+
struct ScheduledMessenger : public Messenger
{
explicit ScheduledMessenger(MessengerInit init)
@@ -588,7 +591,7 @@ struct ScheduledMessenger : public Messenger
shutdown();
}
- bool schedule_compress(F const& proxy, std::function<void(BufferSrc const&)> converter)
+ bool schedule_compress(DCPVideo const& proxy, std::function<void(BufferSrc const&)> converter)
{
BufferSrc src;
if (!_available_buffers.waitAndPop(src)) {
@@ -603,7 +606,7 @@ struct ScheduledMessenger : public Messenger
}
/** @param processor function taking compressed J2K data and sending it to the Writer */
- void process_compressed(std::string const& message, std::function<void (F, uint8_t*, uint32_t)> processor, bool needsRecompression)
+ void process_compressed(std::string const& message, std::function<void (DCPVideo, uint8_t*, uint32_t)> processor, bool needsRecompression)
{
Msg msg(message);
msg.next();
@@ -651,16 +654,16 @@ struct ScheduledMessenger : public Messenger
}
}
- boost::optional<F> retrieve(size_t index) {
+ boost::optional<DCPVideo> retrieve(size_t index) {
return _scheduled_frames.retrieve(index);
}
- void store(F& val) {
+ void store(DCPVideo& val) {
_scheduled_frames.store(val);
}
private:
- ScheduledFrames<F> _scheduled_frames;
+ ScheduledFrames _scheduled_frames;
std::atomic<uint32_t> _frames_scheduled;
std::atomic<uint32_t> _frames_compressed;
};