[libcamera-devel] [RFC PATCH 1/4] libcamera: Add SensorOutputSize property
David Plowman
david.plowman at raspberrypi.com
Mon Sep 7 18:44:47 CEST 2020
The SensorOutputSize camera property changes with the selected camera
mode, so it must be updated when a new mode is chosen.
---
src/libcamera/camera_sensor.cpp | 3 +++
src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 ++
src/libcamera/property_ids.yaml | 6 ++++++
3 files changed, 11 insertions(+)
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index d2679a4..b1c218e 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -249,6 +249,9 @@ int CameraSensor::init()
propertyValue = 0;
properties_.set(properties::Rotation, propertyValue);
+ /* The SensorOutputSize is known once the camera mode is chosen. */
+ properties_.set(properties::SensorOutputSize, Size(0, 0));
+
/* Enumerate, sort and cache media bus codes and sizes. */
formats_ = subdev_->formats(pad_);
if (formats_.empty()) {
diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index ce43af3..7f151cb 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -646,6 +646,8 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config)
LOG(RPI, Info) << "Sensor: " << camera->id()
<< " - Selected mode: " << sensorFormat.toString();
+ data->properties_.set(properties::SensorOutputSize, sensorFormat.size);
+
/*
* This format may be reset on start() if the bayer order has changed
* because of flips in the sensor.
diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml
index 74ad019..ed1df19 100644
--- a/src/libcamera/property_ids.yaml
+++ b/src/libcamera/property_ids.yaml
@@ -640,4 +640,10 @@ controls:
\todo Rename this property to ActiveAreas once we will have property
categories (i.e. Properties::PixelArray::ActiveAreas)
+ - SensorOutputSize:
+ type: Size
+ description: |
+ The size, in pixels, of the image being output by the sensor in this
+ camera mode.
+
...
--
2.20.1
More information about the libcamera-devel
mailing list