{"id":13775,"url":"https://patchwork.libcamera.org/api/1.1/patches/13775/?format=json","web_url":"https://patchwork.libcamera.org/patch/13775/","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":"<20210909080902.239533-5-paul.elder@ideasonboard.com>","date":"2021-09-09T08:08:59","name":"[libcamera-devel,v3,4/7] libcamera: v4l2_pixelformat: Add helper function to get the description","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"88a378a24df90a69cb6e13209b06db606651cfdc","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/1.1/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/13775/mbox/","series":[{"id":2502,"url":"https://patchwork.libcamera.org/api/1.1/series/2502/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2502","date":"2021-09-09T08:08:55","name":"v4l2-compat fixes","version":3,"mbox":"https://patchwork.libcamera.org/series/2502/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13775/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13775/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DFCC9BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Sep 2021 08:09:22 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A223169178;\n\tThu,  9 Sep 2021 10:09:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8CEB469177\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Sep 2021 10:09:21 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0307C24F;\n\tThu,  9 Sep 2021 10:09:19 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"nXv04fz6\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631174961;\n\tbh=kcl1JC+vWPyfwvqCjoA5NVVXXDkUDuFfoOec44dSbvo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nXv04fz6yrAVpiDW1WnCQet0FN13/hQ5sXdige9ssjfliYjhsxVNa68J3rYC+xT8l\n\tlCIL7pRgSjQcX9arJiywxb+vmEJd9CxgI2fWrWBj9wErnTDZ9uFIL0dFWdm0aclzDi\n\tc9XNUwEYpELORBO0Tyd+epQ3n9YMWV94CtuWz11E=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu,  9 Sep 2021 17:08:59 +0900","Message-Id":"<20210909080902.239533-5-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20210909080902.239533-1-paul.elder@ideasonboard.com>","References":"<20210909080902.239533-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 4/7] libcamera: v4l2_pixelformat: Add\n\thelper function to get the description","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a helper function to V4L2PixelFormat for retrieving the V4L2\ndescription string.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/v4l2_pixelformat.h |  1 +\n src/libcamera/v4l2_pixelformat.cpp            | 21 +++++++++++++++++++\n 2 files changed, 22 insertions(+)","diff":"diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h\nindex 87872542..e3cda699 100644\n--- a/include/libcamera/internal/v4l2_pixelformat.h\n+++ b/include/libcamera/internal/v4l2_pixelformat.h\n@@ -40,6 +40,7 @@ public:\n \toperator uint32_t() const { return fourcc_; }\n \n \tstd::string toString() const;\n+\tconst char *description() const;\n \n \tPixelFormat toPixelFormat() const;\n \tstatic V4L2PixelFormat fromPixelFormat(const PixelFormat &pixelFormat,\ndiff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\nindex 2c8167a7..fed31238 100644\n--- a/src/libcamera/v4l2_pixelformat.cpp\n+++ b/src/libcamera/v4l2_pixelformat.cpp\n@@ -250,6 +250,27 @@ std::string V4L2PixelFormat::toString() const\n \treturn ss;\n }\n \n+/**\n+ * \\brief Retrieve the V4L2 description for the format\n+ *\n+ * The description matches the value used by the kernel, as would be reported\n+ * by the VIDIOC_ENUM_FMT ioctl.\n+ *\n+ * \\return The V4L2 description corresponding to the V4L2 format\n+ */\n+const char *V4L2PixelFormat::description() const\n+{\n+\tconst auto iter = vpf2pf.find(*this);\n+\tif (iter == vpf2pf.end()) {\n+\t\tLOG(V4L2, Warning)\n+\t\t\t<< \"Unsupported V4L2 pixel format \"\n+\t\t\t<< toString();\n+\t\treturn \"Unsupported format\";\n+\t}\n+\n+\treturn iter->second.description;\n+}\n+\n /**\n  * \\brief Convert the V4L2 pixel format to the corresponding PixelFormat\n  * \\return The PixelFormat corresponding to the V4L2 pixel format\n","prefixes":["libcamera-devel","v3","4/7"]}