From de9243bdc1986c57bee4dae3a5ba4fc8fc4293fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Mon, 25 Nov 2019 20:53:38 +0100 Subject: libcamera: buffer: Add FrameBuffer interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new FrameBuffer class to describe memory used to store frames. This change just adds the new interface, future patches will migrate all parts of libcamera to use this and replace the old Buffer interface. This change needs to specify the const keyword for Plane::length() as to not get Doxygen confused with FrameBuffer::Plane::length added in this change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/buffer.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'include') diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 0b95e41a..e66e9c9c 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -11,6 +11,8 @@ #include #include +#include + namespace libcamera { class Request; @@ -33,6 +35,42 @@ struct FrameMetadata { std::vector planes; }; +class FrameBuffer final +{ +public: + struct Plane { + FileDescriptor fd; + unsigned int length; + }; + + FrameBuffer(const std::vector &planes, unsigned int cookie = 0); + + FrameBuffer(const FrameBuffer &) = delete; + FrameBuffer(FrameBuffer &&) = delete; + + FrameBuffer &operator=(const FrameBuffer &) = delete; + FrameBuffer &operator=(FrameBuffer &&) = delete; + + const std::vector &planes() const { return planes_; } + + Request *request() const { return request_; } + const FrameMetadata &metadata() const { return metadata_; }; + + unsigned int cookie() const { return cookie_; } + void setCookie(unsigned int cookie) { cookie_ = cookie; } + +private: + friend class Request; /* Needed to update request_. */ + friend class V4L2VideoDevice; /* Needed to update metadata_. */ + + std::vector planes_; + + Request *request_; + FrameMetadata metadata_; + + unsigned int cookie_; +}; + class Plane final { public: -- cgit v1.2.1