From 99e1e786b475f3d6f4f8d9f5cd21db6c524ba60f Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Fri, 28 Jun 2019 09:13:34 +0200 Subject: libcamera: stream: Add Stream memory type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Define the memory type a Stream uses and allow application to set it through the associated StreamConfiguration. A Stream can use either internal or external memory allocation methods, depending on where the data produced by the stream is actually saved. Signed-off-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Signed-off-by: Laurent Pinchart --- include/libcamera/stream.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libcamera/stream.h b/include/libcamera/stream.h index bc14fb60..08eb8cc7 100644 --- a/include/libcamera/stream.h +++ b/include/libcamera/stream.h @@ -35,6 +35,11 @@ private: std::map> formats_; }; +enum MemoryType { + InternalMemory, + ExternalMemory, +}; + struct StreamConfiguration { StreamConfiguration(); StreamConfiguration(const StreamFormats &formats); @@ -42,6 +47,7 @@ struct StreamConfiguration { unsigned int pixelFormat; Size size; + MemoryType memoryType; unsigned int bufferCount; Stream *stream() const { return stream_; } @@ -73,15 +79,17 @@ public: BufferPool &bufferPool() { return bufferPool_; } std::vector &buffers() { return bufferPool_.buffers(); } const StreamConfiguration &configuration() const { return configuration_; } + MemoryType memoryType() const { return memoryType_; } protected: friend class Camera; - void createBuffers(unsigned int count); + void createBuffers(MemoryType memory, unsigned int count); void destroyBuffers(); BufferPool bufferPool_; StreamConfiguration configuration_; + MemoryType memoryType_; }; } /* namespace libcamera */ -- cgit v1.2.1