Show a patch.

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

{
    "id": 23501,
    "url": "https://patchwork.libcamera.org/api/patches/23501/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23501/",
    "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": "<20250606164156.1442682-23-barnabas.pocze@ideasonboard.com>",
    "date": "2025-06-06T16:41:55",
    "name": "[RFC,v1,22/23] py: Use `Request::metadata2()`",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2a34c6d22b3b03f72632d9c301b1b41d2336fefb",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23501/mbox/",
    "series": [
        {
            "id": 5210,
            "url": "https://patchwork.libcamera.org/api/series/5210/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5210",
            "date": "2025-06-06T16:41:33",
            "name": "libcamera: Add `MetadataList`",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5210/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/23501/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23501/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 066DAC3326\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Jun 2025 16:42:54 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 824B968DD7;\n\tFri,  6 Jun 2025 18:42:53 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 21C7B68DD5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Jun 2025 18:42:21 +0200 (CEST)",
            "from pb-laptop.local (185.182.215.79.nat.pool.zt.hu\n\t[185.182.215.79])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9F0E46DC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Jun 2025 18:42:16 +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=\"max17jzX\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749228136;\n\tbh=wyBwsGxtmrsWrgi7j2El1Bo9xmYz+7ox7WZqrMf9PW4=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=max17jzXICfcxywFkoKJSeNCHsv/Nk3AAd7z8LC6yAPthY+7cR4ImwKXft8vPjz0V\n\t+TYLoLeKDZJgbXI5nlw+gvjNY85LKgLhTdnCXrYcHA9u3EjiBjbLcYMIZjzBRSVKRs\n\tjnk/vzmzvzLFrIvXIlm3SBwJaRuUv4nsxOYR+D30=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[RFC PATCH v1 22/23] py: Use `Request::metadata2()`",
        "Date": "Fri,  6 Jun 2025 18:41:55 +0200",
        "Message-ID": "<20250606164156.1442682-23-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.49.0",
        "In-Reply-To": "<20250606164156.1442682-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20250606164156.1442682-1-barnabas.pocze@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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": "Expose the newly introduced `MetadataList` for any given `Request`.\nThis done similarly to the `Request::metadata()`, using the same\n`controlValueToPy()` function. However, that function is changed to\naccept `ControlValueView` as its argument since `MetadataList` does\nnot contain `ControlValue`s directly.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/py/libcamera/py_helpers.cpp | 4 ++--\n src/py/libcamera/py_helpers.h   | 2 +-\n src/py/libcamera/py_main.cpp    | 9 ++++-----\n 3 files changed, 7 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/src/py/libcamera/py_helpers.cpp b/src/py/libcamera/py_helpers.cpp\nindex 1ad1d4c1a..32f5cdaa6 100644\n--- a/src/py/libcamera/py_helpers.cpp\n+++ b/src/py/libcamera/py_helpers.cpp\n@@ -16,7 +16,7 @@ namespace py = pybind11;\n using namespace libcamera;\n \n template<typename T>\n-static py::object valueOrTuple(const ControlValue &cv)\n+static py::object valueOrTuple(const ControlValueView &cv)\n {\n \tif (cv.isArray()) {\n \t\tconst T *v = reinterpret_cast<const T *>(cv.data().data());\n@@ -31,7 +31,7 @@ static py::object valueOrTuple(const ControlValue &cv)\n \treturn py::cast(cv.get<T>());\n }\n \n-py::object controlValueToPy(const ControlValue &cv)\n+py::object controlValueToPy(const ControlValueView &cv)\n {\n \tswitch (cv.type()) {\n \tcase ControlTypeNone:\ndiff --git a/src/py/libcamera/py_helpers.h b/src/py/libcamera/py_helpers.h\nindex 983969dff..895006d0c 100644\n--- a/src/py/libcamera/py_helpers.h\n+++ b/src/py/libcamera/py_helpers.h\n@@ -9,5 +9,5 @@\n \n #include <pybind11/pybind11.h>\n \n-pybind11::object controlValueToPy(const libcamera::ControlValue &cv);\n+pybind11::object controlValueToPy(const libcamera::ControlValueView &cv);\n libcamera::ControlValue pyToControlValue(const pybind11::object &ob, libcamera::ControlType type);\ndiff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp\nindex 441a70ab4..126f544e7 100644\n--- a/src/py/libcamera/py_main.cpp\n+++ b/src/py/libcamera/py_main.cpp\n@@ -460,14 +460,13 @@ PYBIND11_MODULE(_libcamera, m)\n \t\t\tself.controls().set(id.id(), pyToControlValue(value, id.type()));\n \t\t})\n \t\t.def_property_readonly(\"metadata\", [](Request &self) {\n-\t\t\t/* Convert ControlList to std container */\n+\t\t\t/* Convert MetadataList to std container */\n \n \t\t\tstd::unordered_map<const ControlId *, py::object> ret;\n \n-\t\t\tfor (const auto &[key, cv] : self.metadata()) {\n-\t\t\t\tconst ControlId *id = controls::controls.at(key);\n-\t\t\t\tpy::object ob = controlValueToPy(cv);\n-\t\t\t\tret[id] = ob;\n+\t\t\tfor (const auto &[k, v] : self.metadata2()) {\n+\t\t\t\tconst ControlId *id = controls::controls.at(k);\n+\t\t\t\tret.try_emplace(id, controlValueToPy(v));\n \t\t\t}\n \n \t\t\treturn ret;\n",
    "prefixes": [
        "RFC",
        "v1",
        "22/23"
    ]
}