summaryrefslogtreecommitdiff
path: root/include/libcamera/buffer.h
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-11-25 20:53:38 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-01-12 16:10:37 +0100
commitde9243bdc1986c57bee4dae3a5ba4fc8fc4293fe (patch)
treed8fb4636484af808267963092078726066d9fd72 /include/libcamera/buffer.h
parent9c4bc73c2f4499d5aadba6b899d8e20876f65612 (diff)
libcamera: buffer: Add FrameBuffer interface
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 <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include/libcamera/buffer.h')
-rw-r--r--include/libcamera/buffer.h38
1 files changed, 38 insertions, 0 deletions
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 <stdint.h>
#include <vector>
+#include <libcamera/file_descriptor.h>
+
namespace libcamera {
class Request;
@@ -33,6 +35,42 @@ struct FrameMetadata {
std::vector<Plane> planes;
};
+class FrameBuffer final
+{
+public:
+ struct Plane {
+ FileDescriptor fd;
+ unsigned int length;
+ };
+
+ FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
+
+ FrameBuffer(const FrameBuffer &) = delete;
+ FrameBuffer(FrameBuffer &&) = delete;
+
+ FrameBuffer &operator=(const FrameBuffer &) = delete;
+ FrameBuffer &operator=(FrameBuffer &&) = delete;
+
+ const std::vector<Plane> &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<Plane> planes_;
+
+ Request *request_;
+ FrameMetadata metadata_;
+
+ unsigned int cookie_;
+};
+
class Plane final
{
public: