summaryrefslogtreecommitdiff
path: root/src/cam/camera_session.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cam/camera_session.cpp')
-rw-r--r--src/cam/camera_session.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp
index 0bb95c8b..76d552d9 100644
--- a/src/cam/camera_session.cpp
+++ b/src/cam/camera_session.cpp
@@ -14,6 +14,7 @@
#include <libcamera/property_ids.h>
#include "camera_session.h"
+#include "capture_script.h"
#include "event_loop.h"
#include "file_sink.h"
#ifdef HAVE_KMS
@@ -91,6 +92,16 @@ CameraSession::CameraSession(CameraManager *cm,
}
#endif
+ if (options_.isSet(OptCaptureScript)) {
+ std::string scriptName = options_[OptCaptureScript].toString();
+ script_ = std::make_unique<CaptureScript>(camera_, scriptName);
+ if (!script_->valid()) {
+ std::cerr << "Invalid capture script '" << scriptName
+ << "'" << std::endl;
+ return;
+ }
+ }
+
switch (config->validate()) {
case CameraConfiguration::Valid:
break;
@@ -322,6 +333,9 @@ int CameraSession::queueRequest(Request *request)
if (captureLimit_ && queueCount_ >= captureLimit_)
return 0;
+ if (script_)
+ request->controls() = script_->frameControls(queueCount_);
+
queueCount_++;
return camera_->queueRequest(request);