summaryrefslogtreecommitdiff
path: root/src/lib/grok/context.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-10-04 19:11:45 +0200
committerCarl Hetherington <cth@carlh.net>2024-01-28 02:01:57 +0100
commitd76a96b6c92f708162eaa542f316fe6247410967 (patch)
tree765d678a1deb97bb591296c30a57ca6f8a7a1ca4 /src/lib/grok/context.h
parent91817226ade75dd8e35e979131ac038bb161d7f9 (diff)
Another patch from Aaron.
Diffstat (limited to 'src/lib/grok/context.h')
-rw-r--r--src/lib/grok/context.h48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/lib/grok/context.h b/src/lib/grok/context.h
index 96477d597..e7b5dbcbc 100644
--- a/src/lib/grok/context.h
+++ b/src/lib/grok/context.h
@@ -20,6 +20,9 @@
#pragma once
+#include <boost/filesystem.hpp>
+namespace fs = boost::filesystem;
+
#include "../config.h"
#include "../dcp_video.h"
#include "../film.h"
@@ -106,10 +109,11 @@ struct DcpomaticContext {
class GrokContext
{
public:
- explicit GrokContext(DcpomaticContext* dcpomatic_context)
- : _dcpomatic_context(dcpomatic_context)
- , messenger_(nullptr)
- , launched_(false)
+ explicit GrokContext(DcpomaticContext* dcpomatic_context) :
+ _dcpomatic_context(dcpomatic_context),
+ messenger_(nullptr),
+ launched_(false),
+ launchFailed_(false)
{
if (Config::instance()->enable_gpu ()) {
boost::filesystem::path folder(_dcpomatic_context->_location);
@@ -170,29 +174,40 @@ public:
return false;
if (launched_)
return true;
+ if (launchFailed_)
+ return false;
std::unique_lock<std::mutex> lk_global(launchMutex);
if (!messenger_)
return false;
if (launched_)
return true;
+ if (launchFailed_)
+ return false;
if (MessengerInit::firstLaunch(true)) {
+
+ if (!fs::exists(_dcpomatic_context->_location) || !fs::is_directory(_dcpomatic_context->_location)) {
+ getMessengerLogger()->error("Invalid directory %s", _dcpomatic_context->_location.c_str());
+ return false;
+ }
auto s = dcpv.get_size();
_dcpomatic_context->setDimensions(s.width, s.height);
auto config = Config::instance();
- messenger_->launchGrok(
- _dcpomatic_context->_location,
- _dcpomatic_context->width_,_dcpomatic_context->width_,
- _dcpomatic_context->height_,
- 3, 12, device,
- _dcpomatic_context->film_->resolution() == Resolution::FOUR_K,
- _dcpomatic_context->film_->video_frame_rate(),
- _dcpomatic_context->film_->j2k_bandwidth(),
- config->gpu_license_server(),
- config->gpu_license_port(),
- config->gpu_license()
- );
+ if (!messenger_->launchGrok(_dcpomatic_context->_location,
+ _dcpomatic_context->width_,_dcpomatic_context->width_,
+ _dcpomatic_context->height_,
+ 3, 12, device,
+ _dcpomatic_context->film_->resolution() == Resolution::FOUR_K,
+ _dcpomatic_context->film_->video_frame_rate(),
+ _dcpomatic_context->film_->j2k_bandwidth(),
+ config->gpu_license_server(),
+ config->gpu_license_port(),
+ config->gpu_license())) {
+ launchFailed_ = true;
+ return false;
+ }
}
launched_ = messenger_->waitForClientInit();
+ launchFailed_ = launched_;
return launched_;
}
@@ -226,6 +241,7 @@ private:
DcpomaticContext* _dcpomatic_context;
ScheduledMessenger<FrameProxy> *messenger_;
bool launched_;
+ bool launchFailed_;
};
}