diff options
author | Jacopo Mondi <jacopo@jmondi.org> | 2021-06-30 14:19:00 +0200 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2021-10-15 09:32:31 +0200 |
commit | 5a995a01bc497dc7b1e723de49285bd44b0667ef (patch) | |
tree | 6ef7cc3b3e6969af887a71505fb7ccd29a56c895 | |
parent | 56ee14e16dc31c97be6c00bef0728a6fc9f13e86 (diff) |
android: capabilities: Initialize camera state when building properties
Now that building the list of supported stream configuration requires
applying a configuration to the Camera, re-initialize the camera
controls by applying a configuration generated for the Viewfinder stream
role before building the list of static metadata.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | src/android/camera_capabilities.cpp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 1583a0a0..a98e6099 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -394,11 +394,14 @@ int CameraCapabilities::initialize(std::shared_ptr<Camera> camera, } ret = initializeStreamConfigurations(); - camera_->release(); - if (ret) + if (ret) { + camera_->release(); return ret; + } - return initializeStaticMetadata(); + ret = initializeStaticMetadata(); + camera_->release(); + return ret; } std::vector<Size> @@ -696,6 +699,25 @@ int CameraCapabilities::initializeStaticMetadata() return -EINVAL; } + /* + * Generate and apply a new configuration for the Viewfinder role to + * collect control limits and properties from a known state. + */ + std::unique_ptr<CameraConfiguration> cameraConfig = + camera_->generateConfiguration({ StreamRole::Viewfinder }); + if (!cameraConfig) { + LOG(HAL, Error) << "Failed to generate camera configuration"; + staticMetadata_.reset(); + return -ENODEV; + } + + int ret = camera_->configure(cameraConfig.get()); + if (ret) { + LOG(HAL, Error) << "Failed to initialize the camera state"; + staticMetadata_.reset(); + return ret; + } + const ControlInfoMap &controlsInfo = camera_->controls(); const ControlList &properties = camera_->properties(); |