libcamera  v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
Public Member Functions | List of all members
libcamera::DeviceMatch Class Reference

Description of a media device search pattern. More...

Public Member Functions

 DeviceMatch (const std::string &driver)
 Construct a media device search pattern. More...
 
void add (const std::string &entity)
 Add a media entity name to the search pattern. More...
 
bool match (const MediaDevice *device) const
 Compare a search pattern with a media device. More...
 

Detailed Description

Description of a media device search pattern.

The DeviceMatch class describes a media device using properties from the Media Controller struct media_device_info, entity names in the media graph or other properties that can be used to identify a media device.

The description is meant to be filled by pipeline managers and passed to a device enumerator to find matching media devices.

A DeviceMatch is created with a specific Linux device driver in mind, therefore the name of the driver is a required property. One or more Entity names can be added as match criteria.

Pipeline handlers are recommended to add entities to DeviceMatch as appropriate to ensure that the media device they need can be uniquely identified. This is useful when the corresponding kernel driver can produce different graphs, for instance as a result of different driver versions or hardware configurations, and not all those graphs are suitable for a pipeline handler.

Constructor & Destructor Documentation

◆ DeviceMatch()

libcamera::DeviceMatch::DeviceMatch ( const std::string &  driver)

Construct a media device search pattern.

Parameters
[in]driverThe Linux device driver name that created the media device

Member Function Documentation

◆ add()

void libcamera::DeviceMatch::add ( const std::string &  entity)

Add a media entity name to the search pattern.

Parameters
[in]entityThe name of the entity in the media graph

◆ match()

bool libcamera::DeviceMatch::match ( const MediaDevice device) const

Compare a search pattern with a media device.

Parameters
[in]deviceThe media device

Matching is performed on the Linux device driver name and entity names from the media graph. A match is found if both the driver name matches and the media device contains all the entities listed in the search pattern.

Returns
true if the media device matches the search pattern, false otherwise

The documentation for this class was generated from the following files: