summaryrefslogtreecommitdiff
path: root/test/camera-sensor.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2019-12-17 12:47:51 +0100
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2024-11-05 18:07:42 +0100
commit6ba23735b973bb4922efd407cb2ce7c2503eadd0 (patch)
treee82abe5eb803356f3dc770a7ce304a47462537c4 /test/camera-sensor.cpp
parent27cece6653e530c4dfd72a35d745e49460f02e54 (diff)
libcamera: camera_sensor: Introduce CameraSensorFactory
Introduce a factory to create CameraSensor derived classes instances by inspecting the sensor media entity name and provide a convenience macro to register specialized sensor handlers. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'test/camera-sensor.cpp')
-rw-r--r--test/camera-sensor.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/test/camera-sensor.cpp b/test/camera-sensor.cpp
index 1d402c43..869c7889 100644
--- a/test/camera-sensor.cpp
+++ b/test/camera-sensor.cpp
@@ -52,8 +52,8 @@ protected:
return TestFail;
}
- sensor_ = new CameraSensor(entity);
- if (sensor_->init() < 0) {
+ sensor_ = CameraSensorFactoryBase::create(entity);
+ if (!sensor_) {
cerr << "Unable to initialise camera sensor" << endl;
return TestFail;
}
@@ -118,13 +118,12 @@ protected:
void cleanup()
{
- delete sensor_;
}
private:
std::unique_ptr<DeviceEnumerator> enumerator_;
std::shared_ptr<MediaDevice> media_;
- CameraSensor *sensor_;
+ std::unique_ptr<CameraSensor> sensor_;
CameraLens *lens_;
};