Show a patch.

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

{
    "id": 498,
    "url": "https://patchwork.libcamera.org/api/patches/498/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/498/",
    "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": "<20190203110102.5663-12-kieran.bingham@ideasonboard.com>",
    "date": "2019-02-03T11:01:02",
    "name": "[libcamera-devel,11/11] libcamera: v4l2device: update Buffer with information from v4l2_buffer when dequeueing",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1a50957ab89db8a9b8a3c4232a2d3740d0b4f482",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/498/mbox/",
    "series": [
        {
            "id": 165,
            "url": "https://patchwork.libcamera.org/api/series/165/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=165",
            "date": "2019-02-03T11:00:51",
            "name": "libcamera: V4L2 Streams",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/165/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/498/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/498/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<kieran.bingham@ideasonboard.com>",
        "Received": [
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 48A5D60DBF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 Feb 2019 12:01:09 +0100 (CET)",
            "from localhost.localdomain\n\t(218.182-78-194.adsl-static.isp.belgacom.be [194.78.182.218])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E777A5AA;\n\tSun,  3 Feb 2019 12:01:08 +0100 (CET)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549191669;\n\tbh=xd95viNIHdkTi2L4JZPRetCmmmWxPGMMERwPWaUI7gk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=BeN9QsPUInoU6CeR4Jj1ILeCMSN2EUFwuDsJzwNEXvEO2WFWnCZfvL53+LkBEiAD5\n\tJsPaVgyvQybD6IZGZCHd7a8cZjo0K7143+I7VN85tUASER3hOgg0ONP1YsAGoMlEIU\n\tK7dPf+Kd2Ws5gbh+5h1VZ7IvdgBv5n0PeuOzHhQE=",
        "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "To": "LibCamera Devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Sun,  3 Feb 2019 12:01:02 +0100",
        "Message-Id": "<20190203110102.5663-12-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.19.1",
        "In-Reply-To": "<20190203110102.5663-1-kieran.bingham@ideasonboard.com>",
        "References": "<20190203110102.5663-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 11/11] libcamera: v4l2device: update\n\tBuffer with information from v4l2_buffer when dequeueing",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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": "Sun, 03 Feb 2019 11:01:10 -0000"
    },
    "content": "From: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\nCopy the information from the struct v4l2_buffer when dequeueing the\nbuffer as applications need this information to make sens of the\ncaptured data.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n[Kieran: Re-adapt to use the V4L2Buffer class casting]\n---\n include/libcamera/buffer.h          | 12 ++++++++++++\n src/libcamera/include/v4l2_device.h |  2 ++\n src/libcamera/v4l2_device.cpp       | 17 ++++++++++++++++-\n 3 files changed, 30 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex 97fab5c65cce..b4dd0851bc7f 100644\n--- a/include/libcamera/buffer.h\n+++ b/include/libcamera/buffer.h\n@@ -7,6 +7,7 @@\n #ifndef __LIBCAMERA_BUFFER_H__\n #define __LIBCAMERA_BUFFER_H__\n \n+#include <sys/time.h>\n #include <vector>\n \n namespace libcamera {\n@@ -46,8 +47,19 @@ public:\n \tunsigned int index() const { return index_; };\n \tconst std::vector<Plane *> &planes() { return planes_; };\n \n+\tunsigned int bytesused() const { return bytesused_; };\n+\tunsigned int flags() const { return flags_; };\n+\tunsigned int field() const { return field_; };\n+\tstruct timeval timestamp() const { return timestamp_; };\n+\tunsigned int sequence() const { return sequence_; };\n+\n protected:\n \tunsigned int index_;\n+\tunsigned int bytesused_;\n+\tunsigned int flags_;\n+\tunsigned int field_;\n+\tstruct timeval timestamp_;\n+\tunsigned int sequence_;\n \n \tunsigned int format_;\n \tunsigned int width_;\ndiff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h\nindex fbbddad68082..641362ff594c 100644\n--- a/src/libcamera/include/v4l2_device.h\n+++ b/src/libcamera/include/v4l2_device.h\n@@ -61,6 +61,8 @@ class V4L2Buffer : public Buffer\n {\n public:\n \tV4L2Buffer(struct v4l2_buffer &vb);\n+\n+\tvoid update(struct v4l2_buffer &vb);\n };\n \n class V4L2DeviceFormat\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 630b43532c3e..7fafe2af393d 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -9,6 +9,7 @@\n #include <string.h>\n #include <sys/ioctl.h>\n #include <sys/mman.h>\n+#include <sys/time.h>\n #include <unistd.h>\n #include <vector>\n \n@@ -111,6 +112,16 @@ V4L2Buffer::V4L2Buffer(struct v4l2_buffer &vb)\n \t}\n }\n \n+void V4L2Buffer::update(struct v4l2_buffer &vb)\n+{\n+\t/* Update buffer information */\n+\tbytesused_ = vb.bytesused;\n+\tflags_ = vb.flags;\n+\tfield_ = vb.field;\n+\ttimestamp_ = vb.timestamp;\n+\tsequence_ = vb.sequence;\n+}\n+\n /**\n  * \\class V4L2DeviceFormat\n  * \\brief The V4L2 device image format and sizes\n@@ -673,7 +684,11 @@ Buffer *V4L2Device::dequeueBuffer()\n \t\treturn nullptr;\n \t}\n \n-\treturn bufferPool_->buffers()[buf.index];\n+\tV4L2Buffer *b;\n+\tb = reinterpret_cast<V4L2Buffer *>(bufferPool_->buffers()[buf.index]);\n+\tb->update(buf);\n+\n+\treturn b;\n }\n \n /**\n",
    "prefixes": [
        "libcamera-devel",
        "11/11"
    ]
}