From eec6c541341c4d6d8e3654773e94c0d93ff3a1bf Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 9 Dec 2020 18:16:11 +0100 Subject: android: camera_device: Report number of out streams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Report the number of supported output streams through the ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS static metadata. The camera HAL currently supports: - 1 optional RAW stream - 2 YUV streams - 1 JPEG stream Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham Signed-off-by: Jacopo Mondi --- src/android/camera_device.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 26aa3bc4..b4618a68 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -675,10 +675,10 @@ std::tuple CameraDevice::calculateStaticMetadataSize() { /* * \todo Keep this in sync with the actual number of entries. - * Currently: 52 entries, 698 bytes of static metadata + * Currently: 53 entries, 714 bytes of static metadata */ - uint32_t numEntries = 52; - uint32_t byteSize = 698; + uint32_t numEntries = 53; + uint32_t byteSize = 714; /* * Calculate space occupation in bytes for dynamically built metadata @@ -1090,15 +1090,23 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() }; /* Report if camera supports RAW. */ + bool rawStreamAvailable = false; std::unique_ptr cameraConfig = camera_->generateConfiguration({ StreamRole::Raw }); if (cameraConfig && !cameraConfig->empty()) { const PixelFormatInfo &info = PixelFormatInfo::info(cameraConfig->at(0).pixelFormat); - if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) + if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) { + rawStreamAvailable = true; availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW); + } } + /* Number of { RAW, YUV, JPEG } supported output streams */ + int32_t numOutStreams[] = { rawStreamAvailable, 2, 1 }; + staticMetadata_->addEntry(ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, + &numOutStreams, 3); + staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, availableCapabilities.data(), availableCapabilities.size()); @@ -1150,6 +1158,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL, ANDROID_REQUEST_PARTIAL_RESULT_COUNT, ANDROID_REQUEST_PIPELINE_MAX_DEPTH, + ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, }; -- cgit v1.2.1