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>
This commit is contained in:
Hirokazu Honda
2021-12-06 14:49:16 +09:00
committed by Jacopo Mondi
parent b53f6efb99
commit 5148c0aa7e
4 changed files with 14 additions and 9 deletions

View File

@@ -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;