|
libcamera v0.7.1
Supporting cameras in Linux since 2019
|
Support for global libcamera configuration. More...
Public Member Functions | |
| GlobalConfiguration () | |
| Initialize the global configuration. | |
| unsigned int | version () const |
| Retrieve the configuration version. | |
| const ValueNode & | configuration () const |
| Retrieve the libcamera global configuration. | |
| template<typename T> | |
| std::optional< T > | option (const std::initializer_list< std::string_view > confPath) const |
| Retrieve the value of configuration option confPath. | |
| std::optional< std::vector< std::string > > | listOption (const std::initializer_list< std::string_view > confPath) const |
| Retrieve the value of configuration option confPath. | |
Support for global libcamera configuration.
The configuration file is a YAML file and the configuration itself is stored under a configuration top-level item.
The configuration file is looked up in the user's home directory first and, if it is not found, then in system-wide configuration directories. If multiple configuration files exist then only the first one found is used and no configuration merging is performed.
If the first found configuration file cannot be opened or parsed, an error is reported and no configuration file is used. This is to prevent libcamera from using an unintended configuration file.
The configuration can be accessed using the provided helpers, namely option() and listOption() to access individual options, or configuration() to access the whole configuration.
| const ValueNode & libcamera::GlobalConfiguration::configuration | ( | ) | const |
Retrieve the libcamera global configuration.
This returns the whole configuration stored in the top-level section configuration of the YAML configuration file.
The requested part of the configuration can be accessed using ValueNode methods.
| std::optional< std::vector< std::string > > libcamera::GlobalConfiguration::listOption | ( | const std::initializer_list< std::string_view > | confPath | ) | const |
Retrieve the value of configuration option confPath.
| [in] | confPath | Sequence of the YAML section names (excluding configuration) leading to the requested list option, separated by dots |
|
inline |
Retrieve the value of configuration option confPath.
| T | The type of the retrieved configuration value |
| [in] | confPath | Sequence of the YAML section names (excluding configuration) leading to the requested option |
| unsigned int libcamera::GlobalConfiguration::version | ( | ) | const |
Retrieve the configuration version.
The version is declared in the configuration file in the top-level version element, alongside configuration. This has currently no real use but may be needed in future if configuration incompatibilities occur.