@@ -7,8 +7,10 @@
#pragma once
+#include <initializer_list>
#include <memory>
#include <string>
+#include <string_view>
#include <vector>
#include <libcamera/base/signal.h>
@@ -20,7 +22,8 @@ class MediaDevice;
class DeviceMatch
{
public:
- DeviceMatch(const std::string &driver);
+ DeviceMatch(const std::string &driver,
+ std::initializer_list<std::string_view> entities = {});
void add(const std::string &entity);
@@ -66,9 +66,12 @@ LOG_DEFINE_CATEGORY(DeviceEnumerator)
/**
* \brief Construct a media device search pattern
* \param[in] driver The Linux device driver name that created the media device
+ * \param[in] entities The list of media graph entity names to search
*/
-DeviceMatch::DeviceMatch(const std::string &driver)
- : driver_(driver)
+DeviceMatch::DeviceMatch(const std::string &driver,
+ std::initializer_list<std::string_view> entities)
+ : driver_(driver),
+ entities_(entities.begin(), entities.end())
{
}
Make it possible to pass a list of entity names to the `DeviceMatch` constructor, thereby simplifying the construction if there is a known set of entity names by avoiding the repeated `add()` calls. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- include/libcamera/internal/device_enumerator.h | 5 ++++- src/libcamera/device_enumerator.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-)