{"id":13763,"url":"https://patchwork.libcamera.org/api/1.1/patches/13763/?format=json","web_url":"https://patchwork.libcamera.org/patch/13763/","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":"<20210908081437.4022697-5-paul.elder@ideasonboard.com>","date":"2021-09-08T08:14:34","name":"[libcamera-devel,v2,4/7] libcamera: v4l2_pixelformat: Add helper function to get the description","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c817cde566dfd583ec1b7d09d411031eb633fed2","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/13763/mbox/","series":[{"id":2497,"url":"https://patchwork.libcamera.org/api/1.1/series/2497/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2497","date":"2021-09-08T08:14:30","name":"v4l2-compat fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/2497/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/13763/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/13763/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 24340BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Sep 2021 08:15:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DA19869173;\n\tWed,  8 Sep 2021 10:15:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3109E6916E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Sep 2021 10:14:58 +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 B8354993;\n\tWed,  8 Sep 2021 10:14:56 +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=\"YPdlrjoA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1631088897;\n\tbh=bfM8kBnyFpaLCAFcna3SlvvocnGZ6yCVKX+y4y4wLO4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=YPdlrjoAlMmcr+l+TmMxdYF7Kg7ixZUPUekyuAIPiiAuGn1s5G4xP/uEv6C6XPNOS\n\tvpfEw2jStcIBpo3lDINWra/oaJubQy6IA4E999HLOIhxeF/Z8q4PWblwQd4TsbJjQP\n\t3MSEO1LbUU87XluyO32SEMGWX9qLSB2uEwr7v2N4=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  8 Sep 2021 17:14:34 +0900","Message-Id":"<20210908081437.4022697-5-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20210908081437.4022697-1-paul.elder@ideasonboard.com>","References":"<20210908081437.4022697-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 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>\n---\n include/libcamera/internal/v4l2_pixelformat.h |  1 +\n src/libcamera/v4l2_pixelformat.cpp            | 17 +++++++++++++++++\n 2 files changed, 18 insertions(+)","diff":"diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h\nindex 36c690db..3b24bc73 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 *toDescription() 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 0a8312c4..f5598d9d 100644\n--- a/src/libcamera/v4l2_pixelformat.cpp\n+++ b/src/libcamera/v4l2_pixelformat.cpp\n@@ -250,6 +250,23 @@ std::string V4L2PixelFormat::toString() const\n \treturn ss;\n }\n \n+/**\n+ * \\brief Return the V4L2 description corresponding to the V4L2 format\n+ * \\return The V4L2 description corresponding to the V4L2 format\n+ */\n+const char *V4L2PixelFormat::toDescription() 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 \"\";\n+\t}\n+\n+\treturn iter->second.name;\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","v2","4/7"]}