mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 00:55:07 +03:00
libcamera: controls: Store control name in ControlId
The ControlId class stores a pointer to the control name. This works fine for statically-defined controls, but requires code that allocates controls dynamically (for instance based on control discovery on a V4L2 device) to keep a list of control names in separate storage. To ease usage of dynamically allocated controls, store a copy of the control name string in the ControlId class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
a1772d44e8
commit
576b8aa079
2 changed files with 4 additions and 4 deletions
|
@ -60,11 +60,11 @@ class ControlId
|
|||
{
|
||||
public:
|
||||
unsigned int id() const { return id_; }
|
||||
const char *name() const { return name_; }
|
||||
const std::string &name() const { return name_; }
|
||||
ControlType type() const { return type_; }
|
||||
|
||||
protected:
|
||||
ControlId(unsigned int id, const char *name, ControlType type)
|
||||
ControlId(unsigned int id, const std::string &name, ControlType type)
|
||||
: id_(id), name_(name), type_(type)
|
||||
{
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
ControlId &operator=(const ControlId &) = delete;
|
||||
|
||||
unsigned int id_;
|
||||
const char *name_;
|
||||
std::string name_;
|
||||
ControlType type_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue