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>
This commit is contained in:
Jacopo Mondi
2019-12-17 12:47:51 +01:00
parent 27cece6653
commit 6ba23735b9
12 changed files with 233 additions and 40 deletions
+2 -7
View File
@@ -388,8 +388,6 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
MediaEntity *sensor)
: Camera::Private(pipe), streams_(numStreams)
{
int ret;
/*
* Find the shortest path from the camera sensor to a video capture
* device using the breadth-first search algorithm. This heuristic will
@@ -480,12 +478,9 @@ SimpleCameraData::SimpleCameraData(SimplePipelineHandler *pipe,
}
/* Finally also remember the sensor. */
sensor_ = std::make_unique<CameraSensor>(sensor);
ret = sensor_->init();
if (ret) {
sensor_.reset();
sensor_ = CameraSensorFactoryBase::create(sensor);
if (!sensor_)
return;
}
LOG(SimplePipeline, Debug)
<< "Found pipeline: "