summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-12-31 00:11:59 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2021-01-04 13:35:05 +0100
commit35de31e0277142247ca37660ccf75fbaa213fd0e (patch)
tree119849e42421accc3b665fba45595f2cb91e4cd9
parent0e6cd15b063399e83a5a964f9f311db5042c27fa (diff)
android: camera_device: Only advertise RAW support if RAW16 is available
The Android camera2 API defines a RAW capture capability ([1]) for devices that support "outputting RAW buffers and metadata for interpreting them". This capability requires the camera device to support RAW_SENSOR ([2]) as an output format. Despite what its name may sound like, the RAW_SENSOR format is defined as a 16 bits RAW format, not an opaque implementation-dependent format (which is instead called RAW_PRIVATE). Devices may additionally support the RAW10 and RAW12 formats, but that isn't enough to claim RAW capture capability. To comply with the API requirements, only report the ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW capability when 16-bit RAW is supported. [1] https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#REQUEST_AVAILABLE_CAPABILITIES_RAW [2] https://developer.android.com/reference/android/graphics/ImageFormat#RAW_SENSOR Suggested-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--src/android/camera_device.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 7678d448..23be2a59 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -1099,7 +1099,9 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
if (cameraConfig && !cameraConfig->empty()) {
const PixelFormatInfo &info =
PixelFormatInfo::info(cameraConfig->at(0).pixelFormat);
- if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) {
+ /* Only advertise RAW support if RAW16 is possible. */
+ if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW &&
+ info.bitsPerPixel == 16) {
rawStreamAvailable = true;
availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW);
}