[libcamera-devel] [RFC v3 2/5] libcamera: Request: expose Camera from Request
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu Dec 9 17:50:21 CET 2021
Hi Tomi,
Thank you for the patch.
On Thu, Dec 09, 2021 at 11:29:03AM +0200, Tomi Valkeinen wrote:
> Request has Camera as a private member. Expose this so that users can
> more easily associate a received Request to a Camera.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ideasonboard.com>
> ---
> include/libcamera/request.h | 2 ++
> src/libcamera/request.cpp | 5 +++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index f434335b..6e8987b6 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -60,6 +60,8 @@ public:
>
> std::string toString() const;
>
> + std::shared_ptr<Camera> camera() const;
I'm not thrilled by this, as it would prevent us from removing the
camera pointer stored in the Request class, which I've been tempted to
do already.
Why do we need this, and do we have any alternative ?
> +
> private:
> LIBCAMERA_DISABLE_COPY(Request)
>
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index 17fefab7..3651e8ca 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -218,6 +218,11 @@ FrameBuffer *Request::findBuffer(const Stream *stream) const
> return it->second;
> }
>
> +std::shared_ptr<Camera> Request::camera() const
> +{
> + return camera_->shared_from_this();
> +}
> +
> /**
> * \fn Request::metadata()
> * \brief Retrieve the request's metadata
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list