[libcamera-devel] [PATCH 07/13] libcamera: request: Add RequestData

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Aug 28 03:17:04 CEST 2019


Add a RequestData pointer to the Request class, this is intended to be
used by pipeline handlers while handling the request and is invalid
outside the pipeline handler context.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 include/libcamera/request.h |  5 +++++
 src/libcamera/request.cpp   | 10 +++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index 9edf1cedc054014f..570924c5ef5e2425 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -21,6 +21,9 @@ class Buffer;
 class Camera;
 class Stream;
 
+class RequestData
+{
+};
 
 class Request
 {
@@ -46,6 +49,8 @@ public:
 
 	bool hasPendingBuffers() const { return !pending_.empty(); }
 
+	RequestData *data;
+
 private:
 	friend class Camera;
 	friend class PipelineHandler;
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index ee2158fc7a9cf0b9..4d7bf177534267ac 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -55,7 +55,7 @@ LOG_DEFINE_CATEGORY(Request)
  *
  */
 Request::Request(Camera *camera, uint64_t cookie)
-	: camera_(camera), controls_(camera), cookie_(cookie),
+	: data(nullptr), camera_(camera), controls_(camera), cookie_(cookie),
 	  status_(RequestPending), cancelled_(false)
 {
 }
@@ -178,6 +178,14 @@ Buffer *Request::findBuffer(Stream *stream) const
  * otherwise
  */
 
+/**
+ * \var Request::data
+ * \brief Pipeline handler specific data
+ *
+ * Pipeline handlers may associate private data with with an request that
+ * is valid for the requests liftime inside the pipeline handler.
+ */
+
 /**
  * \brief Validate the request and prepare it for the completion handler
  *
-- 
2.22.1



More information about the libcamera-devel mailing list