[libcamera-devel,3/4] libcamera: buffer: Provide access to the Buffer vector

Message ID 20190129135357.32339-4-kieran.bingham@ideasonboard.com
State Superseded
Headers show
Series
  • libcamera: Buffer Objects
Related show

Commit Message

Kieran Bingham Jan. 29, 2019, 1:53 p.m. UTC
Extend the BufferPool to support retrieving Buffers by receiving a reference to
the buffer vector.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 include/libcamera/buffer.h | 1 +
 src/libcamera/buffer.cpp   | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Laurent Pinchart Jan. 31, 2019, 9:08 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Tue, Jan 29, 2019 at 01:53:56PM +0000, Kieran Bingham wrote:
> Extend the BufferPool to support retrieving Buffers by receiving a reference to
> the buffer vector.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
> ---
>  include/libcamera/buffer.h | 1 +
>  src/libcamera/buffer.cpp   | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
> index 97c8025d9e77..dda5075f2879 100644
> --- a/include/libcamera/buffer.h
> +++ b/include/libcamera/buffer.h
> @@ -42,6 +42,7 @@ public:
>  	void free();
>  
>  	unsigned int count() const { return buffers_.size(); };
> +	const std::vector<Buffer *> &buffers() { return buffers_; };
>  
>  private:
>  	virtual int allocateMemory() = 0;
> diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
> index 5c580b540a67..4a870df77e92 100644
> --- a/src/libcamera/buffer.cpp
> +++ b/src/libcamera/buffer.cpp
> @@ -141,4 +141,9 @@ void BufferPool::free()
>   * \brief Get the number of Buffers contained within this pool
>   */
>  
> +/**
> + * \fn BufferPool::buffers()
> + * \brief Return a reference to the vector holding all buffers within the pool

 * \brief Retrieve all the buffers in the pool
 * \return A vector containing all the buffers in the pool.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> + */
> +
>  } /* namespace libcamera */

Patch

diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
index 97c8025d9e77..dda5075f2879 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -42,6 +42,7 @@  public:
 	void free();
 
 	unsigned int count() const { return buffers_.size(); };
+	const std::vector<Buffer *> &buffers() { return buffers_; };
 
 private:
 	virtual int allocateMemory() = 0;
diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index 5c580b540a67..4a870df77e92 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -141,4 +141,9 @@  void BufferPool::free()
  * \brief Get the number of Buffers contained within this pool
  */
 
+/**
+ * \fn BufferPool::buffers()
+ * \brief Return a reference to the vector holding all buffers within the pool
+ */
+
 } /* namespace libcamera */