summaryrefslogtreecommitdiff
path: root/src/libcamera/media_object.cpp
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-01-14 15:19:19 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-01-21 11:35:30 +0100
commitec53057f0af858a0fbfbb6ceeb3cf83b5921858f (patch)
tree7e5973e803cb78e43546add8915f59af4167e291 /src/libcamera/media_object.cpp
parent21ff749a790386f87e767a690c77948a6474ceaa (diff)
libcamera: media_object: Add functions to entities
Media entities convey information about their main function in the 'function' field of 'struct media_v2_entity'. Store the main function in the MediaEntity function_ class member and provide a getter function for that. While at there update comments, keep the MediaPad description in sync with the MediaEntity one and remove a stale TODO entry. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/media_object.cpp')
-rw-r--r--src/libcamera/media_object.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp
index cb3af85e..530db71d 100644
--- a/src/libcamera/media_object.cpp
+++ b/src/libcamera/media_object.cpp
@@ -166,7 +166,7 @@ MediaLink::MediaLink(const struct media_v2_link *link, MediaPad *source,
* Pads are created from the information provided by the Media Controller API
* in the media_v2_pad structure. They reference the entity() they belong to.
*
- * In addition to its graph id, every media graph pad is identified by an index
+ * In addition to their graph id, media graph pads are identified by an index
* unique in the context of the entity the pad belongs to.
*
* A pad can be either a 'source' pad or a 'sink' pad. This information is
@@ -242,11 +242,9 @@ void MediaPad::addLink(MediaLink *link)
* Entities are created from the information provided by the Media Controller
* API in the media_v2_entity structure. They reference the pads() they contain.
*
- * In addition to its graph id, every media graph entity is identified by a
- * name() unique in the media device context.
- *
- * \todo Add support for associating a devnode to the entity when integrating
- * with DeviceEnumerator.
+ * In addition to their graph id, media graph entities are identified by a
+ * name() unique in the media device context. They implement a function() and
+ * may expose a devnode().
*/
/**
@@ -256,6 +254,16 @@ void MediaPad::addLink(MediaLink *link)
*/
/**
+ * \fn MediaEntity::function()
+ * \brief Retrieve the entity's main function
+ *
+ * Media entity functions are expressed using the MEDIA_ENT_F_* macros
+ * defined by the Media Controller API.
+ *
+ * \return The entity's function
+ */
+
+/**
* \fn MediaEntity::deviceMajor()
* \brief Retrieve the major number of the interface associated with the entity
* \return The interface major number, or 0 if the entity isn't associated with
@@ -336,7 +344,7 @@ MediaEntity::MediaEntity(MediaDevice *dev,
const struct media_v2_entity *entity,
unsigned int major, unsigned int minor)
: MediaObject(dev, entity->id), name_(entity->name),
- major_(major), minor_(minor)
+ function_(entity->function), major_(major), minor_(minor)
{
}