summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-08-07 10:13:16 +0200
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-08-07 10:13:16 +0200
commit2f3565efb5377768e3c2e1ef85eec99668f485de (patch)
tree3813d2d3ed6d4a59e912894dccee8e9a179c5c84 /include
parent07a1ac5f01caf27aa309e4e743961123d3609291 (diff)
libcamera: Define and use MediaDeviceMatch
The xistingdevice search and match criteria implemented by libcamera only supports 'media device' based cameras, which are supported in the Linux kernel by the usage of the V4L2/MC API. Define a MediaDeviceMatch class derived from DeviceMatch and use it wherever DeviceMatch was used in order to later introduce new derived classes to support searching and matching devices of a different type. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/device_enumerator.h2
-rw-r--r--include/libcamera/internal/device_match.h9
-rw-r--r--include/libcamera/internal/pipeline_handler.h4
3 files changed, 10 insertions, 5 deletions
diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h
index 259a9e46..2afb9fa0 100644
--- a/include/libcamera/internal/device_enumerator.h
+++ b/include/libcamera/internal/device_enumerator.h
@@ -29,7 +29,7 @@ public:
virtual int init() = 0;
virtual int enumerate() = 0;
- std::shared_ptr<MediaDevice> search(const DeviceMatch &dm);
+ std::shared_ptr<MediaDevice> search(const MediaDeviceMatch &dm);
Signal<> devicesAdded;
diff --git a/include/libcamera/internal/device_match.h b/include/libcamera/internal/device_match.h
index 9f190f0c..6df7dece 100644
--- a/include/libcamera/internal/device_match.h
+++ b/include/libcamera/internal/device_match.h
@@ -17,11 +17,16 @@ class MediaDevice;
class DeviceMatch
{
public:
- DeviceMatch(const std::string &driver);
+ virtual bool match(const MediaDevice *device) const = 0;
+};
+class MediaDeviceMatch : public DeviceMatch
+{
+public:
void add(const std::string &entity);
+ MediaDeviceMatch(const std::string &driver);
- bool match(const MediaDevice *device) const;
+ bool match(const MediaDevice *device) const override;
private:
std::string driver_;
diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
index c96944f4..02b2f337 100644
--- a/include/libcamera/internal/pipeline_handler.h
+++ b/include/libcamera/internal/pipeline_handler.h
@@ -28,7 +28,7 @@ class Camera;
class CameraConfiguration;
class CameraManager;
class DeviceEnumerator;
-class DeviceMatch;
+class MediaDeviceMatch;
class FrameBuffer;
class MediaDevice;
class PipelineHandler;
@@ -43,7 +43,7 @@ public:
virtual bool match(DeviceEnumerator *enumerator) = 0;
MediaDevice *acquireMediaDevice(DeviceEnumerator *enumerator,
- const DeviceMatch &dm);
+ const MediaDeviceMatch &dm);
bool acquire();
void release(Camera *camera);