summaryrefslogtreecommitdiff
path: root/test/serialization
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-07-28 11:59:00 +0200
committerJacopo Mondi <jacopo@jmondi.org>2021-08-12 10:06:25 +0200
commitb48db3c489d3af5989cc9a71b0843fc69adbcc1f (patch)
treeba18fa50459de3f09b184973adaafe17b21df49c /test/serialization
parent0e1ff86e78ae1813b29972ce4a682ad99dbb41e3 (diff)
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>
Diffstat (limited to 'test/serialization')
-rw-r--r--test/serialization/ipa_data_serializer_test.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/serialization/ipa_data_serializer_test.cpp b/test/serialization/ipa_data_serializer_test.cpp
index 880bcd02..bf7e34e2 100644
--- a/test/serialization/ipa_data_serializer_test.cpp
+++ b/test/serialization/ipa_data_serializer_test.cpp
@@ -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 {