From patchwork Tue Oct 20 07:42:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 10124 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 8200FBDB13 for ; Tue, 20 Oct 2020 07:42:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4E633610C4; Tue, 20 Oct 2020 09:42:46 +0200 (CEST) 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="dnzjYHx4"; dkim-atps=neutral Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 06CB761394 for ; Tue, 20 Oct 2020 09:42:45 +0200 (CEST) Received: by mail-pg1-x531.google.com with SMTP id t14so589135pgg.1 for ; Tue, 20 Oct 2020 00:42:44 -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=DHCLfJ0ITVxCOAjl+xiD/qqBE4LmukKaknHvfygvs/o=; b=dnzjYHx4pOO4r6mO20SrCg0hdqV6eAE78uXNBjOpAB3TeEHPDWM+3JvQtl1xcq2BWu qfeJ8LLyLf1xY8ZK1Ig50Snu04zBSTWxjwp47A9gQKyFFX+yYQ8NXz9zhA6SPYf4OhqH MdL8t3xd5myqWIJ2oYE9BRw91Ac0ZR//3buUQ= 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=DHCLfJ0ITVxCOAjl+xiD/qqBE4LmukKaknHvfygvs/o=; b=CJB9qgg2RFGTiqwRTxIBwXXsiYgv3JA/NzYxRflntJurCjy4lxnD68PyGdJ/nCt1My A25b0ARuK93GpcalKrRs9LUa5s/hfhLaV6KVOph4ex0xLDr1mzIQdSTRAwOmg8JNepFf lCBraBdNmx+d9QoPj0OHUu1GHkBkL0MrpczOzUTTfXQRXfjWNDw0Lj4/5KcNe/jq2QN5 79qtaMPaPbPuS9o3FSuHMH4mfZWvgL0CSFa8kVUg3YqafMe85M/+2rHEU4V140l5cH6U bzVcnGE7QZ0nadYpsXUBgeBidHplO0+pBCzghNQiOXqi81xSCdS5HE1g5afoSsUSVyGU uNOg== X-Gm-Message-State: AOAM5318Lrr4JJ0HL8b7jTwJ4V3VrwSthocNEEpinIfK+1LvE2II4QJ9 +fm+q6ZIkxKb14aDti+oLBapdsPlZEJb9w== X-Google-Smtp-Source: ABdhPJzWS51yACj38RQUzxBGxTOwIbhrF4Ov/sNx4g7aR3Q6JjE6HSNwTZt7oKjSgYNJLmRKvfsMzg== X-Received: by 2002:a65:5b48:: with SMTP id y8mr1582578pgr.67.1603179763376; Tue, 20 Oct 2020 00:42:43 -0700 (PDT) Received: from hiroh.tok.corp.google.com ([2401:fa00:8f:2:de4a:3eff:fe7d:f78f]) by smtp.gmail.com with ESMTPSA id d26sm1193684pfo.82.2020.10.20.00.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Oct 2020 00:42:42 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Tue, 20 Oct 2020 16:42:29 +0900 Message-Id: <20201020074229.119151-4-hiroh@chromium.org> X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog In-Reply-To: <20201020074229.119151-1-hiroh@chromium.org> References: <20201020074229.119151-1-hiroh@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/4] android: camera_stream: Make some member variables constant 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" CameraStream initializes several member variables in the initializer list. Some of them are unchanged after. This makes them constant. Especially, doing to |cameraDevice_| represents CameraStream doesn't have the ownership of it. Signed-off-by: Hirokazu Honda Reviewed-by: Umang Jain Reviewed-by: Kieran Bingham --- src/android/camera_stream.cpp | 7 +++---- src/android/camera_stream.h | 10 +++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 28a6e09..9644b74 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -38,13 +38,12 @@ LOG_DECLARE_CATEGORY(HAL); * and buffer allocation. */ -CameraStream::CameraStream(CameraDevice *cameraDevice, Type type, +CameraStream::CameraStream(CameraDevice const *cameraDevice, Type type, camera3_stream_t *camera3Stream, unsigned int index) - : cameraDevice_(cameraDevice), type_(type), + : cameraDevice_(cameraDevice), + config_(cameraDevice->cameraConfiguration()), type_(type), camera3Stream_(camera3Stream), index_(index) { - config_ = cameraDevice_->cameraConfiguration(); - if (type_ == Type::Internal || type_ == Type::Mapped) { /* * \todo There might be multiple post-processors. The logic diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index c367a5f..23c139d 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -109,7 +109,7 @@ public: Internal, Mapped, }; - CameraStream(CameraDevice *cameraDevice, Type type, + CameraStream(CameraDevice const *cameraDevice, Type type, camera3_stream_t *camera3Stream, unsigned int index); Type type() const { return type_; } @@ -124,11 +124,11 @@ public: void putBuffer(libcamera::FrameBuffer *buffer); private: - CameraDevice *cameraDevice_; - libcamera::CameraConfiguration *config_; - Type type_; + CameraDevice const *cameraDevice_; + const libcamera::CameraConfiguration *config_; + const Type type_; camera3_stream_t *camera3Stream_; - unsigned int index_; + const unsigned int index_; std::unique_ptr allocator_; std::vector buffers_;