From patchwork Mon Oct 28 02:22:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 2258 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A7A1E6151C for ; Mon, 28 Oct 2019 03:22:50 +0100 (CET) X-Halon-ID: d4f17c33-f929-11e9-903a-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from localhost.localdomain (unknown [93.2.121.143]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id d4f17c33-f929-11e9-903a-005056917f90; Mon, 28 Oct 2019 03:22:47 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 03:22:23 +0100 Message-Id: <20191028022224.795355-10-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> References: <20191028022224.795355-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/10] cam: Store camera as shared pointer everywhere 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: , X-List-Received-Date: Mon, 28 Oct 2019 02:22:51 -0000 Do not store the camera raw pointer in the capture class, this will prevent forwarding the shared pointer in the future. Signed-off-by: Niklas Söderlund --- src/cam/capture.cpp | 2 +- src/cam/capture.h | 4 ++-- src/cam/main.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cam/capture.cpp b/src/cam/capture.cpp index 27332df1d55a5c2d..e665d819fb777a90 100644 --- a/src/cam/capture.cpp +++ b/src/cam/capture.cpp @@ -16,7 +16,7 @@ using namespace libcamera; -Capture::Capture(Camera *camera, CameraConfiguration *config) +Capture::Capture(std::shared_ptr camera, CameraConfiguration *config) : camera_(camera), config_(config), writer_(nullptr) { } diff --git a/src/cam/capture.h b/src/cam/capture.h index 4d396afb8c771a74..c692d48918f2de1d 100644 --- a/src/cam/capture.h +++ b/src/cam/capture.h @@ -21,7 +21,7 @@ class Capture { public: - Capture(libcamera::Camera *camera, + Capture(std::shared_ptr camera, libcamera::CameraConfiguration *config); int run(EventLoop *loop, const OptionsParser::Options &options); @@ -30,7 +30,7 @@ private: void requestComplete(libcamera::Request *request); - libcamera::Camera *camera_; + std::shared_ptr camera_; libcamera::CameraConfiguration *config_; std::map streamName_; diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 9d99f5587cbb77d0..a38cca959aca05ff 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -319,7 +319,7 @@ int CamApp::run() } if (options_.isSet(OptCapture)) { - Capture capture(camera_.get(), config_.get()); + Capture capture(camera_, config_.get()); return capture.run(loop_, options_); }