@@ -64,7 +64,7 @@ public:
Transform transform = Transform::Identity,
V4L2SubdeviceFormat *sensorFormat = nullptr) = 0;
- virtual V4L2Subdevice::Stream imageStream() const;
+ virtual V4L2Subdevice::Stream imageStream() const = 0;
virtual std::optional<V4L2Subdevice::Stream> embeddedDataStream() const;
virtual V4L2SubdeviceFormat embeddedDataFormat() const;
virtual int setEmbeddedDataEnabled(bool enable);
@@ -209,10 +209,6 @@ CameraSensor::~CameraSensor() = default;
*
* \return The image source stream
*/
-V4L2Subdevice::Stream CameraSensor::imageStream() const
-{
- return { 0, 0 };
-}
/**
* \brief Retrieve the embedded data source stream
@@ -84,6 +84,7 @@ public:
Transform transform = Transform::Identity,
V4L2SubdeviceFormat *sensorFormat = nullptr) override;
+ V4L2Subdevice::Stream imageStream() const override;
const ControlList &properties() const override { return properties_; }
int sensorInfo(IPACameraSensorInfo *info) const override;
Transform computeTransform(Orientation *orientation) const override;
@@ -855,6 +856,11 @@ int CameraSensorLegacy::applyConfiguration(const SensorConfiguration &config,
return 0;
}
+V4L2Subdevice::Stream CameraSensorLegacy::imageStream() const
+{
+ return { pad_, 0 };
+}
+
int CameraSensorLegacy::sensorInfo(IPACameraSensorInfo *info) const
{
if (!bayerFormat_)
The CameraSensor::imageStream() function has a default implementation in the base class that returns {0, 0} as {pad, stream}, assuming that the image pad is located on the pad index 0. This assumption is correct most of the time, but not in some other cases, for instance when an external ISP entity acts as the sensor. Such entity would typically have sink pad(s) connected to the actual sensor and source pad(s) connected to the downstream graph. Associated pad indexes would likely be different from zero. CameraSensorLegacy subclass correctly handles this case in its functions, using the pad_ variable discovered at init() time to access the source pad index, instead of using a hardcoded zero value. Exception is imageStream() that is not overriden in the CameraSensorLegacy definition so keeps the default implementation of the parent class, hardcoding the returned source pad index to zero. This change declares CameraSensor::imageStream() as a pure virtual to let the subclasses provide an implementation. Implementation for CameraSensorLegacy is added, based on pad_ variable usage. Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> --- include/libcamera/internal/camera_sensor.h | 2 +- src/libcamera/sensor/camera_sensor.cpp | 4 ---- src/libcamera/sensor/camera_sensor_legacy.cpp | 6 ++++++ 3 files changed, 7 insertions(+), 5 deletions(-)