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.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/android/camera_device.cpp') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 3419236a..de6f86f7 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -233,6 +233,13 @@ CameraDevice::~CameraDevice() delete it.second; } +std::shared_ptr CameraDevice::create(unsigned int id, + const std::shared_ptr &cam) +{ + CameraDevice *camera = new CameraDevice(id, cam); + return std::shared_ptr(camera); +} + /* * Initialize the camera static information. * This method is called before the camera device is opened. -- cgit v1.2.1