libcamera: controls: Add default to ControlRange

Augment the the ControlRange class to store the control default value.

This is particularly relevant for v4l2 controls used to create
Camera properties, which are constructed using immutable video device
properties, whose value won't change at runtime.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2019-11-19 17:18:35 +01:00
parent e5ff2c9894
commit 81563b55ed
3 changed files with 20 additions and 6 deletions

View file

@ -114,10 +114,12 @@ class ControlRange
{
public:
explicit ControlRange(const ControlValue &min = 0,
const ControlValue &max = 0);
const ControlValue &max = 0,
const ControlValue &def = 0);
const ControlValue &min() const { return min_; }
const ControlValue &max() const { return max_; }
const ControlValue &def() const { return def_; }
std::string toString() const;
@ -134,6 +136,7 @@ public:
private:
ControlValue min_;
ControlValue max_;
ControlValue def_;
};
using ControlIdMap = std::unordered_map<unsigned int, const ControlId *>;