mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 00:25:07 +03:00
libcamera: camera_sensor: Initialize PixelArray properties
Initialize pixel array properties 'PixelArraySize' and 'PixelArrayActiveAreas' by inspecting the V4L2 CROP_BOUNDS and CROP_DEFAULT selection targets. The properties are registered only if the sensor subdevice support the above mentioned selection targets. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
3cb48fb921
commit
8aaa41ee9b
1 changed files with 19 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue