Patch Detail
Show a patch.
GET /api/1.1/patches/524/?format=api
{ "id": 524, "url": "https://patchwork.libcamera.org/api/1.1/patches/524/?format=api", "web_url": "https://patchwork.libcamera.org/patch/524/", "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": "<20190206060818.13907-10-laurent.pinchart@ideasonboard.com>", "date": "2019-02-06T06:08:00", "name": "[libcamera-devel,09/27] libcamera: v4l2_device: Update dequeued buffer information", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "723c8876365eea94f4fe9322e357f00687a545e4", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/524/mbox/", "series": [ { "id": 170, "url": "https://patchwork.libcamera.org/api/1.1/series/170/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=170", "date": "2019-02-06T06:07:51", "name": "Capture frames throught requests", "version": 1, "mbox": "https://patchwork.libcamera.org/series/170/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/524/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/524/checks/", "tags": {}, "headers": { "Return-Path": "<laurent.pinchart@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 8034661023\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 6 Feb 2019 07:08:25 +0100 (CET)", "from pendragon.ideasonboard.com (d51A4137F.access.telenet.be\n\t[81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2633841\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 6 Feb 2019 07:08:25 +0100 (CET)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549433305;\n\tbh=B5M/twrOBtrd2Nb3EXgK8rTXGGs1GTb6g6u429P8jIg=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=MIWAPcrFAoAbkz5uiUIeXkfmAlZhOJ1zgAJLmIhGlBAO6HOJAlIaXiKsnkZobH6Aw\n\tbtCtK13tN9it+jxtXXy2NFh+PZEuMKyNNU90m08DguT3GwY6c1dWTa4IIp1A4C0Md7\n\tityqAH7Pwo7/2wI0bKZ1dOHYvecExoaNmkMNt3/c=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 6 Feb 2019 08:08:00 +0200", "Message-Id": "<20190206060818.13907-10-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.19.2", "In-Reply-To": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>", "References": "<20190206060818.13907-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 09/27] libcamera: v4l2_device: Update\n\tdequeued buffer information", "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": "Wed, 06 Feb 2019 06:08:26 -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 sense of the\ncaptured data.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/buffer.h | 8 ++++++++\n src/libcamera/buffer.cpp | 26 ++++++++++++++++++++++++++\n src/libcamera/v4l2_device.cpp | 10 +++++++++-\n 3 files changed, 43 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/libcamera/buffer.h b/include/libcamera/buffer.h\nindex 21a1ec4c574e..dc9aaad12a81 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 <stdint.h>\n #include <vector>\n \n #include <libcamera/signal.h>\n@@ -42,14 +43,21 @@ public:\n \tBuffer();\n \n \tunsigned int index() const { return index_; }\n+\tunsigned int bytesused() const { return bytesused_; }\n+\tuint64_t timestamp() const { return timestamp_; }\n+\tunsigned int sequence() const { return sequence_; }\n \tstd::vector<Plane> &planes() { return planes_; }\n \n \tSignal<Buffer *> completed;\n \n private:\n \tfriend class BufferPool;\n+\tfriend class V4L2Device;\n \n \tunsigned int index_;\n+\tunsigned int bytesused_;\n+\tuint64_t timestamp_;\n+\tunsigned int sequence_;\n \n \tstd::vector<Plane> planes_;\n };\ndiff --git a/src/libcamera/buffer.cpp b/src/libcamera/buffer.cpp\nindex 5f6114cf3bc5..9ec372c2981b 100644\n--- a/src/libcamera/buffer.cpp\n+++ b/src/libcamera/buffer.cpp\n@@ -203,6 +203,32 @@ Buffer::Buffer()\n * \\brief A Signal to provide notifications that the specific Buffer is ready\n */\n \n+/**\n+ * \\fn Buffer::bytesused()\n+ * \\brief Retrieve the number of bytes occupied by the data in the buffer\n+ * \\return Number of bytes occupied in the buffer\n+ */\n+\n+/**\n+ * \\fn Buffer::timestamp()\n+ * \\brief Retrieve the time when the buffer was processed\n+ *\n+ * The timestamp is expressed as a number number of nanoseconds since the epoch.\n+ *\n+ * \\return Timestamp when the buffer was processed\n+ */\n+\n+/**\n+ * \\fn Buffer::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 * \\class BufferPool\n * \\brief A pool of buffers\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex f9839fc715f4..e8755be1f63f 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@@ -723,7 +724,14 @@ Buffer *V4L2Device::dequeueBuffer()\n \tif (--queuedBuffersCount_ == 0)\n \t\tfdEvent_->setEnabled(false);\n \n-\treturn &bufferPool_->buffers()[buf.index];\n+\tBuffer *buffer = &bufferPool_->buffers()[buf.index];\n+\n+\tbuffer->bytesused_ = buf.bytesused;\n+\tbuffer->timestamp_ = buf.timestamp.tv_sec * 1000000000ULL\n+\t\t\t + buf.timestamp.tv_usec * 1000ULL;\n+\tbuffer->sequence_ = buf.sequence;\n+\n+\treturn buffer;\n }\n \n /**\n", "prefixes": [ "libcamera-devel", "09/27" ] }