Show a patch.

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

{
    "id": 23494,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/23494/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/23494/",
    "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": "<20250606164156.1442682-14-barnabas.pocze@ideasonboard.com>",
    "date": "2025-06-06T16:41:46",
    "name": "[RFC,v1,13/23] libcamera: camera: Introduce metadataAvailable signal",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "96750764248b8e470b91e982c3c33dd3d1073f3c",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/23494/mbox/",
    "series": [
        {
            "id": 5210,
            "url": "https://patchwork.libcamera.org/api/1.1/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/23494/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/23494/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 F2315C332B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Jun 2025 16:42:45 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 709D468DD3;\n\tFri,  6 Jun 2025 18:42:45 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 907C268DCD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Jun 2025 18:42:18 +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 13B208DB;\n\tFri,  6 Jun 2025 18:42:14 +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=\"rNex3+cf\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1749228134;\n\tbh=SW2O+QHlgvwrk3GucZFzQSATnJnlcKEwg8tmUIUhFmk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=rNex3+cf1iBoa4vspHhSvEcnoFETBz5lt79zH5uC6oih5dICfC4hIsgcF0yGNndko\n\tbB9SqhSROqUr5pJcDm1pj/7KcFcR6/xPByEBqvalb0maMHmoCSCMLFPIIGhGRCCgwB\n\th2/0xHE/ngBwulw6BU0dAG0af2ASfw8xeoR3kkTk=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Subject": "[RFC PATCH v1 13/23] libcamera: camera: Introduce metadataAvailable\n\tsignal",
        "Date": "Fri,  6 Jun 2025 18:41:46 +0200",
        "Message-ID": "<20250606164156.1442682-14-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": "From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nAdd a new signal to the Camera class that allows applications to\nreceive notifications for early completion of metadata results.\n\nTo avoid expensive copies of the metadata results the signal\ntransports the ids of the metadata keys that are ready. Applications\ncan use these ids to access the metadata results from\nRequest::metadata().\n\nThe signal is an opt-in feature for applications and the sum of\nall metadata results notified through this signal is available\nin Request::metadata() at request completion time.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n[Use `MetadataList::Diff`, change documentation accordingly.]\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\nOriginal: https://patchwork.libcamera.org/patch/22227/\n---\n include/libcamera/camera.h |  1 +\n src/libcamera/camera.cpp   | 54 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 55 insertions(+)",
    "diff": "diff --git a/include/libcamera/camera.h b/include/libcamera/camera.h\nindex 94cee7bd8..bf5623ddf 100644\n--- a/include/libcamera/camera.h\n+++ b/include/libcamera/camera.h\n@@ -122,6 +122,7 @@ public:\n \n \tconst std::string &id() const;\n \n+\tSignal<Request *, MetadataList::Diff> metadataAvailable;\n \tSignal<Request *, FrameBuffer *> bufferCompleted;\n \tSignal<Request *> requestCompleted;\n \tSignal<> disconnected;\ndiff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 31f5ad94b..2c87c3274 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -902,6 +902,60 @@ const std::string &Camera::id() const\n \treturn _d()->id_;\n }\n \n+/**\n+ * \\var Camera::metadataAvailable\n+ * \\brief Signal emitted when metadata for a request is available\n+ *\n+ * The metadataAvailable signal notifies applications about the availability\n+ * of metadata for a request before the request completes.\n+ *\n+ * As metadata results could be large in size, the signal transports only a view\n+ * object via which the newly completed metadata items can be accessed. Similarly\n+ * to the metadata list itself, this object is thread-safe, and can be sent to other\n+ * threads for deferred processing. The view object is valid until the request is\n+ * destroyed or reused, whichever happens first.\n+ *\n+ * Applications can access the value of the newly available metadata results as follows:\n+ *\n+ * \\code\n+\n+\tvoid metadataAvailableHandler(Request *request, MetadataList::Diff update)\n+\t{\n+\t\t// The object can be iterated...\n+\t\tfor (auto &&[id, data] : update) {\n+\t\t\t// `id` is the numeric identifier\n+\t\t\t// `data` is a `ControlValueView` object\n+\t\t}\n+\n+\t\t// ...or individual items can be looked up.\n+\t\tif (auto x = update.get(controls::SensorTimestamp)) {\n+\t\t\t// `SensorTimestamp` will only be found if it is part of this\n+\t\t\t// particular update; metadata items completed earlier will\n+\t\t\t// not be found.\n+\t\t}\n+\t}\n+   \\endcode\n+ *\n+ * This signal is emitted multiple times for the same request, it is in fact\n+ * emitted by the framework every time a new metadata list is made available\n+ * by the Camera to the application.\n+ *\n+ * The sum of all metadata lists reported through this signal is equal to\n+ * Request::metadata() list when the Request completes.\n+ *\n+ * Application can opt-in to handle this signal to receive fast notifications\n+ * of metadata availability or can equally access the full metadata list\n+ * at Request complete time through Request::metadata() if they have no interest\n+ * in early metadata notification.\n+ *\n+ * \\note The received MetadataList::Diff object is merely a view, it is only valid until\n+ *       the associated Request is destroyed or \\ref Request::reuse() \"reused\". However,\n+ *       during its valid lifetime, an application is free to create copies and access the\n+ *       completed metadata items from separate thread by iteration or MetadataList::Diff::get().\n+ *\n+ * \\sa ControlValueView\n+ */\n+\n /**\n  * \\var Camera::bufferCompleted\n  * \\brief Signal emitted when a buffer for a request queued to the camera has\n",
    "prefixes": [
        "RFC",
        "v1",
        "13/23"
    ]
}