From effe4d6ced881486ef1d17448c7a53aa36ef41eb Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Sun, 22 Dec 2019 02:31:56 -0600 Subject: libcamera: camera_manager, pipeline_handler: allow retrieving cameras by device numbers The V4L2 compatibility layer will need a way to map device numbers to libcamera Camera instances. Expose a method in the camera manager to retrieve Camera instances by devnum. The mapping from device numbers to Camera instances is optionally declared by pipeline handlers when they register cameras with the camera manager. Signed-off-by: Paul Elder Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- include/libcamera/camera_manager.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/libcamera/camera_manager.h') diff --git a/include/libcamera/camera_manager.h b/include/libcamera/camera_manager.h index 8331898c..09419766 100644 --- a/include/libcamera/camera_manager.h +++ b/include/libcamera/camera_manager.h @@ -7,8 +7,10 @@ #ifndef __LIBCAMERA_CAMERA_MANAGER_H__ #define __LIBCAMERA_CAMERA_MANAGER_H__ +#include #include #include +#include #include #include @@ -33,8 +35,9 @@ public: const std::vector> &cameras() const { return cameras_; } std::shared_ptr get(const std::string &name); + std::shared_ptr get(dev_t devnum); - void addCamera(std::shared_ptr camera); + void addCamera(std::shared_ptr camera, dev_t devnum); void removeCamera(Camera *camera); static const std::string &version() { return version_; } @@ -46,6 +49,7 @@ private: std::unique_ptr enumerator_; std::vector> pipes_; std::vector> cameras_; + std::map> camerasByDevnum_; static const std::string version_; static CameraManager *self_; -- cgit v1.2.1