From 7876d631d930a761e42ed1b16b1aa35216f7d6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 21 Jul 2020 00:16:24 +0200 Subject: android: camera_device: Report RAW capability if supported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Probe the libcamera Camera for RAW support and if supported report RAW capability in the static metadata reported to Android. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- src/android/camera_device.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index b7b6cb19..b5206fd6 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -15,6 +15,7 @@ #include #include +#include "libcamera/internal/formats.h" #include "libcamera/internal/log.h" #include "libcamera/internal/utils.h" @@ -755,6 +756,17 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() std::vector availableCapabilities = { ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE, }; + + /* Report if camera supports RAW. */ + std::unique_ptr cameraConfig = + camera_->generateConfiguration({ StillCaptureRaw }); + if (cameraConfig && !cameraConfig->empty()) { + const PixelFormatInfo &info = + PixelFormatInfo::info(cameraConfig->at(0).pixelFormat); + if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) + availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW); + } + staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, availableCapabilities.data(), availableCapabilities.size()); -- cgit v1.2.1