From aa9a1eef2106383e965004c9ceeba9ed4746b78d Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Tue, 17 Dec 2019 12:47:51 +0100 Subject: 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 Signed-off-by: Laurent Pinchart Reviewed-by: Stefan Klug --- Changes since combined RFC: - Fix indentation in REGISTER_CAMERA_SENSOR() macro --- test/v4l2_videodevice/v4l2_videodevice_test.cpp | 5 ++--- test/v4l2_videodevice/v4l2_videodevice_test.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'test/v4l2_videodevice') diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.cpp b/test/v4l2_videodevice/v4l2_videodevice_test.cpp index 1113cf5b..9fbd24cc 100644 --- a/test/v4l2_videodevice/v4l2_videodevice_test.cpp +++ b/test/v4l2_videodevice/v4l2_videodevice_test.cpp @@ -64,8 +64,8 @@ int V4L2VideoDeviceTest::init() format.size.height = 480; if (driver_ == "vimc") { - sensor_ = new CameraSensor(media_->getEntityByName("Sensor A")); - if (sensor_->init()) + sensor_ = CameraSensorFactoryBase::create(media_->getEntityByName("Sensor A")); + if (!sensor_) return TestFail; debayer_ = new V4L2Subdevice(media_->getEntityByName("Debayer A")); @@ -98,6 +98,5 @@ void V4L2VideoDeviceTest::cleanup() capture_->close(); delete debayer_; - delete sensor_; delete capture_; } diff --git a/test/v4l2_videodevice/v4l2_videodevice_test.h b/test/v4l2_videodevice/v4l2_videodevice_test.h index d2de1a6d..f06db72a 100644 --- a/test/v4l2_videodevice/v4l2_videodevice_test.h +++ b/test/v4l2_videodevice/v4l2_videodevice_test.h @@ -36,7 +36,7 @@ protected: std::string entity_; std::unique_ptr enumerator_; std::shared_ptr media_; - libcamera::CameraSensor *sensor_; + std::unique_ptr sensor_; libcamera::V4L2Subdevice *debayer_; libcamera::V4L2VideoDevice *capture_; std::vector> buffers_; -- cgit v1.2.1