summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera_sensor.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 7e6995c4..1628ba9c 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -288,6 +288,25 @@ int CameraSensor::initProperties()
propertyValue = 0;
properties_.set(properties::Rotation, propertyValue);
+ Rectangle bounds;
+ ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_BOUNDS, &bounds);
+ if (!ret)
+ properties_.set(properties::PixelArraySize, bounds.size());
+
+ Rectangle crop;
+ ret = subdev_->getSelection(pad_, V4L2_SEL_TGT_CROP_DEFAULT, &crop);
+ if (!ret) {
+ /*
+ * V4L2_SEL_TGT_CROP_DEFAULT and V4L2_SEL_TGT_CROP_BOUNDS are
+ * defined relatively to the sensor full pixel array size,
+ * while properties::PixelArrayActiveAreas is defined relatively
+ * to properties::PixelArraySize. Adjust it.
+ */
+ crop.x -= bounds.x;
+ crop.y -= bounds.y;
+ properties_.set(properties::PixelArrayActiveAreas, { crop });
+ }
+
return 0;
}