From patchwork Wed Oct 7 10:17:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10000 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 19172BEEDF for ; Wed, 7 Oct 2020 10:14:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E1EAD60553; Wed, 7 Oct 2020 12:14:02 +0200 (CEST) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 20F4760455 for ; Wed, 7 Oct 2020 12:14:01 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 3A5A46000E; Wed, 7 Oct 2020 10:14:00 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Wed, 7 Oct 2020 12:17:40 +0200 Message-Id: <20201007101745.15104-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201007101745.15104-1-jacopo@jmondi.org> References: <20201007101745.15104-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 08/13] android: camera_device: Return Camera as shared_ptr X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Return the Camera wrapped by the CameraDevice as a shared_ptr. This will be required to construct the FrameBuffer allocator in the CameraStream class. Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/android/camera_device.h | 2 +- src/android/camera_hal_manager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 826023b453f7..777d1a35e801 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -49,7 +49,7 @@ public: unsigned int id() const { return id_; } camera3_device_t *camera3Device() { return &camera3Device_; } - const libcamera::Camera *camera() const { return camera_.get(); } + std::shared_ptr camera() const { return camera_; } libcamera::CameraConfiguration *cameraConfiguration() const { return config_.get(); diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index 05b474010b1d..2a33f9b17112 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -155,7 +155,7 @@ void CameraHalManager::cameraRemoved(std::shared_ptr cam) auto iter = std::find_if(cameras_.begin(), cameras_.end(), [&cam](std::shared_ptr &camera) { - return cam.get() == camera->camera(); + return cam == camera->camera(); }); if (iter == cameras_.end()) return;