libcamera: controls: Create ControlInfoMap with ControlIdMap
ControlInfoMap does not have a ControlId map associated, but rather creates one with the generateIdMap() function at creation time. As a consequence, when in the need to de-serialize a ControlInfoMap all the ControlId it contains are created by the deserializer instance, not being able to discern if the controls the ControlIdMap refers to are the global libcamera controls (and properties) or instances local to the V4L2 device that has first initialized the controls. As a consequence the ControlId stored in a de-serialized map will always be newly created entities, preventing lookup by ControlId reference on a de-serialized ControlInfoMap. In order to make it possible to use globally available ControlId instances whenever possible, create ControlInfoMap with a reference to an externally allocated ControlIdMap instead of generating one internally. As a consequence the class constructors take and additional argument, which might be not pleasant to type in, but enforces the concepts that ControlInfoMap should be created with controls part of the same id map. As the ControlIdMap the ControlInfoMap refers to needs to be allocated externally: - Use the globally available controls::controls (or properties::properties) id map when referring to libcamera controls - The V4L2 device that creates ControlInfoMap by parsing the device's controls has to allocate a ControlIdMap - The ControlSerializer that de-serializes a ControlInfoMap has to create and store the ControlIdMap the de-serialized info map refers to Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
0e1ff86e78
commit
b48db3c489
12 changed files with 104 additions and 110 deletions
|
@ -32,13 +32,13 @@
|
|||
using namespace std;
|
||||
using namespace libcamera;
|
||||
|
||||
static const ControlInfoMap Controls = {
|
||||
{ &controls::AeEnable, ControlInfo(false, true) },
|
||||
{ &controls::ExposureTime, ControlInfo(0, 999999) },
|
||||
{ &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) },
|
||||
{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },
|
||||
{ &controls::Brightness, ControlInfo(-1.0f, 1.0f) },
|
||||
};
|
||||
static const ControlInfoMap Controls = ControlInfoMap({
|
||||
{ &controls::AeEnable, ControlInfo(false, true) },
|
||||
{ &controls::ExposureTime, ControlInfo(0, 999999) },
|
||||
{ &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) },
|
||||
{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },
|
||||
{ &controls::Brightness, ControlInfo(-1.0f, 1.0f) },
|
||||
}, controls::controls);
|
||||
|
||||
namespace libcamera {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue