From patchwork Thu Mar 25 11:13:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11706 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 A6BBCBDC66 for ; Thu, 25 Mar 2021 11:14:06 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E698168D65; Thu, 25 Mar 2021 12:14:05 +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="XRSBdCAv"; dkim-atps=neutral Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CDA42602D5 for ; Thu, 25 Mar 2021 12:14:04 +0100 (CET) Received: by mail-pg1-x52b.google.com with SMTP id u19so1427695pgh.10 for ; Thu, 25 Mar 2021 04:14:04 -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:mime-version :content-transfer-encoding; bh=swpYWXv8pZADKxhv3P2NWUwDpKqWYN1hW5XFmXO4vPk=; b=XRSBdCAvbdF007UwP3zl9/oD/xgjheZjw9k7zYDeJPrWFwIU5Z6jnvYVZo29mIDrTf /mo1rA8Eh5yvBeupEkwuM5iFoEiZLocfpxJt/dSH2TgsWVnKBpk7BQ3vzx3W1GqnTzLt AXPkQDHilqa7Tdata0xZsLsT7eTWidMI9rW0k= 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:mime-version :content-transfer-encoding; bh=swpYWXv8pZADKxhv3P2NWUwDpKqWYN1hW5XFmXO4vPk=; b=oYCt0kpygqFslnNGpb7xoSriek9MHu51jLzw/rt3bRe1k/9vRKFZtTzsB0a1R/Gh32 AekHmnxKtzrjyCTs6I3rk53ArnQ74ri4EMMRnOMGO2byVOBPjZTgPLlR/EXl9Tn1yI1S okeoxdv0oq7KFY7CuiUbFSNIDRKxWh8bz9YkElZm8yAhLuO5e2creFpSSN+8+ki2HcQC PcUNjHUzfT1iZcVMIuXN2hmOHOgWMsDpJ6Ayt/l2jnynSRefnljaU+1BixqSLo4cE/3Y NGHoVwKp1moMwsxN9Wbbo0IENrl1TUEVvdKovfCVYlQO+9/Dj1PaAdXkd8aSk9804coS UPSA== X-Gm-Message-State: AOAM532YX9pjVeiozcNytrPhULhrgU3LZsLXTuhoqKvSCeX0X75H2j39 WRfn9Wb29CQlv4r2GNEUnVolgLpVnjcl1A== X-Google-Smtp-Source: ABdhPJxfkU8KZ7YC4utiRteDq44Et/yWHyCms2ePgAGu3jfRFLBVlTp1JpaBiJIG6VU/T3qu2Yx0eA== X-Received: by 2002:a17:902:7682:b029:e6:2bc5:f005 with SMTP id m2-20020a1709027682b02900e62bc5f005mr9131613pll.32.1616670843146; Thu, 25 Mar 2021 04:14:03 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:8de:2f19:4b87:ef01]) by smtp.gmail.com with ESMTPSA id 202sm5503803pfu.46.2021.03.25.04.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Mar 2021 04:14:02 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Thu, 25 Mar 2021 20:13:56 +0900 Message-Id: <20210325111357.3862847-1-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] android: CameraDevice: Mark getResultMetadata() const function 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::getResultMetadata() doesn't change either |descriptor| and member variables. It should be marked as a const function and |descriptor| should be passed with const lvalue reference. Signed-off-by: Hirokazu Honda Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/android/camera_device.cpp | 10 +++++----- src/android/camera_device.h | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) -- 2.31.0.291.g576ba9dcdaf-goog diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 5fbf6f82..ae693664 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1924,7 +1924,7 @@ void CameraDevice::requestComplete(Request *request) * pipeline handlers) timestamp in the Request itself. */ uint64_t timestamp = buffers.begin()->second->metadata().timestamp; - resultMetadata = getResultMetadata(descriptor, timestamp); + resultMetadata = getResultMetadata(*descriptor, timestamp); /* Handle any JPEG compression. */ for (camera3_stream_buffer_t &buffer : descriptor->buffers_) { @@ -2030,11 +2030,11 @@ void CameraDevice::notifyError(uint32_t frameNumber, camera3_stream_t *stream) * Produce a set of fixed result metadata. */ std::unique_ptr -CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, - int64_t timestamp) +CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor, + int64_t timestamp) const { - const ControlList &metadata = descriptor->request_->metadata(); - const CameraMetadata &settings = descriptor->settings_; + const ControlList &metadata = descriptor.request_->metadata(); + const CameraMetadata &settings = descriptor.settings_; camera_metadata_ro_entry_t entry; bool found; diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 09c395ff..11bdfec8 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -102,7 +102,8 @@ private: libcamera::PixelFormat toPixelFormat(int format) const; int processControls(Camera3RequestDescriptor *descriptor); std::unique_ptr getResultMetadata( - Camera3RequestDescriptor *descriptor, int64_t timestamp); + const Camera3RequestDescriptor &descriptor, + int64_t timestamp) const; unsigned int id_; camera3_device_t camera3Device_;