libcamera: stream: Add Stream memory type
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 <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
committed by
Laurent Pinchart
parent
be3e3ebc92
commit
99e1e786b4
@@ -35,6 +35,11 @@ private:
|
||||
std::map<unsigned int, std::vector<SizeRange>> 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<BufferMemory> &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 */
|
||||
|
||||
Reference in New Issue
Block a user