Show a patch.

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

{
    "id": 21236,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21236/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21236/",
    "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": "<20240911162400.1906661-2-paul.elder@ideasonboard.com>",
    "date": "2024-09-11T16:23:59",
    "name": "[v2,1/2] libcamera: controls: Add array information to ControlId",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "0b223df17f480b61fa232604e235e0bc9efb4959",
    "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/21236/mbox/",
    "series": [
        {
            "id": 4581,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4581/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4581",
            "date": "2024-09-11T16:23:58",
            "name": "Add array information to ControlId",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4581/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21236/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21236/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 E66D5BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 11 Sep 2024 16:24:21 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B2C0634F9;\n\tWed, 11 Sep 2024 18:24:17 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D966618FB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 11 Sep 2024 18:24:12 +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 73FFE124E;\n\tWed, 11 Sep 2024 18:22:54 +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=\"nrbjGBdY\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1726071774;\n\tbh=j7treA3oXvP0UyShQhVNYV0OQUUUzJ4I2c4XVuE/Q40=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=nrbjGBdYeVkfysVRG/ktgBw1tRVEY0/8xYfVYB2KCoHrpKAt9LBtd7QgcgrUKXLLh\n\tdRdEI2dJpzWF0XJtjoDcJOWk4Ukam7WF90cU8XCXvllo1n4xnpVEIPftMTakXNUsVl\n\tpZEkO0K2wBDUXRoKG2s+XCsxxCchEQKamIlEhQpg=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Paul Elder <paul.elder@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>",
        "Subject": "[PATCH v2 1/2] libcamera: controls: Add array information to\n\tControlId",
        "Date": "Wed, 11 Sep 2024 18:23:59 +0200",
        "Message-Id": "<20240911162400.1906661-2-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.39.2",
        "In-Reply-To": "<20240911162400.1906661-1-paul.elder@ideasonboard.com>",
        "References": "<20240911162400.1906661-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>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nChanges in v2:\n- fix documentation\n---\n include/libcamera/controls.h | 17 ++++++++++++++++-\n src/libcamera/controls.cpp   | 17 +++++++++++++++--\n 2 files changed, 31 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..217769396 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -391,11 +391,12 @@ void ControlValue::reserve(ControlType type, bool isArray, std::size_t numElemen\n  * \\param[in] id The control numerical ID\n  * \\param[in] name The control name\n  * \\param[in] type The control data type\n+ * \\param[in] size The size of the array control, or 0 if scalar control\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 +420,18 @@ ControlId::ControlId(unsigned int id, const std::string &name, ControlType type,\n  * \\return The control data type\n  */\n \n+/**\n+ * \\fn bool ControlId::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 ControlId::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": [
        "v2",
        "1/2"
    ]
}