From patchwork Thu Jun 9 06:03:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 16185 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9D72DC3273 for ; Thu, 9 Jun 2022 06:03:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CB89665633; Thu, 9 Jun 2022 08:03:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654754596; bh=bcIxAAPp7QmJAWe6+zbVDqLDqlh/ZUg0ciwkrLulElo=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jc0F4bHFzjtvuIOy3xZK8w90Lqjf1oYkCMbanIS5kqHML+8tOuFzwNlQ35EP47u9o T6e/AKVWTW4812M3mDgy3QOygg2UBlOf0C5l12Q9+PpBFOeYtTJmL+j2UYje3EefPb yleMNuh1n/L7N2V2kBS5BvYUlSz3nbwnRZla925/zZWMNx7TbRZJqxwyjMcbl8fB63 /4qRkVP7+xBkO5MijAffRNIOWC/ffcaWUmUOZSmyll2srW0f3rBlPmvDuYEuyaRwPK tBE01WPbCg2BOmHhNjQZKGntdX4k8NFWjLjYX+nlezndhl27nAmiiQ8MBxS6AItNY6 FWi1yt4NfTORA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8979465634 for ; Thu, 9 Jun 2022 08:03:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uex5CD1V"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:ae94:9dc3:50ea:aee6]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 39A2580A; Thu, 9 Jun 2022 08:03:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1654754593; bh=bcIxAAPp7QmJAWe6+zbVDqLDqlh/ZUg0ciwkrLulElo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uex5CD1VLy3hAB+O9EiBO+FU/lf4PVBqT5QgSJBxUR5C41wfYchQty3JjKlHV+9hE 2Ts+RWjytGrt1kGg2ZpvMlZxoKSQ4hZazUHQz4nyrkELHj0o0E4eiNTOpqPP6Re9e6 eJLqzQmJlNaYAvkNy9tpcqHl/Oai+Epf1ccqV+d0= To: libcamera-devel@lists.libcamera.org Date: Thu, 9 Jun 2022 08:03:04 +0200 Message-Id: <20220609060306.57953-3-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609060306.57953-1-jeanmichel.hautbois@ideasonboard.com> References: <20220609060306.57953-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 2/4] libcamera: lens: Grab the static properties at init time X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- 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 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 +#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; }