From ee027781b4c265b378ed16f91eeded7b42f5dfe4 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Tue, 9 Apr 2019 11:27:29 +0200 Subject: libcamera: buffer: Store Request reference in Buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add to the Buffer class methods to set and retrieve a reference to the Request instance the buffer is part of. As buffers outlive the Request they are associated with, the reference is only temporary valid during the buffer completion interval (from when the buffer gets queued to Camera for processing, until it gets marked as completed). Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- include/libcamera/buffer.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 0c844d12..8f9b42e3 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -13,6 +13,7 @@ namespace libcamera { class BufferPool; +class Request; class Plane final { @@ -52,14 +53,18 @@ public: unsigned int sequence() const { return sequence_; } Status status() const { return status_; } std::vector &planes() { return planes_; } + Request *request() const { return request_; } private: friend class BufferPool; friend class PipelineHandler; + friend class Request; friend class V4L2Device; void cancel(); + void setRequest(Request *request) { request_ = request; } + unsigned int index_; unsigned int bytesused_; uint64_t timestamp_; @@ -67,6 +72,7 @@ private: Status status_; std::vector planes_; + Request *request_; }; class BufferPool final -- cgit v1.2.1