Show a patch.

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

{
    "id": 2351,
    "url": "https://patchwork.libcamera.org/api/patches/2351/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/2351/",
    "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": "<20191126233620.1695316-4-niklas.soderlund@ragnatech.se>",
    "date": "2019-11-26T23:35:53",
    "name": "[libcamera-devel,03/30] libcamera: buffer: Add BufferInfo container for buffer metadata information",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "3df696e7688c25dade87d9c87dd3d3ff5ad3bf42",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/2351/mbox/",
    "series": [
        {
            "id": 579,
            "url": "https://patchwork.libcamera.org/api/series/579/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=579",
            "date": "2019-11-26T23:35:50",
            "name": "libcamera: Rework buffer API",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/579/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/2351/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/2351/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C315861C62\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Nov 2019 00:39:27 +0100 (CET)",
            "from bismarck.berto.se (p54ac5865.dip0.t-ipconnect.de\n\t[84.172.88.101]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA\n\tid fb3c3f54-10a5-11ea-a0b9-005056917f90;\n\tWed, 27 Nov 2019 00:39:26 +0100 (CET)"
        ],
        "X-Halon-ID": "fb3c3f54-10a5-11ea-a0b9-005056917f90",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 27 Nov 2019 00:35:53 +0100",
        "Message-Id": "<20191126233620.1695316-4-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.24.0",
        "In-Reply-To": "<20191126233620.1695316-1-niklas.soderlund@ragnatech.se>",
        "References": "<20191126233620.1695316-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 03/30] libcamera: buffer: Add BufferInfo\n\tcontainer for buffer metadata information",
        "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": "Tue, 26 Nov 2019 23:39:28 -0000"
    },
    "content": "For FrameBuffers the metadata information gathered when a buffer is\ncaptured will not be stored directly in the buffer object but in its\nown container. Add the BufferInfo class to hold this information.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/buffer.h | 30 +++++++++++++\n src/libcamera/buffer.cpp   | 92 ++++++++++++++++++++++++++++++++++++++\n 2 files changed, 122 insertions(+)",
    "diff": "diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex 80602124f24be4a0..7302b9f32ce8c50d 100644\n--- a/include/libcamera/buffer.h\n+++ b/include/libcamera/buffer.h\n@@ -16,6 +16,36 @@ namespace libcamera {\n class Request;\n class Stream;\n \n+class BufferInfo\n+{\n+public:\n+\tenum Status {\n+\t\tBufferSuccess,\n+\t\tBufferError,\n+\t\tBufferCancelled,\n+\t};\n+\n+\tstruct Plane {\n+\t\tunsigned int bytesused;\n+\t};\n+\n+\tBufferInfo();\n+\n+\tvoid update(Status status, unsigned int sequence, uint64_t timestamp,\n+\t\t    const std::vector<Plane> &planes);\n+\n+\tStatus status() const { return status_; }\n+\tunsigned int sequence() const { return sequence_; }\n+\tuint64_t timestamp() const { return timestamp_; }\n+\tconst std::vector<Plane> &planes() const { return planes_; }\n+\n+private:\n+\tStatus status_;\n+\tunsigned int sequence_;\n+\tuint64_t timestamp_;\n+\tstd::vector<Plane> planes_;\n+};\n+\n class Plane final\n {\n public:\ndiff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex 960eeb8f7d193ddd..4acff216cafba484 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -23,6 +23,98 @@ namespace libcamera {\n \n LOG_DEFINE_CATEGORY(Buffer)\n \n+/**\n+ * \\class BufferInfo\n+ * \\brief Dynamic buffer metadata\n+ *\n+ * The BufferInfo class references a buffers dynamic metadata related to the\n+ * frame contained in the buffer.\n+ */\n+\n+/**\n+ * \\enum BufferInfo::Status\n+ * Buffer completion status\n+ * \\var BufferInfo::BufferSuccess\n+ * The buffer has completed with success and contains valid data. All its other\n+ * metadata (such as bytesused(), timestamp() or sequence() number) are valid.\n+ * \\var BufferInfo::BufferError\n+ * The buffer has completed with an error and doesn't contain valid data. Its\n+ * other metadata are valid.\n+ * \\var BufferInfo::BufferCancelled\n+ * The buffer has been cancelled due to capture stop. Its other metadata are\n+ * invalid and shall not be used.\n+ */\n+\n+/**\n+ * \\struct BufferInfo::Plane\n+ * \\brief Plane specific buffer information\n+ */\n+\n+/**\n+ * \\var BufferInfo::Plane::bytesused\n+ * \\brief Retrieve the number of bytes occupied by the data in the plane\n+ * \\return Number of bytes occupied in the plane\n+ */\n+\n+BufferInfo::BufferInfo()\n+\t: status_(BufferError), sequence_(0), timestamp_(0)\n+{\n+}\n+\n+/**\n+ * \\brief Uptade the buffer information\n+ * \\param[in] status New buffer status\n+ * \\param[in] sequence New buffer sequence\n+ * \\param[in] timestamp New buffer timestamp\n+ * \\param[in] planes New buffer plane meta data\n+ *\n+ * Update the stored buffer meta data information.\n+ */\n+void BufferInfo::update(Status status, unsigned int sequence,\n+\t\t\tuint64_t timestamp, const std::vector<Plane> &planes)\n+{\n+\tstatus_ = status;\n+\tsequence_ = sequence;\n+\ttimestamp_ = timestamp;\n+\tplanes_ = planes;\n+}\n+\n+/**\n+ * \\fn BufferInfo::status()\n+ * \\brief Retrieve the buffer status\n+ *\n+ * The buffer status reports whether the buffer has completed successfully\n+ * (BufferSuccess) or if an error occurred (BufferError).\n+ *\n+ * \\return The buffer status\n+ */\n+\n+/**\n+ * \\fn BufferInfo::sequence()\n+ * \\brief Retrieve the buffer sequence number\n+ *\n+ * The sequence number is a monotonically increasing number assigned to the\n+ * buffer processed by the stream. Gaps in the sequence numbers indicate\n+ * dropped frames.\n+ *\n+ * \\return Sequence number of the buffer\n+ */\n+\n+/**\n+ * \\fn BufferInfo::timestamp()\n+ * \\brief Retrieve the time when the buffer was processed\n+ *\n+ * The timestamp is expressed as a number of nanoseconds since the epoch.\n+ *\n+ * \\return Timestamp when the buffer was processed\n+ */\n+\n+/**\n+ * \\fn BufferInfo::planes()\n+ * \\brief Retrieve the plane(s) information for the buffer\n+ * \\return A array holding all plane information for the buffer\n+ */\n+\n /**\n  * \\class Plane\n  * \\brief A memory region to store a single plane of a frame\n",
    "prefixes": [
        "libcamera-devel",
        "03/30"
    ]
}