[libcamera-devel,v2,5/7] libcamera: FrameBuffer: Add a setRequest() interface

Message ID 20200326225844.4117712-6-niklas.soderlund@ragnatech.se
State Accepted
Headers show
Series
  • libcamera: Add support for a RAW still capture
Related show

Commit Message

Niklas Söderlund March 26, 2020, 10:58 p.m. UTC
Add the ability to set the Request a buffer is associated with. This is
needed for buffers that live inside a pipeline handler and is
temporarily associated with a request as it's being processed inside the
pipeline.

While we are at it delete a stray semicolon.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/buffer.h |  3 ++-
 src/libcamera/buffer.cpp   | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

Patch

diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
index ef3a3b36cd4e4e17..6bb2e4f8558f03ac 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -52,7 +52,8 @@  public:
 	const std::vector<Plane> &planes() const { return planes_; }
 
 	Request *request() const { return request_; }
-	const FrameMetadata &metadata() const { return metadata_; };
+	void setRequest(Request *request) { request_ = request; }
+	const FrameMetadata &metadata() const { return metadata_; }
 
 	unsigned int cookie() const { return cookie_; }
 	void setCookie(unsigned int cookie) { cookie_ = cookie; }
diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index 93057568fc56a6f5..0c5e56cf10621ab2 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -182,6 +182,17 @@  FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)
  * not associated with a request
  */
 
+/**
+ * \fn FrameBuffer::setRequest()
+ * \brief Set the request this buffer belongs to
+ * \param[in] request Request to set
+ *
+ * The intended callers of this method are pipeline handlers and only for
+ * buffers that are internal to the pipeline.
+ *
+ * \todo Shall be hidden from applications with a d-pointer design.
+ */
+
 /**
  * \fn FrameBuffer::metadata()
  * \brief Retrieve the dynamic metadata