summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-12-06 14:49:16 +0900
committerJacopo Mondi <jacopo@jmondi.org>2021-12-06 17:41:45 +0100
commit5148c0aa7e5957628c4fe6b8b9bca9e923e608ce (patch)
treedfe51faa58ce4d5efe7315bd7881aea683825164 /src
parentb53f6efb99e289375b88f50d3fb5ef216c97da02 (diff)
libcamera: camera_sensor: Reference test pattern modes by enum type
The CameraSensor stores TestPatternModes as an int32_t. This prevents the compiler from verifying the usage against the defined enum types. Fix references to the TestPatternMode to store the value as the TestPatternModeEnum type which is defined by the control generator. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera_sensor.cpp4
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp7
2 files changed, 6 insertions, 5 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 4c142a58..dc871abf 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -311,7 +311,7 @@ void CameraSensor::initStaticProperties()
}
void CameraSensor::initTestPatternModes(
- const std::map<int32_t, int32_t> &testPatternModes)
+ const std::map<controls::draft::TestPatternModeEnum, int32_t> &testPatternModes)
{
const auto &v4l2TestPattern = controls().find(V4L2_CID_TEST_PATTERN);
if (v4l2TestPattern == controls().end()) {
@@ -327,7 +327,7 @@ void CameraSensor::initTestPatternModes(
* control index is supported in the below for loop that creates the
* list of supported test patterns.
*/
- std::map<int32_t, int32_t> indexToTestPatternMode;
+ std::map<int32_t, controls::draft::TestPatternModeEnum> indexToTestPatternMode;
for (const auto &it : testPatternModes)
indexToTestPatternMode[it.second] = it.first;
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 16380d20..e7cfc66a 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -983,13 +983,14 @@ int PipelineHandlerIPU3::updateControls(IPU3CameraData *data)
return ret;
ControlInfoMap::Map controls = IPU3Controls;
- const std::vector<int32_t> &testPatternModes = sensor->testPatternModes();
+ const std::vector<controls::draft::TestPatternModeEnum>
+ &testPatternModes = sensor->testPatternModes();
if (!testPatternModes.empty()) {
std::vector<ControlValue> values;
values.reserve(testPatternModes.size());
- for (int32_t pattern : testPatternModes)
- values.emplace_back(pattern);
+ for (auto pattern : testPatternModes)
+ values.emplace_back(static_cast<int32_t>(pattern));
controls[&controls::draft::TestPatternMode] = ControlInfo(values);
}