[libcamera-devel] [PATCH v4 06/13] libcamera: request: Add a ControlList

Kieran Bingham kieran.bingham at ideasonboard.com
Tue Jul 2 09:55:49 CEST 2019


Hi Laurent,

On 01/07/2019 21:14, Laurent Pinchart wrote:
> From: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> Provide a ControlList on request objects to facilitate setting controls.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
> Changes since v3:
> 
> - Don't clear controls when the request completes
> - Fixed include ordering
> ---
>  include/libcamera/request.h |  3 +++
>  src/libcamera/request.cpp   | 12 +++++++++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/include/libcamera/request.h b/include/libcamera/request.h
> index 58de6f00a554..a93468d7c8b7 100644
> --- a/include/libcamera/request.h
> +++ b/include/libcamera/request.h
> @@ -10,6 +10,7 @@
>  #include <map>
>  #include <unordered_set>
>  
> +#include <libcamera/controls.h>
>  #include <libcamera/signal.h>
>  
>  namespace libcamera {
> @@ -32,6 +33,7 @@ public:
>  	Request(const Request &) = delete;
>  	Request &operator=(const Request &) = delete;
>  
> +	ControlList &controls() { return controls_; }
>  	const std::map<Stream *, Buffer *> &buffers() const { return bufferMap_; }
>  	int setBuffers(const std::map<Stream *, Buffer *> &streamMap);
>  	Buffer *findBuffer(Stream *stream) const;
> @@ -50,6 +52,7 @@ private:
>  	bool completeBuffer(Buffer *buffer);
>  
>  	Camera *camera_;
> +	ControlList controls_;
>  	std::map<Stream *, Buffer *> bufferMap_;
>  	std::unordered_set<Buffer *> pending_;
>  
> diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp
> index fa3ee46da440..e749e41baa42 100644
> --- a/src/libcamera/request.cpp
> +++ b/src/libcamera/request.cpp
> @@ -48,10 +48,20 @@ LOG_DEFINE_CATEGORY(Request)
>   * \param[in] camera The camera that creates the request
>   */
>  Request::Request(Camera *camera)
> -	: camera_(camera), status_(RequestPending)
> +	: camera_(camera), controls_(camera), status_(RequestPending)
>  {
>  }
>  
> +/**
> + * \fn Request::controls()
> + * \brief Retrieve the request's ControlList
> + *
> + * Return a reference to the ControlList that stores all the controls relevant
> + * to this request.
> + *


How about extending this with the following::
  <quoted to preserve formatting due to thunderbird>

> + * Controls can be updated directly in this list using the [] operator, or a
> + * pre-defined ControlList can be merged into this request using the update()
> + * operation.
> + *
> + * Only controls which are supported by the Camera to which this request will be
> + * submitted should be configured in the Requests ControlList. Configuration for
> + * unsupported controls may be ignored or cause undefined behaviour.
> + *


--
Kieran



> + * \return A reference to the ControlList in this request
> + */
> +
>  /**
>   * \fn Request::buffers()
>   * \brief Retrieve the request's streams to buffers map
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list