libcamera
v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
|
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... | |
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.
libcamera::DeviceMatch::DeviceMatch | ( | const std::string & | driver | ) |
Construct a media device search pattern.
[in] | driver | The Linux device driver name that created the media device |
void libcamera::DeviceMatch::add | ( | const std::string & | entity | ) |
Add a media entity name to the search pattern.
[in] | entity | The name of the entity in the media graph |
bool libcamera::DeviceMatch::match | ( | const MediaDevice * | device | ) | const |
Compare a search pattern with a media device.
[in] | device | The 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.