From patchwork Sat Aug 1 10:14:25 2020 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: 9130 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 190B6BD86F for ; Sat, 1 Aug 2020 10:15:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B7C8E61F80; Sat, 1 Aug 2020 12:15:11 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B2B761970 for ; Sat, 1 Aug 2020 12:15:10 +0200 (CEST) X-Halon-ID: b0ed7b8f-d3df-11ea-86ee-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id b0ed7b8f-d3df-11ea-86ee-0050569116f7; Sat, 01 Aug 2020 12:13:49 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Sat, 1 Aug 2020 12:14:25 +0200 Message-Id: <20200801101427.1540331-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200801101427.1540331-1-niklas.soderlund@ragnatech.se> References: <20200801101427.1540331-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/3] android: camera_device: Prepare for none-mandatory formats 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" When probing what formats a libcamera Camera supports we want to allow to probe for not mandatory formats. Add a new flag to indicate if a format in camera3FormatsMap is mandatory or not. All current defined formats are mandatory. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index b49d6681e5a52d32..8028d3e12bda1316 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -46,6 +46,7 @@ const std::vector camera3Resolutions = { */ struct Camera3Format { std::vector libcameraFormats; + bool mandatory; const char *name; }; @@ -57,11 +58,13 @@ const std::map camera3FormatsMap = { { HAL_PIXEL_FORMAT_BLOB, { { formats::MJPEG }, + true, "BLOB" } }, { HAL_PIXEL_FORMAT_YCbCr_420_888, { { formats::NV12, formats::NV21 }, + true, "YCbCr_420_888" } }, { @@ -71,6 +74,7 @@ const std::map camera3FormatsMap = { */ HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, { { formats::NV12, formats::NV21 }, + true, "IMPLEMENTATION_DEFINED" } }, @@ -281,7 +285,7 @@ int CameraDevice::initializeStreamConfigurations() break; } } - if (!mappedFormat.isValid()) { + if (camera3Format.mandatory && !mappedFormat.isValid()) { LOG(HAL, Error) << "Failed to map Android format " << camera3Format.name << " (" << utils::hex(androidFormat) << ")";