summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHirokazu Honda <hiroh@chromium.org>2021-06-10 17:25:37 +0900
committerJacopo Mondi <jacopo@jmondi.org>2021-06-14 14:10:58 +0200
commit5d0eb4024932cbf57bcc4d4fb0b37d98522cad7f (patch)
treef4595c6a3a6259a0e0a135f0422d883401bc28ed /src
parent0b312cb4acd9e9ce0ab6fce8fe2db1afca4c5fd8 (diff)
libcamera: CameraSensor: Enable retrieving supported test pattern modes
This enables retrieving supported test pattern modes through CameraSensorInfo. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> 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.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 0fb8a258..3e135353 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -305,6 +305,32 @@ void CameraSensor::initStaticProperties()
/* Register the properties retrieved from the sensor database. */
properties_.set(properties::UnitCellSize, props->unitCellSize);
+
+ initTestPatternModes(props->testPatternModes);
+}
+
+void CameraSensor::initTestPatternModes(
+ const std::map<int32_t, int32_t> &testPatternModes)
+{
+ const auto &v4l2TestPattern = controls().find(V4L2_CID_TEST_PATTERN);
+ if (v4l2TestPattern == controls().end()) {
+ LOG(CameraSensor, Debug) << "No static test pattern map for \'"
+ << model() << "\'";
+ return;
+ }
+
+ for (const ControlValue &value : v4l2TestPattern->second.values()) {
+ const int32_t index = value.get<int32_t>();
+
+ const auto it = testPatternModes.find(index);
+ if (it == testPatternModes.end()) {
+ LOG(CameraSensor, Debug)
+ << "Test pattern mode " << index << " ignored";
+ continue;
+ }
+
+ testPatternModes_.push_back(it->second);
+ }
}
int CameraSensor::initProperties()
@@ -470,6 +496,14 @@ Size CameraSensor::resolution() const
}
/**
+ * \fn CameraSensor::testPatternModes()
+ * \brief Retrieve all the supported test pattern modes of the camera sensor
+ * The test pattern mode values correspond to the controls::TestPattern control.
+ *
+ * \return The list of test pattern modes
+ */
+
+/**
* \brief Retrieve the best sensor format for a desired output
* \param[in] mbusCodes The list of acceptable media bus codes
* \param[in] size The desired size