[libcamera-devel] [RFC PATCH 2/4] libcamera: lens: Grab the static properties at init time
Jean-Michel Hautbois
jeanmichel.hautbois at ideasonboard.com
Thu Jun 9 08:03:04 CEST 2022
When the CameraLens is created in the pipeline handler, it will offer
various functions to access the lens properties. Add a call to get the
static properties at init time.
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>
---
include/libcamera/internal/camera_lens.h | 4 ++++
src/libcamera/camera_lens.cpp | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/libcamera/internal/camera_lens.h b/include/libcamera/internal/camera_lens.h
index 277417da..523a1481 100644
--- a/include/libcamera/internal/camera_lens.h
+++ b/include/libcamera/internal/camera_lens.h
@@ -19,6 +19,8 @@ namespace libcamera {
class MediaEntity;
class V4L2Subdevice;
+struct CameraLensProperties;
+
class CameraLens : protected Loggable
{
public:
@@ -44,6 +46,8 @@ private:
std::unique_ptr<V4L2Subdevice> subdev_;
std::string model_;
+
+ const CameraLensProperties *staticProps_;
};
} /* namespace libcamera */
diff --git a/src/libcamera/camera_lens.cpp b/src/libcamera/camera_lens.cpp
index b3d48199..d4d44bc7 100644
--- a/src/libcamera/camera_lens.cpp
+++ b/src/libcamera/camera_lens.cpp
@@ -9,6 +9,7 @@
#include <libcamera/base/utils.h>
+#include "libcamera/internal/camera_lens_properties.h"
#include "libcamera/internal/v4l2_subdevice.h"
/**
@@ -36,7 +37,7 @@ LOG_DEFINE_CATEGORY(CameraLens)
* Once constructed the instance must be initialized with init().
*/
CameraLens::CameraLens(const MediaEntity *entity)
- : entity_(entity)
+ : entity_(entity), staticProps_(nullptr)
{
}
@@ -73,6 +74,8 @@ int CameraLens::init()
return ret;
model_ = subdev_->model();
+ staticProps_ = CameraLensProperties::get(model_);
+
return 0;
}
--
2.34.1
More information about the libcamera-devel
mailing list