Loading...
Searching...
No Matches
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.
void | add (const std::string &entity)
| Add a media entity name to the search pattern.
void | add (std::regex entity)
| Add a regex to match a media entity name to the search pattern.
bool | match (const MediaDevice *device) const
| Compare a search pattern with a media device.
void | clear ()
| Clear the entities search pattern vector.

## 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 (or regular expressions designed to match an entity name) 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] | driver | The Linux device driver name that created the media device

## Member Function Documentation

## add() [1/2]

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

Add a media entity name to the search pattern.

Parameters

  [in] | entity | The name of the entity in the media graph

## add() [2/2]

void libcamera::DeviceMatch::add | ( | std::regex | entity | ) |

Add a regex to match a media entity name to the search pattern.

Parameters

  [in] | entity | The regex intended to match to an entity in the media graph

## match()

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

Compare a search pattern with a media device.

Parameters

  [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.

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

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

- include/libcamera/internal/device_enumerator.h
- src/libcamera/device_enumerator.cpp