[libcamera-devel] [PATCH v5 08/10] libcamera: media_object: Add a const version of dev()

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Jan 6 11:51:16 CET 2021


Hi Jacopo,

Thanks for your work.

On 2021-01-05 13:31:26 +0100, Jacopo Mondi wrote:
> Add a const version of the MediaObject::dev() method to be able to
> retrieve a pointer to a const MediaDevice from a constant instance of
> a MediaObject sub-class.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

> ---
>  include/libcamera/internal/media_object.h | 1 +
>  src/libcamera/media_object.cpp            | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h
> index 43a35bef8f35..2b336961f98d 100644
> --- a/include/libcamera/internal/media_object.h
> +++ b/include/libcamera/internal/media_object.h
> @@ -22,6 +22,7 @@ class MediaObject
>  {
>  public:
>  	MediaDevice *device() { return dev_; }
> +	const MediaDevice *device() const { return dev_; }
>  	unsigned int id() const { return id_; }
>  
>  protected:
> diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp
> index 056036635902..cd3cd8ac17a4 100644
> --- a/src/libcamera/media_object.cpp
> +++ b/src/libcamera/media_object.cpp
> @@ -71,6 +71,12 @@ LOG_DECLARE_CATEGORY(MediaDevice)
>   * \return The MediaDevice
>   */
>  
> +/**
> + * \fn const MediaObject::device() const
> + * \brief Retrieve the const media device the media object belongs to
> + * \return The const MediaDevice
> + */
> +
>  /**
>   * \fn MediaObject::id()
>   * \brief Retrieve the media object id
> -- 
> 2.29.2
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list