summaryrefslogtreecommitdiff
path: root/test/v4l2_videodevice
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-14 00:41:47 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-15 22:33:31 +0300
commit207d57c8b4c066a0e70982f28e0084361d7448f2 (patch)
tree87a4c329f433dfc4d24241601ef1578d084240c0 /test/v4l2_videodevice
parent7bb4d7144c3e7c469310d4fd473653fb6cbfc1b8 (diff)
libcamera: v4l2_controls: Replace V4L2ControlInfo with V4L2ControlRange
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>
Diffstat (limited to 'test/v4l2_videodevice')
-rw-r--r--test/v4l2_videodevice/controls.cpp24
1 files changed, 12 insertions, 12 deletions
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;
}