From 343978af0b491002dd198b6465d2e3a5fae4e407 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 7 Oct 2019 22:31:59 +0300 Subject: libcamera: v4l2_device: Replace V4L2ControlList with ControlList MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The V4L2Device class uses V4L2ControlList as a controls container for the getControls() and setControls() operations. Having a distinct container from ControlList will makes the IPA API more complex, as it needs to explicitly transport both types of lists. This will become even more painful when implementing serialisation and deserialisation. To simplify the IPA API and ease the implementation of serialisation and deserialisation, replace usage of V4L2ControlList with ControlList in the V4L2Device (and thus CameraSensor) API. The V4L2ControlList class becomes a thin wrapper around ControlList that slightly simplifies the creation of control lists for V4L2 controls, and may be removed in the future. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Tested-by: Niklas Söderlund --- src/ipa/rkisp1/rkisp1.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/ipa/rkisp1') diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index b0d23dd1..69ced840 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -49,6 +49,8 @@ private: std::map bufferInfo_; + V4L2ControlInfoMap ctrls_; + /* Camera sensor controls. */ bool autoExposure_; uint32_t exposure_; @@ -65,16 +67,16 @@ void IPARkISP1::configure(const std::map &streamConfig, if (entityControls.empty()) return; - const V4L2ControlInfoMap &ctrls = entityControls.at(0); + ctrls_ = entityControls.at(0); - const auto itExp = ctrls.find(V4L2_CID_EXPOSURE); - if (itExp == ctrls.end()) { + const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE); + if (itExp == ctrls_.end()) { LOG(IPARkISP1, Error) << "Can't find exposure control"; return; } - const auto itGain = ctrls.find(V4L2_CID_ANALOGUE_GAIN); - if (itGain == ctrls.end()) { + const auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN); + if (itGain == ctrls_.end()) { LOG(IPARkISP1, Error) << "Can't find gain control"; return; } @@ -210,9 +212,9 @@ void IPARkISP1::setControls(unsigned int frame) IPAOperationData op; op.operation = RKISP1_IPA_ACTION_V4L2_SET; - V4L2ControlList ctrls; - ctrls.add(V4L2_CID_EXPOSURE, exposure_); - ctrls.add(V4L2_CID_ANALOGUE_GAIN, gain_); + V4L2ControlList ctrls(ctrls_); + ctrls.set(V4L2_CID_EXPOSURE, static_cast(exposure_)); + ctrls.set(V4L2_CID_ANALOGUE_GAIN, static_cast(gain_)); op.v4l2controls.push_back(ctrls); queueFrameAction.emit(frame, op); -- cgit v1.2.1