[libcamera-devel,RFC,2/4] libcamera: lens: Grab the static properties at init time
diff mbox series

Message ID 20220609060306.57953-3-jeanmichel.hautbois@ideasonboard.com
State New
Headers show
Series
  • Introduce camera lens properties
Related show

Commit Message

Jean-Michel Hautbois June 9, 2022, 6:03 a.m. UTC
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@ideasonboard.com>
---
 include/libcamera/internal/camera_lens.h | 4 ++++
 src/libcamera/camera_lens.cpp            | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

Patch
diff mbox series

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;
 }