[libcamera-devel] [PATCH 2/3] libcamera: pipeline_handler: Mark controls() and properties() as const operations

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Aug 14 11:34:15 CEST 2020


Hi Niklas,

On 06/08/2020 13:53, Niklas Söderlund wrote:
> Reading the controls and properties do not modify the pipeline's state

'does not modify'

> and can be marked as const operations.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

> ---
>  include/libcamera/internal/pipeline_handler.h | 4 ++--
>  src/libcamera/pipeline_handler.cpp            | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
> index d5321ef56df358d0..c4bf1cb68e09d754 100644
> --- a/include/libcamera/internal/pipeline_handler.h
> +++ b/include/libcamera/internal/pipeline_handler.h
> @@ -68,8 +68,8 @@ public:
>  	bool lock();
>  	void unlock();
>  
> -	const ControlInfoMap &controls(Camera *camera);
> -	const ControlList &properties(Camera *camera);
> +	const ControlInfoMap &controls(const Camera *camera) const;
> +	const ControlList &properties(const Camera *camera) const;
>  
>  	virtual CameraConfiguration *generateConfiguration(Camera *camera,
>  		const StreamRoles &roles) = 0;
> diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp
> index bc9c1d4b09c5437d..d239135872344a20 100644
> --- a/src/libcamera/pipeline_handler.cpp
> +++ b/src/libcamera/pipeline_handler.cpp
> @@ -257,7 +257,7 @@ void PipelineHandler::unlock()
>   * \context This function is \threadsafe.
>   * \return A ControlInfoMap listing the controls support by \a camera
>   */
> -const ControlInfoMap &PipelineHandler::controls(Camera *camera)
> +const ControlInfoMap &PipelineHandler::controls(const Camera *camera) const
>  {
>  	CameraData *data = cameraData(camera);
>  	return data->controlInfo_;
> @@ -268,7 +268,7 @@ const ControlInfoMap &PipelineHandler::controls(Camera *camera)
>   * \param[in] camera The camera
>   * \return A ControlList of properties supported by \a camera
>   */
> -const ControlList &PipelineHandler::properties(Camera *camera)
> +const ControlList &PipelineHandler::properties(const Camera *camera) const
>  {
>  	CameraData *data = cameraData(camera);
>  	return data->properties_;
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list