[libcamera-devel] [PATCH 06/11] libcamera: v4l2_controls: Cache query control information
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Fri Mar 20 22:14:03 CET 2020
Hi Jacopo,
On Mon, Mar 09, 2020 at 05:24:09PM +0100, Jacopo Mondi wrote:
> Cache the V4L2 control info retrieved with VIDIOC_QUERY_EXT_CTRL
> at control listing time for later use.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
> src/libcamera/include/v4l2_device.h | 1 +
> src/libcamera/v4l2_device.cpp | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h
> index 6bfddefe336c..e1fd048cc85a 100644
> --- a/src/libcamera/include/v4l2_device.h
> +++ b/src/libcamera/include/v4l2_device.h
> @@ -48,6 +48,7 @@ private:
> const struct v4l2_ext_control *v4l2Ctrls,
> unsigned int count);
>
> + std::map<unsigned int, struct v4l2_query_ext_ctrl> ctrlsInfo_;
To match the next field, I would call this controlInfo_ (controlInfos_
would have been better, but that would be an English error as
information is uncountable).
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> std::vector<std::unique_ptr<V4L2ControlId>> controlIds_;
> ControlInfoMap controls_;
> std::string deviceNode_;
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index 179476e9afad..65e97f92b01f 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -382,6 +382,7 @@ void V4L2Device::listControls()
>
> controlIds_.emplace_back(std::make_unique<V4L2ControlId>(ctrl));
> ctrls.emplace(controlIds_.back().get(), V4L2ControlInfo(ctrl));
> + ctrlsInfo_[ctrl.id] = ctrl;
> }
>
> controls_ = std::move(ctrls);
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list