summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera.cpp13
-rw-r--r--src/libcamera/pipeline_handler.cpp20
2 files changed, 27 insertions, 6 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 86d84ac0..bb856d60 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -1074,12 +1074,19 @@ int Camera::configure(CameraConfiguration *config)
*/
std::unique_ptr<Request> Camera::createRequest(uint64_t cookie)
{
- int ret = _d()->isAccessAllowed(Private::CameraConfigured,
- Private::CameraRunning);
+ Private *const d = _d();
+
+ int ret = d->isAccessAllowed(Private::CameraConfigured,
+ Private::CameraRunning);
if (ret < 0)
return nullptr;
- return std::make_unique<Request>(this, cookie);
+ std::unique_ptr<Request> request = std::make_unique<Request>(this, cookie);
+
+ /* Associate the request with the pipeline handler. */
+ d->pipe_->registerRequest(request.get());
+
+ return request;
}
/**
diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
index 03e4b9e6..7ebd76ad 100644
--- a/src/libcamera/pipeline_handler.cpp
+++ b/src/libcamera/pipeline_handler.cpp
@@ -338,6 +338,23 @@ bool PipelineHandler::hasPendingRequests(const Camera *camera) const
}
/**
+ * \fn PipelineHandler::registerRequest()
+ * \brief Register a request for use by the pipeline handler
+ * \param[in] request The request to register
+ *
+ * This function is called when the request is created, and allows the pipeline
+ * handler to perform any one-time initialization it requries for the request.
+ */
+void PipelineHandler::registerRequest(Request *request)
+{
+ /*
+ * Connect the request prepared signal to notify the pipeline handler
+ * when a request is ready to be processed.
+ */
+ request->_d()->prepared.connect(this, &PipelineHandler::doQueueRequests);
+}
+
+/**
* \fn PipelineHandler::queueRequest()
* \brief Queue a request
* \param[in] request The request to queue
@@ -366,9 +383,6 @@ void PipelineHandler::queueRequest(Request *request)
waitingRequests_.push(request);
- request->_d()->prepared.connect(this, [this]() {
- doQueueRequests();
- });
request->_d()->prepare(300ms);
}