From f3695e9b09ce4a88d6e0480d9e5058673af34a49 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 3 Jan 2019 13:10:37 +0200 Subject: libcamera: camera_manager: Register cameras with the camera manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cameras are listed through a double indirection, first iterating over all available pipeline handlers, and then listing the cameras they each support. To simplify the API make the pipeline handlers register the cameras with the camera manager directly, which lets the camera manager easily expose the list of all available cameras. The PipelineHandler API gets simplified as the handlers don't need to expose the list of cameras they have created. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- include/libcamera/camera_manager.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/libcamera/camera_manager.h') diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h index b82a8ce9..4b941fd9 100644 --- a/include/libcamera/camera_manager.h +++ b/include/libcamera/camera_manager.h @@ -24,9 +24,11 @@ public: int start(); void stop(); - std::vector list() const; + const std::vector &cameras() const { return cameras_; } Camera *get(const std::string &name); + void addCamera(Camera *camera); + static CameraManager *instance(); void setEventDispatcher(std::unique_ptr dispatcher); @@ -40,6 +42,7 @@ private: std::unique_ptr enumerator_; std::vector pipes_; + std::vector cameras_; std::unique_ptr dispatcher_; }; -- cgit v1.2.1