Patch Detail
Show a patch.
GET /api/patches/2761/?format=api
{ "id": 2761, "url": "https://patchwork.libcamera.org/api/patches/2761/?format=api", "web_url": "https://patchwork.libcamera.org/patch/2761/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200130213809.16564-1-kieran.bingham@ideasonboard.com>", "date": "2020-01-30T21:38:09", "name": "[libcamera-devel] libcamera: PixelFormat: Define a FourCC output helper", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "62fce19a77a37957516ced005a7a111ee61dcb9a", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": { "id": 11, "url": "https://patchwork.libcamera.org/api/users/11/?format=api", "username": "kbingham", "first_name": "Kieran", "last_name": "Bingham", "email": "kieran.bingham@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/2761/mbox/", "series": [ { "id": 652, "url": "https://patchwork.libcamera.org/api/series/652/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=652", "date": "2020-01-30T21:38:09", "name": "[libcamera-devel] libcamera: PixelFormat: Define a FourCC output helper", "version": 1, "mbox": "https://patchwork.libcamera.org/series/652/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/2761/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/2761/checks/", "tags": {}, "headers": { "Return-Path": "<kieran.bingham@ideasonboard.com>", "Received": [ "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 73D57607F3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Jan 2020 22:38:13 +0100 (CET)", "from localhost.localdomain\n\t(cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D2B5E504;\n\tThu, 30 Jan 2020 22:38:12 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1580420293;\n\tbh=LFok/jECaW2TFXlQoOEFZIs+yQnexYMVqh5SM4UAbYg=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Z2ZxlnYa1iFNO8BZATEoO70bizdt/P2g19AX0xjBf8vitRgzyyFkZC07JgyQ8HK07\n\t1iQ+7SEhOcippvjXa2/sZOx4veg+hTJXJ2OpC/0w7eBnJXzHlJMRPPUKnuTE1+Y2zB\n\tiUkUntnzxh5BC8RzMDmZGBXp4EFQXKKwzMSNWQZM=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 30 Jan 2020 21:38:09 +0000", "Message-Id": "<20200130213809.16564-1-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.20.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] libcamera: PixelFormat: Define a FourCC\n\toutput helper", "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>", "X-List-Received-Date": "Thu, 30 Jan 2020 21:38:13 -0000" }, "content": "Provide a helper to print the FourCC string representation, and utilise\nit to improve the readability of the StreamConfiguration.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nThis changes the output of the line:\n[159:34:26.262068766] [16497] INFO Camera camera.cpp:784 configuring streams: (0) 1920x1080-0x47504a4d\n\nto read:\n[159:34:26.262068766] [16497] INFO Camera camera.cpp:784 configuring streams: (0) 1920x1080-0x47504a4d MJPG\n\n include/libcamera/pixelformats.h | 3 +++\n src/libcamera/pixelformats.cpp | 20 ++++++++++++++++++++\n src/libcamera/stream.cpp | 3 ++-\n 3 files changed, 25 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/libcamera/pixelformats.h b/include/libcamera/pixelformats.h\nindex 6e25b8d8b76e..32cff083cdf9 100644\n--- a/include/libcamera/pixelformats.h\n+++ b/include/libcamera/pixelformats.h\n@@ -8,11 +8,14 @@\n #define __LIBCAMERA_PIXEL_FORMATS_H__\n \n #include <stdint.h>\n+#include <string>\n \n namespace libcamera {\n \n using PixelFormat = uint32_t;\n \n+std::string FourCC(const PixelFormat &p);\n+\n } /* namespace libcamera */\n \n #endif /* __LIBCAMERA_PIXEL_FORMATS_H__ */\ndiff --git a/src/libcamera/pixelformats.cpp b/src/libcamera/pixelformats.cpp\nindex c03335400b70..d6b2c6a3dba5 100644\n--- a/src/libcamera/pixelformats.cpp\n+++ b/src/libcamera/pixelformats.cpp\n@@ -7,6 +7,8 @@\n \n #include <libcamera/pixelformats.h>\n \n+#include <sstream>\n+\n /**\n * \\file pixelformats.h\n * \\brief libcamera pixel formats\n@@ -25,4 +27,22 @@ namespace libcamera {\n * \\todo Add support for format modifiers\n */\n \n+/**\n+ * \\brief Return a PixelFormat as a FourCC string representation\n+ */\n+std::string FourCC(const PixelFormat &p)\n+{\n+\tstd::stringstream ss;\n+\n+\tss << static_cast<char>(p & 0x7f)\n+\t << static_cast<char>((p >> 8) & 0x7f)\n+\t << static_cast<char>((p >> 16) & 0x7f)\n+\t << static_cast<char>((p >> 24) & 0x7f);\n+\n+\tif (p & (1 << 31))\n+\t\tss << \"-BE\";\n+\n+\treturn ss.str();\n+}\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp\nindex 13789e9eb344..4efe4385326f 100644\n--- a/src/libcamera/stream.cpp\n+++ b/src/libcamera/stream.cpp\n@@ -348,7 +348,8 @@ StreamConfiguration::StreamConfiguration(const StreamFormats &formats)\n std::string StreamConfiguration::toString() const\n {\n \tstd::stringstream ss;\n-\tss << size.toString() << \"-\" << utils::hex(pixelFormat);\n+\tss << size.toString() << \"-\" << utils::hex(pixelFormat)\n+\t << \" \" << FourCC(pixelFormat);\n \treturn ss.str();\n }\n \n", "prefixes": [ "libcamera-devel" ] }