[libcamera-devel] [RFC 06/12] libcamera: stream: Add prototypes for new interface

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


The buffer allocation rework will remove most of the methods in the
Stream class. The methods who deals with buffers will be virtual and
implemented in a subclass. This change adds the prototypes for the new
interface with an empty default implementation.

Once the new buffer allocation work is completed the two added
prototypes here will be turned into pure virtual functions preventing
the base Stream class from being instantiated.

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

diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h
index 2e619cdf0e89bbc7..dac4831cfa1a9b1d 100644
--- a/include/libcamera/stream.h
+++ b/include/libcamera/stream.h
@@ -73,6 +73,7 @@ class Stream
 {
 public:
 	Stream();
+	virtual ~Stream(){};
 
 	std::unique_ptr<Buffer> createBuffer(unsigned int index);
 	std::unique_ptr<Buffer> createBuffer(const std::array<int, 3> &fds);
@@ -85,6 +86,9 @@ public:
 protected:
 	friend class Camera;
 
+	virtual int allocateBuffers(std::vector<Buffer *> *buffers) { return -EINVAL; }
+	virtual int importBuffers(bool enable) { return -EINVAL; }
+
 	int mapBuffer(const Buffer *buffer);
 	void unmapBuffer(const Buffer *buffer);
 
-- 
2.23.0



More information about the libcamera-devel mailing list