From f8e2813ffe0943fabcff26e47bf4891c07ea18ab Mon Sep 17 00:00:00 2001 From: Umang Jain Date: Fri, 21 Aug 2020 14:46:08 +0000 Subject: android: camera_device: Make CameraDevice a shared object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CameraDevice needs to be wrapper into the std::shared_ptr instead of std::unique_ptr to enable refcounting. The refcounting will help us to support hotplug and hot-unplug CameraHalManager operations in the subsequent commit. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund Signed-off-by: Laurent Pinchart --- src/android/camera_device.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/android/camera_device.h') diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 7be9e119..3e472c71 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -47,7 +47,8 @@ struct CameraStream { class CameraDevice : protected libcamera::Loggable { public: - CameraDevice(unsigned int id, const std::shared_ptr &camera); + static std::shared_ptr create(unsigned int id, + const std::shared_ptr &cam); ~CameraDevice(); int initialize(); @@ -72,6 +73,8 @@ protected: std::string logPrefix() const override; private: + CameraDevice(unsigned int id, const std::shared_ptr &camera); + struct Camera3RequestDescriptor { Camera3RequestDescriptor(unsigned int frameNumber, unsigned int numBuffers); -- cgit v1.2.1