From patchwork Mon Dec 28 16:40:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10754 X-Patchwork-Delegate: jacopo@jmondi.org 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 7B25FC0F1A for ; Mon, 28 Dec 2020 16:39:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 54A79619AF; Mon, 28 Dec 2020 17:39:59 +0100 (CET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F2ED8619AF for ; Mon, 28 Dec 2020 17:39:55 +0100 (CET) X-Originating-IP: 2.224.242.101 Received: from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101]) (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 528F624000D; Mon, 28 Dec 2020 16:39:55 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Dec 2020 17:40:02 +0100 Message-Id: <20201228164003.53051-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228164003.53051-1-jacopo@jmondi.org> References: <20201228164003.53051-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/5] android: camera_device: Report ColorFilterArrangement 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" Conditionally report the ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT property inspecting the draft property reported by the libcamera Camera. Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/android/camera_device.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index b4618a680f41..bbf016c323a7 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -897,9 +897,12 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_SENSOR_INFO_SENSITIVITY_RANGE, &sensitivityRange, 2); - uint16_t filterArr = ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG; - staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, - &filterArr, 1); + /* Report the color filter arrangement if the camera reports it. */ + if (properties.contains(properties::draft::ColorFilterArrangement)) { + uint8_t filterArr = properties.get(properties::draft::ColorFilterArrangement); + staticMetadata_->addEntry(ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, + &filterArr, 1); + } int64_t exposureTimeRange[] = { 100000, 200000000,