summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/internal/camera_sensor.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index d18115bb..ccdb3a9b 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -78,11 +78,13 @@ public:
class CameraSensorFactoryBase
{
public:
- CameraSensorFactoryBase();
+ CameraSensorFactoryBase(int priority);
virtual ~CameraSensorFactoryBase() = default;
static std::unique_ptr<CameraSensor> create(MediaEntity *entity);
+ int priority() const { return priority_; }
+
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(CameraSensorFactoryBase)
@@ -92,14 +94,16 @@ private:
virtual std::variant<std::unique_ptr<CameraSensor>, int>
match(MediaEntity *entity) const = 0;
+
+ int priority_;
};
template<typename _CameraSensor>
class CameraSensorFactory final : public CameraSensorFactoryBase
{
public:
- CameraSensorFactory()
- : CameraSensorFactoryBase()
+ CameraSensorFactory(int priority)
+ : CameraSensorFactoryBase(priority)
{
}
@@ -111,7 +115,7 @@ private:
}
};
-#define REGISTER_CAMERA_SENSOR(sensor) \
-static CameraSensorFactory<sensor> global_##sensor##Factory{};
+#define REGISTER_CAMERA_SENSOR(sensor, priority) \
+static CameraSensorFactory<sensor> global_##sensor##Factory{ priority };
} /* namespace libcamera */