From 0ef232b486a9ba2b7f4ef0093bcfed7da50190c7 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 24 Mar 2026 18:52:10 +0200 Subject: [PATCH] libcamera: global_configuration: Drop Option type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GlobalConfiguration::Option type was introduced to decouple the configuration option storage from its users, and make changes to the underlying implementation easier. While the type could indeed be changed to map to a different class, the API would need to remain the same. The Option type therefore brings little value. Drop it. Signed-off-by: Laurent Pinchart Reviewed-by: Barnabás Pőcze Reviewed-by: Isaac Scott --- include/libcamera/internal/global_configuration.h | 4 +--- src/libcamera/global_configuration.cpp | 15 ++------------- src/libcamera/pipeline/simple/simple.cpp | 2 +- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/include/libcamera/internal/global_configuration.h b/include/libcamera/internal/global_configuration.h index 2c0bfadb..5eb646e3 100644 --- a/include/libcamera/internal/global_configuration.h +++ b/include/libcamera/internal/global_configuration.h @@ -22,12 +22,10 @@ namespace libcamera { class GlobalConfiguration { public: - using Option = const ValueNode &; - GlobalConfiguration(); unsigned int version() const; - Option configuration() const; + const ValueNode &configuration() const; template std::optional option( diff --git a/src/libcamera/global_configuration.cpp b/src/libcamera/global_configuration.cpp index 4d154c02..a7056261 100644 --- a/src/libcamera/global_configuration.cpp +++ b/src/libcamera/global_configuration.cpp @@ -55,14 +55,6 @@ LOG_DEFINE_CATEGORY(Configuration) * options, or configuration() to access the whole configuration. */ -/** - * \typedef GlobalConfiguration::Option - * \brief Type representing a configuration option - * - * All code outside GlobalConfiguration must use this type declaration and not - * the underlying type. - */ - /** * \brief Initialize the global configuration */ @@ -153,12 +145,9 @@ unsigned int GlobalConfiguration::version() const * The requested part of the configuration can be accessed using \a ValueNode * methods. * - * \note \a ValueNode type itself shouldn't be used in type declarations to - * avoid trouble if we decide to change the underlying data objects in future. - * - * \return The top-level configuration option + * \return The global configuration */ -GlobalConfiguration::Option GlobalConfiguration::configuration() const +const ValueNode &GlobalConfiguration::configuration() const { return (*configuration_)["configuration"]; } diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 0aa5b1c5..c6fe12d6 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1880,7 +1880,7 @@ bool SimplePipelineHandler::matchDevice(std::shared_ptr media, swIspEnabled_ = info.swIspEnabled; const GlobalConfiguration &configuration = cameraManager()->_d()->configuration(); - for (GlobalConfiguration::Option entry : + for (const ValueNode &entry : configuration.configuration()["pipelines"]["simple"]["supported_devices"] .asList()) { auto name = entry["driver"].get();