From patchwork Sat Sep 28 15:22:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2048 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CDF46165A for ; Sat, 28 Sep 2019 17:22:58 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B3397729 for ; Sat, 28 Sep 2019 17:22:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1569684177; bh=wZ0kluFE9GQwIOs0QGCrOMtI1+xe2JCCdoV/xFkFsLk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dJskqfKriRRtCDWwIoHg97S56mSGp5WJjCYNIAJlTRbt1U6tk4FbR0+hN5XkD24Sa e3D66P9zdo2+OozM8rlKtY6/lw9tomqDKokQa7A+SgUqQ5bIKSUeSepgnCJiaY+0Yx z7laQNTDX3P0Ku4jmL19Hir+zcailCsedRuZvJNU= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 28 Sep 2019 18:22:32 +0300 Message-Id: <20190928152238.23752-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190928152238.23752-1-laurent.pinchart@ideasonboard.com> References: <20190928152238.23752-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/12] libcamera: controls: Remove ControlInfo::id X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 15:22:59 -0000 The ControlInfo id member is only used in the toString() method of the class, and nowhere else externally. The same way that ControlValue doesn't store a ControlId, ControlInfo shouldn't. Remove it. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- include/libcamera/controls.h | 4 +--- src/libcamera/controls.cpp | 13 +++---------- src/libcamera/pipeline/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc.cpp | 2 +- test/controls/control_info.cpp | 18 ++---------------- 5 files changed, 8 insertions(+), 31 deletions(-) diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index d4a74ada1b6a..854ea3b84267 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -98,17 +98,15 @@ private: class ControlInfo { public: - explicit ControlInfo(const ControlId &id, const ControlValue &min = 0, + explicit ControlInfo(const ControlValue &min = 0, const ControlValue &max = 0); - const ControlId &id() const { return id_; } const ControlValue &min() const { return min_; } const ControlValue &max() const { return max_; } std::string toString() const; private: - const ControlId &id_; ControlValue min_; ControlValue max_; }; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 62cb2ff822bb..6a3bb353792d 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -323,22 +323,15 @@ Control::Control(unsigned int id, const char *name) /** * \brief Construct a ControlInfo with minimum and maximum range parameters - * \param[in] id The control ID * \param[in] min The control minimum value * \param[in] max The control maximum value */ -ControlInfo::ControlInfo(const ControlId &id, const ControlValue &min, +ControlInfo::ControlInfo(const ControlValue &min, const ControlValue &max) - : id_(id), min_(min), max_(max) + : min_(min), max_(max) { } -/** - * \fn ControlInfo::id() - * \brief Retrieve the control ID - * \return The control ID - */ - /** * \fn ControlInfo::min() * \brief Retrieve the minimum value of the control @@ -358,7 +351,7 @@ std::string ControlInfo::toString() const { std::stringstream ss; - ss << id_.name() << "[" << min_.toString() << ".." << max_.toString() << "]"; + ss << "[" << min_.toString() << ".." << max_.toString() << "]"; return ss.str(); } diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp index 44e19f40f1b9..3635ea83a7b1 100644 --- a/src/libcamera/pipeline/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo.cpp @@ -364,7 +364,7 @@ int UVCCameraData::init(MediaEntity *entity) controlInfo_.emplace(std::piecewise_construct, std::forward_as_tuple(id), - std::forward_as_tuple(*id, info.min(), info.max())); + std::forward_as_tuple(info.min(), info.max())); } return 0; diff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp index a48febf2172e..d9dd031e173c 100644 --- a/src/libcamera/pipeline/vimc.cpp +++ b/src/libcamera/pipeline/vimc.cpp @@ -437,7 +437,7 @@ int VimcCameraData::init(MediaDevice *media) controlInfo_.emplace(std::piecewise_construct, std::forward_as_tuple(id), - std::forward_as_tuple(*id, info.min(), info.max())); + std::forward_as_tuple(info.min(), info.max())); } return 0; diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp index dbc43df8e3d3..9cf59185e459 100644 --- a/test/controls/control_info.cpp +++ b/test/controls/control_info.cpp @@ -24,14 +24,7 @@ protected: * Test information retrieval from a control with no minimum * and maximum. */ - ControlInfo brightness(controls::Brightness); - - if (brightness.id() != controls::Brightness || - brightness.id().type() != ControlTypeInteger32 || - brightness.id().name() != std::string("Brightness")) { - cout << "Invalid control identification for Brightness" << endl; - return TestFail; - } + ControlInfo brightness; if (brightness.min().get() != 0 || brightness.max().get() != 0) { @@ -43,14 +36,7 @@ protected: * Test information retrieval from a control with a minimum and * a maximum value. */ - ControlInfo contrast(controls::Contrast, 10, 200); - - if (contrast.id() != controls::Contrast || - contrast.id().type() != ControlTypeInteger32 || - contrast.id().name() != std::string("Contrast")) { - cout << "Invalid control identification for Contrast" << endl; - return TestFail; - } + ControlInfo contrast(10, 200); if (contrast.min().get() != 10 || contrast.max().get() != 200) {