summaryrefslogtreecommitdiff
path: root/src/libcamera/camera.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-02-28 17:59:10 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-03-01 20:46:40 +0200
commitb2c06cf40975398eb56be74fa3cd5d1b7b13cb50 (patch)
treeef4b85d6dc15b6f3eae21d3807986d4d790251e1 /src/libcamera/camera.cpp
parent1accc258cc8efb077f8437be702646583ee61ca6 (diff)
libcamera: Handle request completion explicitly in pipeline handlers
Request complete by themselves when all the buffers they contain have completed, connecting the buffer's completed signal to be notified of buffer completion. While this works for now, it prevents pipelines from delaying request completion until all metadata is available, and makes it impossible to ensure that requests complete in the order they are queued. To fix this, make request completion handling explicit in pipeline handlers. The base PipelineHandler class is extended with implementations of the queueRequest() and stop() methods and gets new completeBuffer() and completeRequest() methods to help pipeline handlers tracking requests and buffers. The three existing pipeline handlers connect the bufferReady signal of their capture video node to a slot of their respective camera data instance, where they use the PipelineHandler helpers to notify buffer and request completion. Request completion is handled synchronously with buffer completion as the pipeline handlers don't need to support more advanced use cases, but this paves the road for future work. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/camera.cpp')
-rw-r--r--src/libcamera/camera.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp
index 3090874b..8e17085b 100644
--- a/src/libcamera/camera.cpp
+++ b/src/libcamera/camera.cpp
@@ -175,6 +175,12 @@ const std::string &Camera::name() const
}
/**
+ * \var Camera::bufferCompleted
+ * \brief Signal emitted when a buffer for a request queued to the camera has
+ * completed
+ */
+
+/**
* \var Camera::requestCompleted
* \brief Signal emitted when a request queued to the camera has completed
*/
@@ -606,4 +612,19 @@ int Camera::stop()
return 0;
}
+/**
+ * \brief Handle request completion and notify application
+ * \param[in] request The request that has completed
+ *
+ * This function is called by the pipeline handler to notify the camera that
+ * the request has completed. It emits the requestCompleted signal and deletes
+ * the request.
+ */
+void Camera::requestComplete(Request *request)
+{
+ std::map<Stream *, Buffer *> buffers(std::move(request->bufferMap_));
+ requestCompleted.emit(request, buffers);
+ delete request;
+}
+
} /* namespace libcamera */