[libcamera-devel,v4,17/31] libcamera: request: Add camera() getter method

Message ID 20190320163055.22056-18-jacopo@jmondi.org
State Superseded
Headers show
Series
  • libcamera: ipu3: Add ImgU support + multiple streams
Related show

Commit Message

Jacopo Mondi March 20, 2019, 4:30 p.m. UTC
Add a "camera()" getter method to the Request class to retrieve the
Camera instance the request has been sent to.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 include/libcamera/request.h | 1 +
 src/libcamera/request.cpp   | 7 +++++++
 2 files changed, 8 insertions(+)

Comments

Laurent Pinchart March 23, 2019, 1:31 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Wed, Mar 20, 2019 at 05:30:41PM +0100, Jacopo Mondi wrote:
> Add a "camera()" getter method to the Request class to retrieve the
> Camera instance the request has been sent to.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

The implementation looks fine. I haven't reviewed the patch(es) that
make use of this yet, so

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

only if this is actually needed :-)

> ---
>  include/libcamera/request.h | 1 +
>  src/libcamera/request.cpp   | 7 +++++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index 1bf90de2c6f9..56d179e5f2f5 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -35,6 +35,7 @@ public:
>  	int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
>  	Buffer *findBuffer(Stream *stream) const;
>  	const std::set<Stream *> &streams() const { return streams_; }
> +	Camera *camera() const { return camera_; }
>  
>  	Status status() const { return status_; }
>  
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index 22c516208ede..51ab6c4e71b2 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -58,6 +58,13 @@ Request::Request(Camera *camera)
>   * \return The set of streams contained in the request
>   */
>  
> +/**
> + * \fn Request::camera()
> + * \brief Retrieve the camera the request has been sent to
> + *
> + * \return Pointer to the camera instance the request has been sent to
> + */
> +
>  /**
>   * \brief Set the streams to capture with associated buffers
>   * \param[in] streamMap The map of streams to buffers

Patch

diff --git a/include/libcamera/request.h b/include/libcamera/request.h
index 1bf90de2c6f9..56d179e5f2f5 100644
--- a/include/libcamera/request.h
+++ b/include/libcamera/request.h
@@ -35,6 +35,7 @@  public:
 	int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
 	Buffer *findBuffer(Stream *stream) const;
 	const std::set<Stream *> &streams() const { return streams_; }
+	Camera *camera() const { return camera_; }
 
 	Status status() const { return status_; }
 
diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
index 22c516208ede..51ab6c4e71b2 100644
--- a/src/libcamera/request.cpp
+++ b/src/libcamera/request.cpp
@@ -58,6 +58,13 @@  Request::Request(Camera *camera)
  * \return The set of streams contained in the request
  */
 
+/**
+ * \fn Request::camera()
+ * \brief Retrieve the camera the request has been sent to
+ *
+ * \return Pointer to the camera instance the request has been sent to
+ */
+
 /**
  * \brief Set the streams to capture with associated buffers
  * \param[in] streamMap The map of streams to buffers