diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2018-12-21 15:52:14 +0100 |
---|---|---|
committer | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2018-12-31 00:58:06 +0100 |
commit | 0eab433d057ba5ed0feffe89c9f5b67f3557fb41 (patch) | |
tree | 8b898a5ea3354162baaed6d254162b99984694f8 /src/libcamera/include/device_enumerator.h | |
parent | 723a6356c80fbcd6603ec38dfa6b32cab248822d (diff) |
libcamera: device_enumerator: add DeviceInfo class
Provide a DeviceInfo class which holds all information from the initial
enumeration of a media device. Not all information available at a media
device is stored, only the information needed for a pipeline handler to
find a specific device.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/include/device_enumerator.h')
-rw-r--r-- | src/libcamera/include/device_enumerator.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/libcamera/include/device_enumerator.h b/src/libcamera/include/device_enumerator.h new file mode 100644 index 00000000..ac40bafc --- /dev/null +++ b/src/libcamera/include/device_enumerator.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2018, Google Inc. + * + * device_enumerator.h - API to enumerate and find media devices + */ +#ifndef __LIBCAMERA_DEVICE_ENUMERATOR_H__ +#define __LIBCAMERA_DEVICE_ENUMERATOR_H__ + +#include <map> +#include <string> +#include <vector> + +#include <linux/media.h> + +namespace libcamera { + +class DeviceInfo +{ +public: + DeviceInfo(const std::string &devnode, const struct media_device_info &info, + const std::map<std::string, std::string> &entities); + + int acquire(); + void release(); + bool busy() const; + + const std::string &devnode() const; + const struct media_device_info &info() const; + std::vector<std::string> entities() const; + + int lookup(const std::string &name, std::string &devnode) const; + +private: + bool acquired_; + + std::string devnode_; + struct media_device_info info_; + std::map<std::string, std::string> entities_; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_DEVICE_ENUMERATOR_H__ */ |