summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-10-20 17:05:50 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-10-26 17:51:54 +0100
commit6377817f9f892e6a4601776de523505c14817527 (patch)
treeb7cc158e4289b3421951055591e5f47c07d89699 /include
parent84e79bd8b5347d91309cbd759bbd988b5144fb8d (diff)
libcamera: controls: Construct from valid values
Add a new constructor to the ControlInfo class that allows creating a class instance from the list of the control valid values with an optional default one. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/controls.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
index a556328c..3b7f3347 100644
--- a/include/libcamera/controls.h
+++ b/include/libcamera/controls.h
@@ -12,6 +12,7 @@
#include <stdint.h>
#include <string>
#include <unordered_map>
+#include <vector>
#include <libcamera/geometry.h>
#include <libcamera/span.h>
@@ -269,10 +270,13 @@ public:
explicit ControlInfo(const ControlValue &min = 0,
const ControlValue &max = 0,
const ControlValue &def = 0);
+ explicit ControlInfo(Span<const ControlValue> values,
+ const ControlValue &def = {});
const ControlValue &min() const { return min_; }
const ControlValue &max() const { return max_; }
const ControlValue &def() const { return def_; }
+ const std::vector<ControlValue> &values() const { return values_; }
std::string toString() const;
@@ -290,6 +294,7 @@ private:
ControlValue min_;
ControlValue max_;
ControlValue def_;
+ std::vector<ControlValue> values_;
};
using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;