libcamera: camera: Handle camera objects through shared pointers

The Camera class is explicitly reference-counted to manage the lifetime
of camera objects. Replace this open-coded implementation with usage of
the std::shared_ptr<> class.

This API change prevents pipeline handlers from subclassing the Camera
class. This isn't deemed to be an issue. Mark the class final to make
this explicit.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2019-01-17 16:23:25 +02:00
parent f3695e9b09
commit 21ff749a79
6 changed files with 54 additions and 45 deletions

View file

@ -64,8 +64,8 @@ bool PipeHandlerVimc::match(CameraManager *manager, DeviceEnumerator *enumerator
* will be chosen depends on how the Camera
* object is modeled.
*/
Camera *camera = new Camera("Dummy VIMC Camera");
manager->addCamera(camera);
std::shared_ptr<Camera> camera = Camera::create("Dummy VIMC Camera");
manager->addCamera(std::move(camera));
return true;
}