summaryrefslogtreecommitdiff
path: root/include/libcamera/camera_manager.h
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-01-17 16:23:25 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-01-21 11:13:53 +0200
commit21ff749a790386f87e767a690c77948a6474ceaa (patch)
treeb50d8edf0846336f5cf85f69fe653fa32c695059 /include/libcamera/camera_manager.h
parentf3695e9b09ce4a88d6e0480d9e5058673af34a49 (diff)
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>
Diffstat (limited to 'include/libcamera/camera_manager.h')
-rw-r--r--include/libcamera/camera_manager.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h
index 4b941fd9..9ade29d7 100644
--- a/include/libcamera/camera_manager.h
+++ b/include/libcamera/camera_manager.h
@@ -24,10 +24,10 @@ public:
int start();
void stop();
- const std::vector<Camera *> &cameras() const { return cameras_; }
- Camera *get(const std::string &name);
+ const std::vector<std::shared_ptr<Camera>> &cameras() const { return cameras_; }
+ std::shared_ptr<Camera> get(const std::string &name);
- void addCamera(Camera *camera);
+ void addCamera(std::shared_ptr<Camera> camera);
static CameraManager *instance();
@@ -42,7 +42,7 @@ private:
std::unique_ptr<DeviceEnumerator> enumerator_;
std::vector<PipelineHandler *> pipes_;
- std::vector<Camera *> cameras_;
+ std::vector<std::shared_ptr<Camera>> cameras_;
std::unique_ptr<EventDispatcher> dispatcher_;
};