[libcamera-devel] [RFC 07/12] libcamera: buffer: Add dedicated container for buffer information

Niklas Söderlund niklas.soderlund at ragnatech.se
Mon Oct 28 03:25:20 CET 2019


The Buffer object will be split in two, one containing the memory and
one containing the information recorded from when the buffer is
dequeued. Add a container for the later in preparation for the split.

Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
 include/libcamera/buffer.h | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
index 54c757ef7db8b5f6..c626f669040b3c04 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -105,6 +105,40 @@ private:
 	Stream *stream_;
 };
 
+class BufferInfo
+{
+public:
+	enum Status {
+		BufferSuccess,
+		BufferError,
+		BufferCancelled,
+	};
+
+	struct PlaneInfo {
+		unsigned int bytesused;
+	};
+
+	BufferInfo(Status status, unsigned int sequence, uint64_t timestamp,
+		   const std::vector<PlaneInfo> &planes)
+		: status_(status), sequence_(sequence), timestamp_(timestamp),
+		  planes_(planes)
+	{
+	}
+
+	Status status() const { return status_; }
+	unsigned int sequence() const { return sequence_; }
+	unsigned int timestamp() const { return timestamp_; }
+
+	unsigned int planes() const { return planes_.size(); }
+	const PlaneInfo &plane(unsigned int plane) const { return planes_.at(plane); }
+
+private:
+	Status status_;
+	unsigned int sequence_;
+	uint64_t timestamp_;
+	std::vector<PlaneInfo> planes_;
+};
+
 } /* namespace libcamera */
 
 #endif /* __LIBCAMERA_BUFFER_H__ */
-- 
2.23.0



More information about the libcamera-devel mailing list