[libcamera-devel] [PATCH 6/9] android: Set PipelineConfigFile option if it's supported by the camera
Han-Lin Chen
hanlinchen at chromium.org
Wed Feb 9 08:19:14 CET 2022
If the libcamera::Camera supports the PipelineConfigFile option and
the HAL configuration file provides the path, set the option before
opening the camera.
Signed-off-by: Han-Lin Chen <hanlinchen at chromium.org>
---
src/android/camera_device.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 83825736..61883a54 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -20,6 +20,7 @@
#include <libcamera/control_ids.h>
#include <libcamera/controls.h>
#include <libcamera/fence.h>
+#include <libcamera/option_ids.h>
#include <libcamera/formats.h>
#include <libcamera/property_ids.h>
@@ -293,6 +294,24 @@ std::unique_ptr<CameraDevice> CameraDevice::create(unsigned int id,
*/
int CameraDevice::initialize(const CameraConfigData *cameraConfigData)
{
+ /*
+ * Initialize pipeline configuration file for the camera.
+ *
+ * If the libcamera::Camera supports the PipelineConfigFile option and
+ * the HAL configuration file provides the path, set the option before
+ * opening the camera.
+ */
+ const ControlInfoMap optionInfo = camera_->options();
+
+ if (cameraConfigData &&
+ cameraConfigData->pipelineConfigFile != "" &&
+ optionInfo.count(&options::PipelineConfigFile)) {
+ ControlList options(optionInfo);
+ options.set(options::PipelineConfigFile,
+ cameraConfigData->pipelineConfigFile);
+ camera_->setOptions(&options);
+ }
+
/*
* Initialize orientation and facing side of the camera.
*
--
2.35.0.263.gb82422642f-goog
More information about the libcamera-devel
mailing list