summaryrefslogtreecommitdiff
path: root/src/libcamera/v4l2_controls.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-09-28 17:36:05 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-10-05 20:02:51 +0300
commit28535ea1a2dd421f9ebafc056c7632674d0c70a8 (patch)
tree9127b2a099b74f279d3dde991e5c044a34ab1a3a /src/libcamera/v4l2_controls.cpp
parent186ae04c0cdf5eb7d7afcd55d4b6a7b69e47f4ae (diff)
libcamera: v4l2_controls: Use the ControlRange class for control info
Use the ControlRange class to express the range of a V4L2 control, replacing the open-coded minimum and maximum fields in the V4L2ControlInfo class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src/libcamera/v4l2_controls.cpp')
-rw-r--r--src/libcamera/v4l2_controls.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp
index 64f0555f..6f5f1578 100644
--- a/src/libcamera/v4l2_controls.cpp
+++ b/src/libcamera/v4l2_controls.cpp
@@ -74,8 +74,13 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
type_ = ctrl.type;
name_ = static_cast<const char *>(ctrl.name);
size_ = ctrl.elem_size * ctrl.elems;
- min_ = ctrl.minimum;
- max_ = ctrl.maximum;
+
+ if (ctrl.type == V4L2_CTRL_TYPE_INTEGER64)
+ range_ = ControlRange(static_cast<int64_t>(ctrl.minimum),
+ static_cast<int64_t>(ctrl.maximum));
+ else
+ range_ = ControlRange(static_cast<int32_t>(ctrl.minimum),
+ static_cast<int32_t>(ctrl.maximum));
}
/**
@@ -103,15 +108,9 @@ V4L2ControlInfo::V4L2ControlInfo(const struct v4l2_query_ext_ctrl &ctrl)
*/
/**
- * \fn V4L2ControlInfo::min()
- * \brief Retrieve the control minimum value
- * \return The V4L2 control minimum value
- */
-
-/**
- * \fn V4L2ControlInfo::max()
- * \brief Retrieve the control maximum value
- * \return The V4L2 control maximum value
+ * \fn V4L2ControlInfo::range()
+ * \brief Retrieve the control value range
+ * \return The V4L2 control value range
*/
/**