summaryrefslogtreecommitdiff
path: root/src/android
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-07-21 00:16:24 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-08-03 23:44:09 +0200
commit7876d631d930a761e42ed1b16b1aa35216f7d6a5 (patch)
treef6175fca9309759c69963a8102daceacce7f61f5 /src/android
parentd4de037a8ae55f9ebf7e98782928b12490a33c1e (diff)
android: camera_device: Report RAW capability if supported
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 <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android')
-rw-r--r--src/android/camera_device.cpp12
1 files changed, 12 insertions, 0 deletions
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 <libcamera/formats.h>
#include <libcamera/property_ids.h>
+#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<uint8_t> availableCapabilities = {
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE,
};
+
+ /* Report if camera supports RAW. */
+ std::unique_ptr<CameraConfiguration> 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());