From patchwork Thu Jan 21 17:46:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10941 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 5CCA0C0F2A for ; Thu, 21 Jan 2021 17:46:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1C4BF68217; Thu, 21 Jan 2021 18:46:47 +0100 (CET) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B360668219 for ; Thu, 21 Jan 2021 18:46:43 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 7F3EEFF803 for ; Thu, 21 Jan 2021 17:46:43 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Thu, 21 Jan 2021 18:46:33 +0100 Message-Id: <20210121174633.382334-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210121174633.382334-1-jacopo@jmondi.org> References: <20210121174633.382334-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/5] android: camera_device: Return AE FPS range 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" The result metadata reported an arbitrary {30, 30} FPS range for the AE algorithm. The actual FPS range should be returned in the Request::metadata, but as libcamera currently does not support that feature temporary work around the issue and return the FPS range requested by the camera framework. Signed-off-by: Jacopo Mondi --- src/android/camera_device.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 3560f16698c4..7fe2ae5bbe82 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1932,6 +1932,7 @@ std::unique_ptr CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, int64_t timestamp) { + const CameraMetadata &settings = descriptor->settings_; const ControlList &metadata = descriptor->request_->metadata(); /* @@ -1958,9 +1959,21 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, value = ANDROID_CONTROL_AE_MODE_ON; resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, &value, 1); - std::vector aeFpsTarget = { 30, 30 }; - resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, - aeFpsTarget.data(), aeFpsTarget.size()); + camera_metadata_ro_entry_t entry; + bool found = settings.getEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, &entry); + if (found) { + /* + * \todo Retrieve the AE FPS range from the libcamera metadata. + * As libcamera does not support that control, as a temporary + * workaround return what the framework asked. + */ + const int32_t *data = entry.data.i32; + std::vector aeFpsTarget = { + data[0], data[1], + }; + resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + aeFpsTarget.data(), aeFpsTarget.size()); + } value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE; resultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,