summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-06-30 15:22:27 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-07-02 16:59:17 +0300
commitbd0245a0dc6ff036dc25dee1f776e03e84c02953 (patch)
tree0ec421952f3f1168443682416dd1d4e5cbf24542 /src
parentf137451817f47c0bfe59586afe5af7b51f8ccad4 (diff)
libcamera: v4l2_controls: Add min and max to V4L2ControlInfo
Add min() and max() methods to V4L2ControlInfo to report the control's minimum and maximum value respectively. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/include/v4l2_controls.h6
-rw-r--r--src/libcamera/v4l2_controls.cpp14
2 files changed, 20 insertions, 0 deletions
diff --git a/src/libcamera/include/v4l2_controls.h b/src/libcamera/include/v4l2_controls.h
index 2c8cb900..0047efab 100644
--- a/src/libcamera/include/v4l2_controls.h
+++ b/src/libcamera/include/v4l2_controls.h
@@ -28,11 +28,17 @@ public:
size_t size() const { return size_; }
const std::string &name() const { return name_; }
+ int64_t min() const { return min_; }
+ int64_t max() const { return max_; }
+
private:
unsigned int id_;
unsigned int type_;
size_t size_;
std::string name_;
+
+ int64_t min_;
+ int64_t max_;
};
class V4L2Control
diff --git a/src/libcamera/v4l2_controls.cpp b/src/libcamera/v4l2_controls.cpp
index 78888de2..af017bce 100644
--- a/src/libcamera/v4l2_controls.cpp
+++ b/src/libcamera/v4l2_controls.cpp
@@ -74,6 +74,8 @@ 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;
}
/**
@@ -101,6 +103,18 @@ 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
+ */
+
+/**
* \class V4L2Control
* \brief A V4L2 control value
*