{"id":802,"url":"https://patchwork.libcamera.org/api/1.1/patches/802/?format=json","web_url":"https://patchwork.libcamera.org/patch/802/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20190326083902.26121-8-jacopo@jmondi.org>","date":"2019-03-26T08:38:50","name":"[libcamera-devel,v5,07/19] libcamera: v4l2_subdevice: Create device from entity name","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"61f090a99a55a352389e6286b74be0e746fbe01c","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/802/mbox/","series":[{"id":219,"url":"https://patchwork.libcamera.org/api/1.1/series/219/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=219","date":"2019-03-26T08:38:43","name":"libcamera: ipu3: Add ImgU support","version":5,"mbox":"https://patchwork.libcamera.org/series/219/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/802/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/802/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay10.mail.gandi.net (relay10.mail.gandi.net\n\t[217.70.178.230])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BE49961111\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Mar 2019 09:38:34 +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 relay10.mail.gandi.net (Postfix) with ESMTPSA id 392A024000A;\n\tTue, 26 Mar 2019 08:38:34 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Mar 2019 09:38:50 +0100","Message-Id":"<20190326083902.26121-8-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.21.0","In-Reply-To":"<20190326083902.26121-1-jacopo@jmondi.org>","References":"<20190326083902.26121-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 07/19] libcamera: v4l2_subdevice:\n\tCreate device from entity name","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, 26 Mar 2019 08:38:35 -0000"},"content":"Add a static method to V4L2Subdevice class to create a V4L2Subdevice\ninstance from a media entity name.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_subdevice.h |  5 +++++\n src/libcamera/v4l2_subdevice.cpp       | 22 ++++++++++++++++++++++\n 2 files changed, 27 insertions(+)","diff":"diff --git a/src/libcamera/include/v4l2_subdevice.h b/src/libcamera/include/v4l2_subdevice.h\nindex f42cccabda94..0067109931d1 100644\n--- a/src/libcamera/include/v4l2_subdevice.h\n+++ b/src/libcamera/include/v4l2_subdevice.h\n@@ -18,6 +18,8 @@\n \n namespace libcamera {\n \n+class MediaDevice;\n+\n struct V4L2SubdeviceFormat {\n \tuint32_t mbus_code;\n \tuint32_t width;\n@@ -29,6 +31,9 @@ struct V4L2SubdeviceFormat {\n class V4L2Subdevice : protected Loggable\n {\n public:\n+\tstatic V4L2Subdevice *fromEntityName(const MediaDevice *media,\n+\t\t\t\t\t     const std::string &name);\n+\n \texplicit V4L2Subdevice(const MediaEntity *entity);\n \tV4L2Subdevice(const V4L2Subdevice &) = delete;\n \tV4L2Subdevice &operator=(const V4L2Subdevice &) = delete;\ndiff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp\nindex 10925f9fe497..e28857c9aeb1 100644\n--- a/src/libcamera/v4l2_subdevice.cpp\n+++ b/src/libcamera/v4l2_subdevice.cpp\n@@ -16,6 +16,7 @@\n \n #include \"geometry.h\"\n #include \"log.h\"\n+#include \"media_device.h\"\n #include \"media_object.h\"\n #include \"v4l2_subdevice.h\"\n \n@@ -101,6 +102,27 @@ const std::string V4L2SubdeviceFormat::toString() const\n  * any device left open will be closed, and any resources released.\n  */\n \n+/**\n+ * \\brief Create a new video subdevice instance from entity with \\a name in\n+ * media device \\a media\n+ * \\param[in] media The media device where the entity is registered\n+ * \\param[in] name The media entity name\n+ *\n+ * Releasing memory of the newly created instance is responsibility of the\n+ * caller of this function.\n+ *\n+ * \\return A newly created V4L2Subdevice on success, nullptr otherwise\n+ */\n+V4L2Subdevice *V4L2Subdevice::fromEntityName(const MediaDevice *media,\n+\t\t\t\t\t     const std::string &name)\n+{\n+\tMediaEntity *entity = media->getEntityByName(name);\n+\tif (!entity)\n+\t\treturn nullptr;\n+\n+\treturn new V4L2Subdevice(entity);\n+}\n+\n /**\n  * \\brief Create a V4L2 subdevice from a MediaEntity using its device node\n  * path\n","prefixes":["libcamera-devel","v5","07/19"]}