From 5b02e03199b79165086135236d8fb9b2c673aae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 22 Jan 2019 16:31:39 +0100 Subject: libcamera: camera: Associate cameras with their pipeline handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PipelineHandler which creates a Camera is responsible for serving any operation requested by the user. In order forward the public API calls, the camera needs to store a reference to its pipeline handler. Signed-off-by: Niklas Söderlund Signed-off-by: Laurent Pinchart --- Changes since v1: - Create pipeline handlers is shared pointers, make them inherit from std::enable_shared_from_this<> and stored them in shared pointers. --- include/libcamera/camera.h | 8 ++++++-- include/libcamera/camera_manager.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h index 2ea1a688..efafb9e2 100644 --- a/include/libcamera/camera.h +++ b/include/libcamera/camera.h @@ -12,10 +12,13 @@ namespace libcamera { +class PipelineHandler; + class Camera final { public: - static std::shared_ptr create(const std::string &name); + static std::shared_ptr create(PipelineHandler *pipe, + const std::string &name); Camera(const Camera &) = delete; void operator=(const Camera &) = delete; @@ -23,9 +26,10 @@ public: const std::string &name() const; private: - explicit Camera(const std::string &name); + Camera(PipelineHandler *pipe, const std::string &name); ~Camera(); + std::shared_ptr pipe_; std::string name_; }; diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h index 9ade29d7..45e72df0 100644 --- a/include/libcamera/camera_manager.h +++ b/include/libcamera/camera_manager.h @@ -41,7 +41,7 @@ private: ~CameraManager(); std::unique_ptr enumerator_; - std::vector pipes_; + std::vector> pipes_; std::vector> cameras_; std::unique_ptr dispatcher_; -- cgit v1.2.1