diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2019-12-22 02:31:56 -0600 |
---|---|---|
committer | Paul Elder <paul.elder@ideasonboard.com> | 2020-01-03 19:53:14 -0500 |
commit | effe4d6ced881486ef1d17448c7a53aa36ef41eb (patch) | |
tree | 8396311e1587ae93842f68baced2ecbe72ec6aec /include | |
parent | 58a19b9d56e5002367794ef0d2e9cf8dcd8d0be5 (diff) |
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 <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/camera_manager.h | 6 |
1 files changed, 5 insertions, 1 deletions
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 <map> #include <memory> #include <string> +#include <sys/types.h> #include <vector> #include <libcamera/object.h> @@ -33,8 +35,9 @@ public: const std::vector<std::shared_ptr<Camera>> &cameras() const { return cameras_; } std::shared_ptr<Camera> get(const std::string &name); + std::shared_ptr<Camera> get(dev_t devnum); - void addCamera(std::shared_ptr<Camera> camera); + void addCamera(std::shared_ptr<Camera> camera, dev_t devnum); void removeCamera(Camera *camera); static const std::string &version() { return version_; } @@ -46,6 +49,7 @@ private: std::unique_ptr<DeviceEnumerator> enumerator_; std::vector<std::shared_ptr<PipelineHandler>> pipes_; std::vector<std::shared_ptr<Camera>> cameras_; + std::map<dev_t, std::weak_ptr<Camera>> camerasByDevnum_; static const std::string version_; static CameraManager *self_; |