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

Message ID 20191028022525.796995-7-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • libcamera: Rework buffer API
Related show

Commit Message

Niklas Söderlund Oct. 28, 2019, 2:25 a.m. UTC
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@ragnatech.se>
---
 include/libcamera/stream.h | 4 ++++
 1 file changed, 4 insertions(+)

Patch

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);