From patchwork Wed Mar 24 07:07:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11679 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 B1183C32E7 for ; Wed, 24 Mar 2021 07:08:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6B7AC68D6A; Wed, 24 Mar 2021 08:08:19 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TqFwzCt3"; dkim-atps=neutral Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8039568D62 for ; Wed, 24 Mar 2021 08:08:14 +0100 (CET) Received: by mail-pg1-x52d.google.com with SMTP id l1so14000736pgb.5 for ; Wed, 24 Mar 2021 00:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HzUlrxUAqE+9T4gZTTau+eWKMHgxbMHPiiSANl2yyjY=; b=TqFwzCt3G5sitV7MY0b/MaOYbxteMlxeXD5Gx6TisUwUb9TDDdOmQoIt+rmq5c4vR3 hEvRbq/L2MbPAsYF4l+RVLh3vO0LlmEbrVy5j1VmswMJFQ5Ljx8goSrjRNxcEmeCAnw8 mxgZHoCiY0uo0zwFmyTHfiFM1S1NcOBbWQfgs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HzUlrxUAqE+9T4gZTTau+eWKMHgxbMHPiiSANl2yyjY=; b=jCgz0NyoQtvyDsGhhhkFV2/OHyqHJSgotTi38IFWKSx2xn7qloCta7w3zmKGTTQ4kM 45SFjUb1AFpY0Y/cmFxxEKuVka7e4/hfqR/F7aomTkbMw/nUqic1uDV5fhTyZa/1Fw4Q LZsZK7MjbWtjn/NjGuTIdiyjSYpVhJYxgjvLfIRgjQHVYLb0kTmTGNuoLARKH3Oa8ZMC bQEvwfLcUwehFlpFBK70EPS8ZgZnMgs/KtaIJI+YoVm60ZriwRAUjA0W+fuzbauGfVKZ 1+qbwJh44El6UpK4YRPDiyULVFC2/TbVgqoiZOboq82uiBWeyrHc4lTzE5oLRT7Lti0I oLOg== X-Gm-Message-State: AOAM531nPiCLfzjYqka82PJ1bF0K9XlFk67ngeQMbpFZS7UI2+20vVKm 1EtHSN1LyQKobFeUgCADTFyp+L7zwNfQuQ== X-Google-Smtp-Source: ABdhPJzEXGHg+d9rqA+Aj3koWonJmIDOZ9Byn4ObhcGZcAFIoEzNi5A1N3Qx72TW2GWMShRB7EwcVQ== X-Received: by 2002:a63:7e52:: with SMTP id o18mr1854555pgn.416.1616569690676; Wed, 24 Mar 2021 00:08:10 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:7c07:24cd:c637:7fab]) by smtp.gmail.com with ESMTPSA id e63sm1246860pfe.208.2021.03.24.00.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 00:08:10 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Wed, 24 Mar 2021 16:07:53 +0900 Message-Id: <20210324070757.3530377-5-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog In-Reply-To: <20210324070757.3530377-1-hiroh@chromium.org> References: <20210324070757.3530377-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/8] android: CameraDevice: Take shared_ptr in constructor 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" CameraDevice takes the ownership of Camera. Therefore, shared_ptr would rather be used than const shared_ptr&. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/android/camera_device.cpp | 12 +++++++----- src/android/camera_device.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) -- 2.31.0.291.g576ba9dcdaf-goog diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index d0955de7..c0630e53 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -312,9 +312,10 @@ CameraDevice::Camera3RequestDescriptor::~Camera3RequestDescriptor() * back to the framework using the designated callbacks. */ -CameraDevice::CameraDevice(unsigned int id, const std::shared_ptr &camera) - : id_(id), running_(false), camera_(camera), staticMetadata_(nullptr), - facing_(CAMERA_FACING_FRONT), orientation_(0) +CameraDevice::CameraDevice(unsigned int id, std::shared_ptr camera) + : id_(id), running_(false), camera_(std::move(camera)), + staticMetadata_(nullptr), facing_(CAMERA_FACING_FRONT), + orientation_(0) { camera_->requestCompleted.connect(this, &CameraDevice::requestComplete); @@ -351,9 +352,10 @@ CameraDevice::~CameraDevice() } std::unique_ptr CameraDevice::create(unsigned int id, - const std::shared_ptr &cam) + std::shared_ptr cam) { - return std::unique_ptr(new CameraDevice(id, cam)); + return std::unique_ptr( + new CameraDevice(id, std::move(cam))); } /* diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 8be7f305..555b33e7 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -33,7 +33,7 @@ class CameraDevice : protected libcamera::Loggable { public: static std::unique_ptr create(unsigned int id, - const std::shared_ptr &cam); + std::shared_ptr cam); ~CameraDevice(); int initialize(); @@ -66,7 +66,7 @@ protected: std::string logPrefix() const override; private: - CameraDevice(unsigned int id, const std::shared_ptr &camera); + CameraDevice(unsigned int id, std::shared_ptr camera); struct Camera3RequestDescriptor { Camera3RequestDescriptor(libcamera::Camera *camera,