From 207d57c8b4c066a0e70982f28e0084361d7448f2 Mon Sep 17 00:00:00 2001
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Date: Mon, 14 Oct 2019 00:41:47 +0300
Subject: libcamera: v4l2_controls: Replace V4L2ControlInfo with
 V4L2ControlRange
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The V4L2ControlInfo class only stores a ControlRange. Make it inherit
from ControlRange to provide a convenience constructor from a struct
v4l2_query_ext_ctrl and rename it to V4L2ControlRange.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
---
 test/v4l2_videodevice/controls.cpp | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

(limited to 'test/v4l2_videodevice')

diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp
index 3add6e67..d4b7588e 100644
--- a/test/v4l2_videodevice/controls.cpp
+++ b/test/v4l2_videodevice/controls.cpp
@@ -41,9 +41,9 @@ protected:
 			return TestFail;
 		}
 
-		const V4L2ControlInfo &brightness = info.find(V4L2_CID_BRIGHTNESS)->second;
-		const V4L2ControlInfo &contrast = info.find(V4L2_CID_CONTRAST)->second;
-		const V4L2ControlInfo &saturation = info.find(V4L2_CID_SATURATION)->second;
+		const V4L2ControlRange &brightness = info.find(V4L2_CID_BRIGHTNESS)->second;
+		const V4L2ControlRange &contrast = info.find(V4L2_CID_CONTRAST)->second;
+		const V4L2ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second;
 
 		/* Test getting controls. */
 		V4L2ControlList ctrls(info);
@@ -65,9 +65,9 @@ protected:
 		}
 
 		/* Test setting controls. */
-		ctrls.set(V4L2_CID_BRIGHTNESS, brightness.range().min());
-		ctrls.set(V4L2_CID_CONTRAST, contrast.range().max());
-		ctrls.set(V4L2_CID_SATURATION, saturation.range().min());
+		ctrls.set(V4L2_CID_BRIGHTNESS, brightness.min());
+		ctrls.set(V4L2_CID_CONTRAST, contrast.max());
+		ctrls.set(V4L2_CID_SATURATION, saturation.min());
 
 		ret = capture_->setControls(&ctrls);
 		if (ret) {
@@ -76,9 +76,9 @@ protected:
 		}
 
 		/* Test setting controls outside of range. */
-		ctrls.set(V4L2_CID_BRIGHTNESS, brightness.range().min().get<int32_t>() - 1);
-		ctrls.set(V4L2_CID_CONTRAST, contrast.range().max().get<int32_t>() + 1);
-		ctrls.set(V4L2_CID_SATURATION, saturation.range().min().get<int32_t>() + 1);
+		ctrls.set(V4L2_CID_BRIGHTNESS, brightness.min().get<int32_t>() - 1);
+		ctrls.set(V4L2_CID_CONTRAST, contrast.max().get<int32_t>() + 1);
+		ctrls.set(V4L2_CID_SATURATION, saturation.min().get<int32_t>() + 1);
 
 		ret = capture_->setControls(&ctrls);
 		if (ret) {
@@ -86,9 +86,9 @@ protected:
 			return TestFail;
 		}
 
-		if (ctrls.get(V4L2_CID_BRIGHTNESS) != brightness.range().min() ||
-		    ctrls.get(V4L2_CID_CONTRAST) != contrast.range().max() ||
-		    ctrls.get(V4L2_CID_SATURATION) != saturation.range().min().get<int32_t>() + 1) {
+		if (ctrls.get(V4L2_CID_BRIGHTNESS) != brightness.min() ||
+		    ctrls.get(V4L2_CID_CONTRAST) != contrast.max() ||
+		    ctrls.get(V4L2_CID_SATURATION) != saturation.min().get<int32_t>() + 1) {
 			cerr << "Controls not updated when set" << endl;
 			return TestFail;
 		}
-- 
cgit v1.2.1