[libcamera-devel,v2,12/24] libcamera: buffer: Add const accessor to Buffer planes

Message ID 20191108205409.18845-13-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • Control serialization and IPA C API
Related show

Commit Message

Laurent Pinchart Nov. 8, 2019, 8:53 p.m. UTC
In order to inspect planes of a const Buffer, add a const accessor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 include/libcamera/buffer.h | 1 +
 src/libcamera/buffer.cpp   | 6 ++++++
 2 files changed, 7 insertions(+)

Comments

Jacopo Mondi Nov. 15, 2019, 4:59 p.m. UTC | #1
Hi,

On Fri, Nov 08, 2019 at 10:53:57PM +0200, Laurent Pinchart wrote:
> In order to inspect planes of a const Buffer, add a const accessor.

Is this related to this series ?

>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  include/libcamera/buffer.h | 1 +
>  src/libcamera/buffer.cpp   | 6 ++++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
> index 7b657509ab5f..7a070205f0b5 100644
> --- a/include/libcamera/buffer.h
> +++ b/include/libcamera/buffer.h
> @@ -43,6 +43,7 @@ private:
>  class BufferMemory final
>  {
>  public:
> +	const std::vector<Plane> &planes() const { return planes_; }
>  	std::vector<Plane> &planes() { return planes_; }
>
>  private:
> diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
> index 4407201bd81c..960eeb8f7d19 100644
> --- a/src/libcamera/buffer.cpp
> +++ b/src/libcamera/buffer.cpp
> @@ -181,6 +181,12 @@ void *Plane::mem()
>   * image format is multi-planar.
>   */
>
> +/**
> + * \fn BufferMemory::planes() const
> + * \brief Retrieve the planes within the buffer
> + * \return A const reference to a vector holding all Planes within the buffer
> + */
> +
>  /**
>   * \fn BufferMemory::planes()
>   * \brief Retrieve the planes within the buffer
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
Laurent Pinchart Nov. 18, 2019, 1:05 a.m. UTC | #2
Hi Jacopo,

On Fri, Nov 15, 2019 at 05:59:48PM +0100, Jacopo Mondi wrote:
> On Fri, Nov 08, 2019 at 10:53:57PM +0200, Laurent Pinchart wrote:
> > In order to inspect planes of a const Buffer, add a const accessor.
> 
> Is this related to this series ?

If I remember correctly, it's needed to translate to the C API in
IPAContextWrapper::mapBuffers().

> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > ---
> >  include/libcamera/buffer.h | 1 +
> >  src/libcamera/buffer.cpp   | 6 ++++++
> >  2 files changed, 7 insertions(+)
> >
> > diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
> > index 7b657509ab5f..7a070205f0b5 100644
> > --- a/include/libcamera/buffer.h
> > +++ b/include/libcamera/buffer.h
> > @@ -43,6 +43,7 @@ private:
> >  class BufferMemory final
> >  {
> >  public:
> > +	const std::vector<Plane> &planes() const { return planes_; }
> >  	std::vector<Plane> &planes() { return planes_; }
> >
> >  private:
> > diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
> > index 4407201bd81c..960eeb8f7d19 100644
> > --- a/src/libcamera/buffer.cpp
> > +++ b/src/libcamera/buffer.cpp
> > @@ -181,6 +181,12 @@ void *Plane::mem()
> >   * image format is multi-planar.
> >   */
> >
> > +/**
> > + * \fn BufferMemory::planes() const
> > + * \brief Retrieve the planes within the buffer
> > + * \return A const reference to a vector holding all Planes within the buffer
> > + */
> > +
> >  /**
> >   * \fn BufferMemory::planes()
> >   * \brief Retrieve the planes within the buffer
Jacopo Mondi Nov. 18, 2019, 10:51 p.m. UTC | #3
Hi Laurent,

On Mon, Nov 18, 2019 at 03:05:39AM +0200, Laurent Pinchart wrote:
> Hi Jacopo,
>
> On Fri, Nov 15, 2019 at 05:59:48PM +0100, Jacopo Mondi wrote:
> > On Fri, Nov 08, 2019 at 10:53:57PM +0200, Laurent Pinchart wrote:
> > > In order to inspect planes of a const Buffer, add a const accessor.
> >
> > Is this related to this series ?

Fine! Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
>
> If I remember correctly, it's needed to translate to the C API in
> IPAContextWrapper::mapBuffers().
>
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > > ---
> > >  include/libcamera/buffer.h | 1 +
> > >  src/libcamera/buffer.cpp   | 6 ++++++
> > >  2 files changed, 7 insertions(+)
> > >
> > > diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
> > > index 7b657509ab5f..7a070205f0b5 100644
> > > --- a/include/libcamera/buffer.h
> > > +++ b/include/libcamera/buffer.h
> > > @@ -43,6 +43,7 @@ private:
> > >  class BufferMemory final
> > >  {
> > >  public:
> > > +	const std::vector<Plane> &planes() const { return planes_; }
> > >  	std::vector<Plane> &planes() { return planes_; }
> > >
> > >  private:
> > > diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
> > > index 4407201bd81c..960eeb8f7d19 100644
> > > --- a/src/libcamera/buffer.cpp
> > > +++ b/src/libcamera/buffer.cpp
> > > @@ -181,6 +181,12 @@ void *Plane::mem()
> > >   * image format is multi-planar.
> > >   */
> > >
> > > +/**
> > > + * \fn BufferMemory::planes() const
> > > + * \brief Retrieve the planes within the buffer
> > > + * \return A const reference to a vector holding all Planes within the buffer
> > > + */
> > > +
> > >  /**
> > >   * \fn BufferMemory::planes()
> > >   * \brief Retrieve the planes within the buffer
>
> --
> Regards,
>
> Laurent Pinchart

Patch

diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h
index 7b657509ab5f..7a070205f0b5 100644
--- a/include/libcamera/buffer.h
+++ b/include/libcamera/buffer.h
@@ -43,6 +43,7 @@  private:
 class BufferMemory final
 {
 public:
+	const std::vector<Plane> &planes() const { return planes_; }
 	std::vector<Plane> &planes() { return planes_; }
 
 private:
diff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp
index 4407201bd81c..960eeb8f7d19 100644
--- a/src/libcamera/buffer.cpp
+++ b/src/libcamera/buffer.cpp
@@ -181,6 +181,12 @@  void *Plane::mem()
  * image format is multi-planar.
  */
 
+/**
+ * \fn BufferMemory::planes() const
+ * \brief Retrieve the planes within the buffer
+ * \return A const reference to a vector holding all Planes within the buffer
+ */
+
 /**
  * \fn BufferMemory::planes()
  * \brief Retrieve the planes within the buffer