{"id":801,"url":"https://patchwork.libcamera.org/api/1.1/patches/801/?format=json","web_url":"https://patchwork.libcamera.org/patch/801/","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-7-jacopo@jmondi.org>","date":"2019-03-26T08:38:49","name":"[libcamera-devel,v5,06/19] libcamera: v4l2_device: Create device from entity name","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"2f6bd07b78a45acb2955540e6f09f267d09ba3b8","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/801/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/801/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/801/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 0FF6961111\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 770CC24000A;\n\tTue, 26 Mar 2019 08:38:33 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Mar 2019 09:38:49 +0100","Message-Id":"<20190326083902.26121-7-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 06/19] libcamera: v4l2_device: Create\n\tdevice 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:34 -0000"},"content":"Add a static method to V4L2Device class to create a V4L2Device instance\nfrom a media entity name.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/libcamera/include/v4l2_device.h |  4 ++++\n src/libcamera/v4l2_device.cpp       | 22 ++++++++++++++++++++++\n 2 files changed, 26 insertions(+)","diff":"diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\nindex 258deee8d461..482d7891dd49 100644\n--- a/src/libcamera/include/v4l2_device.h\n+++ b/src/libcamera/include/v4l2_device.h\n@@ -22,6 +22,7 @@ namespace libcamera {\n class Buffer;\n class BufferPool;\n class EventNotifier;\n+class MediaDevice;\n class MediaEntity;\n \n struct V4L2Capability final : v4l2_capability {\n@@ -107,6 +108,9 @@ public:\n class V4L2Device : protected Loggable\n {\n public:\n+\tstatic V4L2Device *fromEntityName(const MediaDevice *media,\n+\t\t\t\t\t  const std::string &name);\n+\n \texplicit V4L2Device(const std::string &deviceNode);\n \texplicit V4L2Device(const MediaEntity *entity);\n \tV4L2Device(const V4L2Device &) = delete;\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 93d81517fedb..68be5a064258 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -19,6 +19,7 @@\n #include <libcamera/event_notifier.h>\n \n #include \"log.h\"\n+#include \"media_device.h\"\n #include \"media_object.h\"\n #include \"v4l2_device.h\"\n \n@@ -264,6 +265,27 @@ const std::string V4L2DeviceFormat::toString() const\n  * released.\n  */\n \n+/**\n+ * \\brief Create a new video device 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 V4L2Device on success, nullptr otherwise\n+ */\n+V4L2Device *V4L2Device::fromEntityName(const MediaDevice *media,\n+\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 V4L2Device(entity);\n+}\n+\n /**\n  * \\brief Construct a V4L2Device\n  * \\param deviceNode The file-system path to the video device node\n","prefixes":["libcamera-devel","v5","06/19"]}