diff options
Diffstat (limited to 'src/android/camera_device.cpp')
-rw-r--r-- | src/android/camera_device.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 0386287d..0608d026 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -314,6 +314,17 @@ std::vector<Size> CameraDevice::getYUVResolutions(CameraConfiguration *cameraCon return supportedResolutions; } +std::vector<Size> CameraDevice::getRawResolutions(const libcamera::PixelFormat &pixelFormat) +{ + std::unique_ptr<CameraConfiguration> cameraConfig = + camera_->generateConfiguration({ StillCaptureRaw }); + StreamConfiguration &cfg = cameraConfig->at(0); + const StreamFormats &formats = cfg.formats(); + std::vector<Size> supportedResolutions = formats.sizes(pixelFormat); + + return supportedResolutions; +} + /* * Initialize the format conversion map to translate from Android format * identifier to libcamera pixel formats and fill in the list of supported @@ -458,9 +469,15 @@ int CameraDevice::initializeStreamConfigurations() << camera3Format.name << " to " << mappedFormat.toString(); - std::vector<Size> resolutions = getYUVResolutions(cameraConfig.get(), - mappedFormat, - cameraResolutions); + std::vector<Size> resolutions; + const PixelFormatInfo &info = PixelFormatInfo::info(mappedFormat); + if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW) + resolutions = getRawResolutions(mappedFormat); + else + resolutions = getYUVResolutions(cameraConfig.get(), + mappedFormat, + cameraResolutions); + for (const Size &res : resolutions) { streamConfigurations_.push_back({ res, androidFormat }); |