@@ -48,7 +48,8 @@ public:
const std::initializer_list<std::string_view> confPath) const;
std::optional<std::vector<std::string>> envListOption(
const char *const envVariable,
- const std::initializer_list<std::string_view> confPath) const;
+ const std::initializer_list<std::string_view> confPath,
+ const std::string delimiter = ":") const;
private:
bool loadFile(const std::filesystem::path &fileName);
@@ -111,14 +111,16 @@ void CameraManager::Private::createPipelineHandlers()
* file and only fallback on environment variable or all handlers, if
* there is no configuration file.
*/
- const char *pipesList =
- utils::secure_getenv("LIBCAMERA_PIPELINES_MATCH_LIST");
- if (pipesList) {
+ const auto pipesList =
+ configuration().envListOption("LIBCAMERA_PIPELINES_MATCH_LIST",
+ { "pipelines_match_list" },
+ ",");
+ if (pipesList.has_value()) {
/*
* When a list of preferred pipelines is defined, iterate
* through the ordered list to match the enumerated devices.
*/
- for (const auto &pipeName : utils::split(pipesList, ",")) {
+ for (const auto &pipeName : pipesList.value()) {
const PipelineHandlerFactoryBase *factory;
factory = PipelineHandlerFactoryBase::getFactoryByName(pipeName);
if (!factory)
@@ -176,6 +176,7 @@ std::optional<std::string> GlobalConfiguration::envOption(
* \brief Return values of the configuration option from a file or environment
* \param[in] envVariable Environment variable to get the value from
* \param[in] confPath The same as in GlobalConfiguration::option
+ * \param[in] delimiter Items separator in the environment variable
*
* This helper looks first at the given environment variable and if it is
* defined (even if it is empty) then it splits its value by semicolons and
@@ -192,11 +193,12 @@ std::optional<std::string> GlobalConfiguration::envOption(
*/
std::optional<std::vector<std::string>> GlobalConfiguration::envListOption(
const char *const envVariable,
- const std::initializer_list<std::string_view> confPath) const
+ const std::initializer_list<std::string_view> confPath,
+ const std::string delimiter) const
{
const char *envValue = utils::secure_getenv(envVariable);
if (envValue) {
- auto items = utils::split(envValue, ":");
+ auto items = utils::split(envValue, delimiter);
return std::vector<std::string>(items.begin(), items.end());
}
return listOption(confPath);
Let's add a configuration file item for the pipelines match list. The configuration snippet: configuration: pipelines_match_list: rkisp1,simple Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- include/libcamera/internal/global_configuration.h | 3 ++- src/libcamera/camera_manager.cpp | 10 ++++++---- src/libcamera/global_configuration.cpp | 6 ++++-- 3 files changed, 12 insertions(+), 7 deletions(-)