diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2019-01-25 17:59:29 +0100 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2019-01-29 15:33:10 +0100 |
commit | 4f32a3b408430f9bbbac260e8aedd1b90244639d (patch) | |
tree | 408ba4c22b9937a5bf4f86172663da2d00cf31ea | |
parent | ebc4cab8626f449a5f028cfa52fd7a6eb3d57184 (diff) |
libcamera: ipu3: Re-work camera data registration
Re-work camera data registration to create the cameraData pointer as
unique_ptr<> and make clear its ownership model.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
-rw-r--r-- | src/libcamera/pipeline/ipu3/ipu3.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 64f639fc..80f4a7bf 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -210,18 +210,16 @@ void PipelineHandlerIPU3::registerCameras() * registered. The 'camera' shared pointer goes out of scope * and deletes the Camera it manages. */ - V4L2Device *videoDev = createVideoDevice(id); - if (!videoDev) { + std::unique_ptr<IPU3CameraData> data = utils::make_unique<IPU3CameraData>(); + data->dev_ = createVideoDevice(id); + if (!data->dev_) { LOG(IPU3, Error) << "Failed to register camera[" << numCameras << "] \"" << cameraName << "\""; continue; } - IPU3CameraData *data = new IPU3CameraData(); - data->dev_ = videoDev; - setCameraData(camera.get(), - std::move(std::unique_ptr<IPU3CameraData>(data))); + setCameraData(camera.get(), std::move(data)); registerCamera(std::move(camera)); LOG(IPU3, Info) |