{"id":230,"url":"https://patchwork.libcamera.org/api/patches/230/?format=json","web_url":"https://patchwork.libcamera.org/patch/230/","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":"<20190115140749.8297-4-jacopo@jmondi.org>","date":"2019-01-15T14:07:48","name":"[libcamera-devel,3/4] libcamera: media_object: Add functions to entities","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"dc2d204be15e300078e7949e3b9f85befe99683e","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/230/mbox/","series":[{"id":80,"url":"https://patchwork.libcamera.org/api/series/80/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=80","date":"2019-01-15T14:07:45","name":"libcamera: IPU3: Add pipeline handler","version":1,"mbox":"https://patchwork.libcamera.org/series/80/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/230/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/230/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AC21460C89\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 15:07:48 +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 relay12.mail.gandi.net (Postfix) with ESMTPSA id 4AEB1200013;\n\tTue, 15 Jan 2019 14:07:48 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 15 Jan 2019 15:07:48 +0100","Message-Id":"<20190115140749.8297-4-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190115140749.8297-1-jacopo@jmondi.org>","References":"<20190115140749.8297-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 3/4] 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":"Tue, 15 Jan 2019 14:07:48 -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 and remove a stale TODO entry.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/media_object.h |  2 ++\n src/libcamera/media_object.cpp       | 18 +++++++++++++-----\n 2 files changed, 15 insertions(+), 5 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..c47fb53 100644\n--- a/src/libcamera/media_object.cpp\n+++ b/src/libcamera/media_object.cpp\n@@ -243,10 +243,8 @@ void MediaPad::addLink(MediaLink *link)\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+ * name() unique in the media device context, a function() and its associated\n+ * devnode, if any.\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 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 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","3/4"]}