Show a patch.

GET /api/1.1/patches/21233/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 21233,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21233/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21233/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20240911153523.1756554-2-paul.elder@ideasonboard.com>",
    "date": "2024-09-11T15:35:22",
    "name": "[1/2] libcamera: controls: Add array information to ControlId",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "047bdeb43a4f2d2cc86645c043732bbe49d6f5e3",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/21233/mbox/",
    "series": [
        {
            "id": 4580,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4580/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4580",
            "date": "2024-09-11T15:35:21",
            "name": "Add array information to ControlId",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4580/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21233/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21233/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 5C25EC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Sep 2024 15:35:39 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A7E04634F9;\n\tWed, 11 Sep 2024 17:35:35 +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 280BA618FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Sep 2024 17:35:30 +0200 (CEST)",
            "from pyrite.hamster-moth.ts.net\n\t(213-229-8-243.static.upcbusiness.at [213.229.8.243])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 50BF1C80;\n\tWed, 11 Sep 2024 17:34:12 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DE15H+lu\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726068852;\n\tbh=SSRWWpB7JOvFzaXrKtraOVqDqvLvnk0SyPbDovE0rlU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=DE15H+luB8LIhg3/cdUWXHNSBE0YR9lQhB/vk3iqsgBHuQ959nrbtZ1jfBPyebDcO\n\tdjpNy5zED9YNke/Mw5gHIG9/ShxIUz1Q7rJ85px+Td7igTI3tQAPFpJZRoMcIbgon3\n\t12r7TYP6yeSu+tGVQVQWOgWFdxk5ApgjbBoT6x98=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[PATCH 1/2] libcamera: controls: Add array information to ControlId",
        "Date": "Wed, 11 Sep 2024 17:35:22 +0200",
        "Message-Id": "<20240911153523.1756554-2-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20240911153523.1756554-1-paul.elder@ideasonboard.com>",
        "References": "<20240911153523.1756554-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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 to ControlId information on whether or not it is an array control,\nand the size of the control if it is an array control.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n include/libcamera/controls.h | 17 ++++++++++++++++-\n src/libcamera/controls.cpp   | 16 ++++++++++++++--\n 2 files changed, 30 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h\nindex 8959dfcc2..b539159e1 100644\n--- a/include/libcamera/controls.h\n+++ b/include/libcamera/controls.h\n@@ -46,50 +46,60 @@ struct control_type {\n template<>\n struct control_type<void> {\n \tstatic constexpr ControlType value = ControlTypeNone;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<bool> {\n \tstatic constexpr ControlType value = ControlTypeBool;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<uint8_t> {\n \tstatic constexpr ControlType value = ControlTypeByte;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<int32_t> {\n \tstatic constexpr ControlType value = ControlTypeInteger32;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<int64_t> {\n \tstatic constexpr ControlType value = ControlTypeInteger64;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<float> {\n \tstatic constexpr ControlType value = ControlTypeFloat;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<std::string> {\n \tstatic constexpr ControlType value = ControlTypeString;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<Rectangle> {\n \tstatic constexpr ControlType value = ControlTypeRectangle;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<>\n struct control_type<Size> {\n \tstatic constexpr ControlType value = ControlTypeSize;\n+\tstatic constexpr std::size_t size = 0;\n };\n \n template<typename T, std::size_t N>\n struct control_type<Span<T, N>> : public control_type<std::remove_cv_t<T>> {\n+\tstatic constexpr std::size_t size = N;\n };\n \n } /* namespace details */\n@@ -215,11 +225,14 @@ class ControlId\n {\n public:\n \tControlId(unsigned int id, const std::string &name, ControlType type,\n+\t\t  std::size_t size = 0,\n \t\t  const std::map<std::string, int32_t> &enumStrMap = {});\n \n \tunsigned int id() const { return id_; }\n \tconst std::string &name() const { return name_; }\n \tControlType type() const { return type_; }\n+\tbool isArray() const { return size_ > 0; }\n+\tstd::size_t size() const { return size_; }\n \tconst std::map<std::string, int32_t> &enumStrMap() const { return enumStrMap_; }\n \tconst std::string enumToString(int32_t value) const;\n \n@@ -229,6 +242,7 @@ private:\n \tunsigned int id_;\n \tstd::string name_;\n \tControlType type_;\n+\tstd::size_t size_;\n \tstd::map<std::string, int32_t> enumStrMap_;\n \tstd::map<int32_t, std::string> reverseMap_;\n };\n@@ -260,7 +274,8 @@ public:\n \tusing type = T;\n \n \tControl(unsigned int id, const char *name, const std::map<std::string, int32_t> &enumStrMap = {})\n-\t\t: ControlId(id, name, details::control_type<std::remove_cv_t<T>>::value, enumStrMap)\n+\t\t: ControlId(id, name, details::control_type<std::remove_cv_t<T>>::value,\n+\t\t\t    details::control_type<std::remove_cv_t<T>>::size, enumStrMap)\n \t{\n \t}\n \ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex 0f83139fb..1530bdb9c 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -394,8 +394,8 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen\n  * \\param[in] enumStrMap The map from enum names to values (optional)\n  */\n ControlId::ControlId(unsigned int id, const std::string &name, ControlType type,\n-\t\t     const std::map<std::string, int32_t> &enumStrMap)\n-\t: id_(id), name_(name), type_(type), enumStrMap_(enumStrMap)\n+\t\t     std::size_t size, const std::map<std::string, int32_t> &enumStrMap)\n+\t: id_(id), name_(name), type_(type), size_(size), enumStrMap_(enumStrMap)\n {\n \tfor (const auto &pair : enumStrMap_)\n \t\treverseMap_[pair.second] = pair.first;\n@@ -419,6 +419,18 @@ ControlId::ControlId(unsigned int id, const std::string &name, ControlType type,\n  * \\return The control data type\n  */\n \n+/**\n+ * \\fn bool isArray() const\n+ * \\brief Determine if the control is an array control\n+ * \\return True if the control is an array control, false otherwise\n+ */\n+\n+/**\n+ * \\fn std::size_t size() const\n+ * \\brief Retrieve the size of the control if it is an array control\n+ * \\return The size of the array control, size_t::max for dynamic extend, or 0 for non-array\n+ */\n+\n /**\n  * \\brief Retrieve the name of an enum value\n  * \\return The name of the enum value\n",
    "prefixes": [
        "1/2"
    ]
}