[PATCH v1 1/1] libcamera: camera_manager: Add environment variable to order pipelines match
Julien Vuillaumier
julien.vuillaumier at nxp.com
Wed Mar 6 19:04:26 CET 2024
Hi Barnabás,
On 05/03/2024 17:42, Barnabás Pőcze wrote:
> Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button
>
>
> Hi
>
>
> 2024. március 4., hétfő 19:18 keltezéssel, Julien Vuillaumier <julien.vuillaumier at nxp.com> írta:
>
>> To match the enumerated media devices, each pipeline handler registered
>> is used in no specific order. It is a limitation when several pipelines
>> can match the devices, and user has to select a specific pipeline.
>>
>> For this purpose, environment variable LIBCAMERA_PIPELINES_MATCH_LIST is
>> created that gives the option to define an ordered list of pipelines
>> to invoke during the match process.
>>
>> LIBCAMERA_PIPELINES_MATCH_LIST="<name1>[,<name2>[,<name3>...]]]"
>>
>> Example:
>> LIBCAMERA_PIPELINES_MATCH_LIST="PipelineHandlerRkISP1,SimplePipelineHandler"
>>
>> Signed-off-by: Julien Vuillaumier <julien.vuillaumier at nxp.com>
>> ---
>> [...]
>> +
>> + /*
>> + * When a list of preferred pipelines is defined, iterate through the
>> + * ordered list to match the devices enumerated.
>> + * Otherwise, devices matching is done in no specific order with each
>> + * pipeline handler registered.
>> + */
>> + const char *pipesLists =
>> + utils::secure_getenv("LIBCAMERA_PIPELINES_MATCH_LIST");
>> + if (pipesLists) {
>> + for (const auto &pipeName : utils::split(pipesLists, ",")) {
>> + if (pipeName.empty())
>> + continue;
>> +
>> + auto nameMatch = [pipeName](const PipelineHandlerFactoryBase *f) {
>
> `[&pipeName]` to avoid the copy.
I will update in v2 - thanks
>
>> + return (f->name() == pipeName);
>> + };
>> +
>> + auto iter = std::find_if(factories.begin(),
>> + factories.end(),
>> + nameMatch);
>> +
>> + if (iter != factories.end()) {
>> + LOG(Camera, Debug)
>> + << "Found pipeline handler from list '"
>> + << (*iter)->name() << "'";
>> + pipeMatch(*iter);
>> + }
>> + }
>> + return;
>> + }
>> +
>> + for (const PipelineHandlerFactoryBase *factory : factories) {
>> + LOG(Camera, Debug)
>> + << "Found registered pipeline handler '"
>> + << factory->name() << "'";
>> + /*
>> + * Try each pipeline handler until it exhausts
>> + * all pipelines it can provide.
>> + */
>> + pipeMatch(factory);
>> }
>> }
>>
>> --
>> 2.34.1
>>
>
>
> Regards,
> Barnabás Pőcze
More information about the libcamera-devel
mailing list