From 8c1fedcb782f4f3f5b23d30ab90f3db43a693b9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 28 Jul 2020 19:43:12 +0200 Subject: android: camera_device: Prepare for non-mandatory formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When probing what formats a libcamera Camera supports we want to allow to probe for non-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(-) (limited to 'src/android/camera_device.cpp') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index b49d6681..8028d3e1 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) << ")"; -- cgit v1.2.1