summaryrefslogtreecommitdiff
path: root/test/gstreamer/meson.build
AgeCommit message (Expand)Author
2021-09-24test: gstreamer: Add a test for gstreamer multi streamVedant Paranjape
2021-09-08test: gstreamer: Factor out code into a base classVedant Paranjape
2021-08-14test: gstreamer: Add test for gstreamer single streamVedant Paranjape
id='n11' href='#n11'>11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2018, Google Inc.
 *
 * device_enumerator.h - API to enumerate and find media devices
 */

#pragma once

#include <memory>
#include <string>
#include <vector>

#include <libcamera/base/signal.h>

namespace libcamera {

class MediaDevice;

class DeviceMatch
{
public:
	DeviceMatch(const std::string &driver);

	void add(const std::string &entity);

	bool match(const MediaDevice *device) const;

private:
	std::string driver_;
	std::vector<std::string> entities_;
};

class DeviceEnumerator
{
public:
	static std::unique_ptr<DeviceEnumerator> create();

	virtual ~DeviceEnumerator();

	virtual int init() = 0;
	virtual int enumerate() = 0;

	std::shared_ptr<MediaDevice> search(const DeviceMatch &dm);

	Signal<> devicesAdded;

protected:
	std::unique_ptr<MediaDevice> createDevice(const std::string &deviceNode);
	void addDevice(std::unique_ptr<MediaDevice> media);
	void removeDevice(const std::string &deviceNode);

private:
	std::vector<std::shared_ptr<MediaDevice>> devices_;
};

} /* namespace libcamera */