[libcamera-devel] [PATCH v3 7/7] android: CameraDevice: Report queried test pattern modes
Hirokazu Honda
hiroh at chromium.org
Wed Apr 28 09:36:17 CEST 2021
Report test pattern modes obtained by Camera::controls().
Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
---
src/android/camera_device.cpp | 46 ++++++++++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 4 deletions(-)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 3d5b5f24..a96bc09b 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1090,12 +1090,50 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
staticMetadata_->addEntry(ANDROID_SENSOR_ORIENTATION, &orientation_, 1);
- std::vector<int32_t> testPatterModes = {
- ANDROID_SENSOR_TEST_PATTERN_MODE_OFF,
+ const auto &testPatternsInfo =
+ controlsInfo.find(&controls::draft::TestPatternMode);
+ std::vector<int32_t> testPatternModes = {
+ ANDROID_SENSOR_TEST_PATTERN_MODE_OFF
};
+ if (testPatternsInfo != controlsInfo.end()) {
+ const auto &values = testPatternsInfo->second.values();
+ if (!values.empty()) {
+ testPatternModes.clear();
+ for (const auto &value : values) {
+ int aValue = -1;
+ switch (value.get<int32_t>()) {
+ case controls::draft::TestPatternModeOff:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_OFF;
+ break;
+ case controls::draft::TestPatternModeSolidColor:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR;
+ break;
+ case controls::draft::TestPatternModeColorBars:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS;
+ break;
+ case controls::draft::TestPatternModeColorBarsFadeToGray:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY;
+ break;
+ case controls::draft::TestPatternModePn9:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_PN9;
+ break;
+ case controls::draft::TestPatternModeCustom1:
+ aValue = ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1;
+ break;
+ default:
+ LOG(HAL, Error)
+ << "Unknown test pattern mode: "
+ << value.get<int32_t>();
+ continue;
+ }
+
+ testPatternModes.push_back(aValue);
+ }
+ }
+ }
staticMetadata_->addEntry(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES,
- testPatterModes.data(),
- testPatterModes.size());
+ testPatternModes.data(),
+ testPatternModes.size());
uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;
staticMetadata_->addEntry(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE,
--
2.31.1.498.g6c1eba8ee3d-goog
More information about the libcamera-devel
mailing list