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:
@@ -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: "
|
||||
|
||||
Reference in New Issue
Block a user