[libcamera-devel] [PATCH] libcamera: request: Facilitate retrieval of the camera

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Aug 14 15:37:14 CEST 2020


Provide a means of identifying the Camera object which created the Request.

This allows identifying the correct Camera device to work with in completion
callbacks which are not otherwise wrapped with a means to identify the
Camera responsible for completion.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 include/libcamera/request.h | 2 ++
 src/libcamera/request.cpp   | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index eded68318b7d..ae8d450da20b 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -36,6 +36,8 @@ public:
 	Request &operator=(const Request &) = delete;
 	~Request();
 
+	Camera *camera() const { return camera_; }
+
 	ControlList &controls() { return *controls_; }
 	ControlList &metadata() { return *metadata_; }
 	const std::map<Stream *, FrameBuffer *> &buffers() const { return bufferMap_; }
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index f3753514131a..3ef0e061a270 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -80,6 +80,13 @@ Request::~Request()
 	delete validator_;
 }
 
+/**
+ * \fn Request::camera()
+ * \brief Retrieve the camera that created the request
+ *
+ * \return A pointer to the camera associated with the request
+ */
+
 /**
  * \fn Request::controls()
  * \brief Retrieve the request's ControlList
-- 
2.25.1



More information about the libcamera-devel mailing list