[libcamera-devel,RESEND,v2,3/4] libcamera: media device: Add MediaDeviceDesc

Message ID 20181228075743.28637-4-jacopo@jmondi.org
State Rejected
Headers show
Series
  • Add MediaDevice and associated MediaObject
Related show

Commit Message

Jacopo Mondi Dec. 28, 2018, 7:57 a.m. UTC
Add the MediaDeviceDesc class which represents the description of a
media graph and the entities it contains.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/include/media_device.h | 42 ++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

--
2.20.1

Patch

diff --git a/src/libcamera/include/media_device.h b/src/libcamera/include/media_device.h
index 642eea9..e1b26e2 100644
--- a/src/libcamera/include/media_device.h
+++ b/src/libcamera/include/media_device.h
@@ -19,6 +19,48 @@ 

 namespace libcamera {

+/**
+ * \class MediaDeviceDesc
+ * \brief Collects the representation of a media device
+ *
+ * The MediaDeviceDesc class allows components of the library to create
+ * a description of a media device, specifying a driver name and a list of
+ * entity names contained in it.
+ */
+class MediaDeviceDesc
+{
+public:
+	/**
+	 * \brief Construct a representation of a media device handled
+	 *	  by driver \a driver's name
+	 * \param driver The name of the driver that controls the media graph
+	 *	  as returned by MEDIA_IOC_DEVICE_INFO
+	 */
+	MediaDeviceDesc(const std::string &driver) : driver_(driver) { }
+
+	/**
+	 * \brief Add an entity name to the list of entities handled in the
+	 *	  media graph.
+	 * \param entity The name of the entity to add
+	 */
+	void addEntity(const std::string entity) { entities_.push_back(entity); }
+
+	/**
+	 * \brief Return the name of the driver that controls the media graph
+	 *	  as returned by MEDIA_IOC_DEVICE_INFO
+	 */
+	const std::string driver() { return driver_; }
+
+	/**
+	 * \brief Return the list of entities names
+	 */
+	std::vector<std::string> &entities() { return entities_; }
+
+private:
+	std::string driver_;
+	std::vector<std::string> entities_;
+};
+
 class MediaDevice
 {
 public: