diff options
Diffstat (limited to 'include/libcamera/buffer.h')
-rw-r--r-- | include/libcamera/buffer.h | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h index 260a62e9..f5ba6207 100644 --- a/include/libcamera/buffer.h +++ b/include/libcamera/buffer.h @@ -14,6 +14,7 @@ namespace libcamera { class BufferPool; class Request; +class Stream; class Plane final { @@ -36,6 +37,30 @@ private: void *mem_; }; +class BufferMemory final +{ +public: + std::vector<Plane> &planes() { return planes_; } + +private: + std::vector<Plane> planes_; +}; + +class BufferPool final +{ +public: + ~BufferPool(); + + void createBuffers(unsigned int count); + void destroyBuffers(); + + unsigned int count() const { return buffers_.size(); } + std::vector<BufferMemory> &buffers() { return buffers_; } + +private: + std::vector<BufferMemory> buffers_; +}; + class Buffer final { public: @@ -45,20 +70,24 @@ public: BufferCancelled, }; - Buffer(); + Buffer(unsigned int index = -1, const Buffer *metadata = nullptr); + Buffer(const Buffer &) = delete; + Buffer &operator=(const Buffer &) = delete; unsigned int index() const { return index_; } + unsigned int bytesused() const { return bytesused_; } uint64_t timestamp() const { return timestamp_; } unsigned int sequence() const { return sequence_; } + Status status() const { return status_; } - std::vector<Plane> &planes() { return planes_; } Request *request() const { return request_; } + Stream *stream() const { return stream_; } private: - friend class BufferPool; friend class PipelineHandler; friend class Request; + friend class Stream; friend class V4L2VideoDevice; void cancel(); @@ -66,28 +95,14 @@ private: void setRequest(Request *request) { request_ = request; } unsigned int index_; + unsigned int bytesused_; uint64_t timestamp_; unsigned int sequence_; - Status status_; - std::vector<Plane> planes_; + Status status_; Request *request_; -}; - -class BufferPool final -{ -public: - ~BufferPool(); - - void createBuffers(unsigned int count); - void destroyBuffers(); - - unsigned int count() const { return buffers_.size(); } - std::vector<Buffer> &buffers() { return buffers_; } - -private: - std::vector<Buffer> buffers_; + Stream *stream_; }; } /* namespace libcamera */ |