mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
libcamera: controls: Remove ControlInfo::id
The ControlInfo id member is only used in the toString() method of the class, and nowhere else externally. The same way that ControlValue doesn't store a ControlId, ControlInfo shouldn't. Remove it. 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>
This commit is contained in:
parent
5a952df386
commit
f1ab117e81
5 changed files with 8 additions and 31 deletions
|
@ -98,17 +98,15 @@ private:
|
||||||
class ControlInfo
|
class ControlInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ControlInfo(const ControlId &id, const ControlValue &min = 0,
|
explicit ControlInfo(const ControlValue &min = 0,
|
||||||
const ControlValue &max = 0);
|
const ControlValue &max = 0);
|
||||||
|
|
||||||
const ControlId &id() const { return id_; }
|
|
||||||
const ControlValue &min() const { return min_; }
|
const ControlValue &min() const { return min_; }
|
||||||
const ControlValue &max() const { return max_; }
|
const ControlValue &max() const { return max_; }
|
||||||
|
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const ControlId &id_;
|
|
||||||
ControlValue min_;
|
ControlValue min_;
|
||||||
ControlValue max_;
|
ControlValue max_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -323,22 +323,15 @@ Control<int64_t>::Control(unsigned int id, const char *name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Construct a ControlInfo with minimum and maximum range parameters
|
* \brief Construct a ControlInfo with minimum and maximum range parameters
|
||||||
* \param[in] id The control ID
|
|
||||||
* \param[in] min The control minimum value
|
* \param[in] min The control minimum value
|
||||||
* \param[in] max The control maximum value
|
* \param[in] max The control maximum value
|
||||||
*/
|
*/
|
||||||
ControlInfo::ControlInfo(const ControlId &id, const ControlValue &min,
|
ControlInfo::ControlInfo(const ControlValue &min,
|
||||||
const ControlValue &max)
|
const ControlValue &max)
|
||||||
: id_(id), min_(min), max_(max)
|
: min_(min), max_(max)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \fn ControlInfo::id()
|
|
||||||
* \brief Retrieve the control ID
|
|
||||||
* \return The control ID
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn ControlInfo::min()
|
* \fn ControlInfo::min()
|
||||||
* \brief Retrieve the minimum value of the control
|
* \brief Retrieve the minimum value of the control
|
||||||
|
@ -358,7 +351,7 @@ std::string ControlInfo::toString() const
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
||||||
ss << id_.name() << "[" << min_.toString() << ".." << max_.toString() << "]";
|
ss << "[" << min_.toString() << ".." << max_.toString() << "]";
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,7 +364,7 @@ int UVCCameraData::init(MediaEntity *entity)
|
||||||
|
|
||||||
controlInfo_.emplace(std::piecewise_construct,
|
controlInfo_.emplace(std::piecewise_construct,
|
||||||
std::forward_as_tuple(id),
|
std::forward_as_tuple(id),
|
||||||
std::forward_as_tuple(*id, info.min(), info.max()));
|
std::forward_as_tuple(info.min(), info.max()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -437,7 +437,7 @@ int VimcCameraData::init(MediaDevice *media)
|
||||||
|
|
||||||
controlInfo_.emplace(std::piecewise_construct,
|
controlInfo_.emplace(std::piecewise_construct,
|
||||||
std::forward_as_tuple(id),
|
std::forward_as_tuple(id),
|
||||||
std::forward_as_tuple(*id, info.min(), info.max()));
|
std::forward_as_tuple(info.min(), info.max()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -24,14 +24,7 @@ protected:
|
||||||
* Test information retrieval from a control with no minimum
|
* Test information retrieval from a control with no minimum
|
||||||
* and maximum.
|
* and maximum.
|
||||||
*/
|
*/
|
||||||
ControlInfo brightness(controls::Brightness);
|
ControlInfo brightness;
|
||||||
|
|
||||||
if (brightness.id() != controls::Brightness ||
|
|
||||||
brightness.id().type() != ControlTypeInteger32 ||
|
|
||||||
brightness.id().name() != std::string("Brightness")) {
|
|
||||||
cout << "Invalid control identification for Brightness" << endl;
|
|
||||||
return TestFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (brightness.min().get<int32_t>() != 0 ||
|
if (brightness.min().get<int32_t>() != 0 ||
|
||||||
brightness.max().get<int32_t>() != 0) {
|
brightness.max().get<int32_t>() != 0) {
|
||||||
|
@ -43,14 +36,7 @@ protected:
|
||||||
* Test information retrieval from a control with a minimum and
|
* Test information retrieval from a control with a minimum and
|
||||||
* a maximum value.
|
* a maximum value.
|
||||||
*/
|
*/
|
||||||
ControlInfo contrast(controls::Contrast, 10, 200);
|
ControlInfo contrast(10, 200);
|
||||||
|
|
||||||
if (contrast.id() != controls::Contrast ||
|
|
||||||
contrast.id().type() != ControlTypeInteger32 ||
|
|
||||||
contrast.id().name() != std::string("Contrast")) {
|
|
||||||
cout << "Invalid control identification for Contrast" << endl;
|
|
||||||
return TestFail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contrast.min().get<int32_t>() != 10 ||
|
if (contrast.min().get<int32_t>() != 10 ||
|
||||||
contrast.max().get<int32_t>() != 200) {
|
contrast.max().get<int32_t>() != 200) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue