summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-11-06 16:08:16 +0100
committerJacopo Mondi <jacopo@jmondi.org>2020-12-07 14:26:33 +0100
commit1889cdc2e91cc378d239c9b155bbabbdb7827b67 (patch)
treeaad342bef1d0eadbcfc59b66765ecb3681611220
parent8aaa41ee9b4103ae2826d85e4505075a080e3591 (diff)
android: camera_device: Initialize pixel array properties
Initialize pixel array properties in the Android camera HAL inspecting the camera properties. If the camera does not provide any suitable property, not static metadata is registered to the Android framework. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r--src/android/camera_device.cpp33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 675af570..017a15ca 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -593,6 +593,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
}
const ControlInfoMap &controlsInfo = camera_->controls();
+ const ControlList &properties = camera_->properties();
/* Color correction static metadata. */
{
@@ -725,17 +726,29 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
staticMetadata_->addEntry(ANDROID_JPEG_MAX_SIZE, &maxJpegBufferSize_, 1);
/* Sensor static metadata. */
- int32_t pixelArraySize[] = {
- 2592, 1944,
- };
- staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
- &pixelArraySize, 2);
+ if (properties.contains(properties::PixelArraySize)) {
+ const Size &size =
+ properties.get<Size>(properties::PixelArraySize);
+ std::vector<int32_t> data{
+ static_cast<int32_t>(size.width),
+ static_cast<int32_t>(size.height),
+ };
+ staticMetadata_->addEntry(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE,
+ data.data(), data.size());
+ }
- int32_t sensorSizes[] = {
- 0, 0, 2560, 1920,
- };
- staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
- &sensorSizes, 4);
+ if (properties.contains(properties::PixelArrayActiveAreas)) {
+ const Span<const Rectangle> &rects =
+ properties.get<Span<const Rectangle>>(properties::PixelArrayActiveAreas);
+ std::vector<int32_t> data{
+ static_cast<int32_t>(rects[0].x),
+ static_cast<int32_t>(rects[0].y),
+ static_cast<int32_t>(rects[0].width),
+ static_cast<int32_t>(rects[0].height),
+ };
+ staticMetadata_->addEntry(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE,
+ data.data(), data.size());
+ }
int32_t sensitivityRange[] = {
32, 2400,