{"id":251,"url":"https://patchwork.libcamera.org/api/patches/251/?format=json","web_url":"https://patchwork.libcamera.org/patch/251/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190116135949.2097-3-jacopo@jmondi.org>","date":"2019-01-16T13:59:46","name":"[libcamera-devel,v2,2/5] libcamera: media_object: Add functions to entities","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"4794b855add2865e03cfc8494d23dd4a73497890","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/251/mbox/","series":[{"id":85,"url":"https://patchwork.libcamera.org/api/series/85/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=85","date":"2019-01-16T13:59:44","name":"libcamera: pipeline: Add Intel IPU3 pipeline handler","version":2,"mbox":"https://patchwork.libcamera.org/series/85/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/251/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/251/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 41EE860C98\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Jan 2019 14:59:50 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 697D8C0011;\n\tWed, 16 Jan 2019 13:59:49 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 16 Jan 2019 14:59:46 +0100","Message-Id":"<20190116135949.2097-3-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190116135949.2097-1-jacopo@jmondi.org>","References":"<20190116135949.2097-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 2/5] libcamera: media_object: Add\n\tfunctions to entities","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 16 Jan 2019 13:59:51 -0000"},"content":"Media entities convey information about their main function in the\n'function' field of 'struct media_v2_entity'.\n\nStore the main function in the MediaEntity function_ class member and provide\na getter function for that.\n\nWhile at there update comments, keep the MediaPad description in sync\nwith the MediaEntity one and remove a stale TODO entry.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/media_object.h |  2 ++\n src/libcamera/media_object.cpp       | 22 +++++++++++++++-------\n 2 files changed, 17 insertions(+), 7 deletions(-)","diff":"diff --git a/src/libcamera/include/media_object.h b/src/libcamera/include/media_object.h\nindex 7fc4441..a10f7e1 100644\n--- a/src/libcamera/include/media_object.h\n+++ b/src/libcamera/include/media_object.h\n@@ -84,6 +84,7 @@ class MediaEntity : public MediaObject\n {\n public:\n \tconst std::string &name() const { return name_; }\n+\tunsigned int function() const { return function_; }\n \tunsigned int deviceMajor() const { return major_; }\n \tunsigned int deviceMinor() const { return minor_; }\n \n@@ -103,6 +104,7 @@ private:\n \t~MediaEntity();\n \n \tstd::string name_;\n+\tunsigned int function_;\n \tstd::string devnode_;\n \tunsigned int major_;\n \tunsigned int minor_;\ndiff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp\nindex cb3af85..76dd326 100644\n--- a/src/libcamera/media_object.cpp\n+++ b/src/libcamera/media_object.cpp\n@@ -166,7 +166,7 @@ MediaLink::MediaLink(const struct media_v2_link *link, MediaPad *source,\n  * Pads are created from the information provided by the Media Controller API\n  * in the media_v2_pad structure. They reference the entity() they belong to.\n  *\n- * In addition to its graph id, every media graph pad is identified by an index\n+ * In addition to its graph id, media graph pads are identified by an index\n  * unique in the context of the entity the pad belongs to.\n  *\n  * A pad can be either a 'source' pad or a 'sink' pad. This information is\n@@ -242,11 +242,9 @@ void MediaPad::addLink(MediaLink *link)\n  * Entities are created from the information provided by the Media Controller\n  * API in the media_v2_entity structure. They reference the pads() they contain.\n  *\n- * In addition to its graph id, every media graph entity is identified by a\n- * name() unique in the media device context.\n- *\n- * \\todo Add support for associating a devnode to the entity when integrating\n- * with DeviceEnumerator.\n+ * In addition to its graph id, media graph entities are identified by a\n+ * name() unique in the media device context. They implement a function() and\n+ * may expose a devnode().\n  */\n \n /**\n@@ -255,6 +253,16 @@ void MediaPad::addLink(MediaLink *link)\n  * \\return The entity name\n  */\n \n+/**\n+ * \\fn MediaEntity::function()\n+ * \\brief Retrieve the entity's main function\n+ *\n+ * Media entity functions are expressed using the MEDIA_ENT_F_* macros\n+ * defined by the Media Controller API.\n+ *\n+ * \\return The entity's function\n+ */\n+\n /**\n  * \\fn MediaEntity::deviceMajor()\n  * \\brief Retrieve the major number of the interface associated with the entity\n@@ -336,7 +344,7 @@ MediaEntity::MediaEntity(MediaDevice *dev,\n \t\t\t const struct media_v2_entity *entity,\n \t\t\t unsigned int major, unsigned int minor)\n \t: MediaObject(dev, entity->id), name_(entity->name),\n-\t  major_(major), minor_(minor)\n+\t  function_(entity->function), major_(major), minor_(minor)\n {\n }\n \n","prefixes":["libcamera-devel","v2","2/5"]}