diff options
author | Niklas Söderlund <niklas.soderlund@ragnatech.se> | 2019-01-24 23:34:51 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2019-02-06 06:49:45 +0200 |
commit | e94e52c0cb27f92c085da6e776af8b3d3172bbb2 (patch) | |
tree | 0f40c99cfd7d17259c266339573384a2a5fdff1e /src/libcamera/v4l2_device.cpp | |
parent | ba4dfa74714785005232e4268d63df1a4f162e24 (diff) |
libcamera: v4l2_device: Update dequeued buffer information
Copy the information from the struct v4l2_buffer when dequeueing the
buffer as applications need this information to make sense of the
captured data.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/libcamera/v4l2_device.cpp')
-rw-r--r-- | src/libcamera/v4l2_device.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index f9839fc7..e8755be1 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -9,6 +9,7 @@ #include <string.h> #include <sys/ioctl.h> #include <sys/mman.h> +#include <sys/time.h> #include <unistd.h> #include <vector> @@ -723,7 +724,14 @@ Buffer *V4L2Device::dequeueBuffer() if (--queuedBuffersCount_ == 0) fdEvent_->setEnabled(false); - return &bufferPool_->buffers()[buf.index]; + Buffer *buffer = &bufferPool_->buffers()[buf.index]; + + buffer->bytesused_ = buf.bytesused; + buffer->timestamp_ = buf.timestamp.tv_sec * 1000000000ULL + + buf.timestamp.tv_usec * 1000ULL; + buffer->sequence_ = buf.sequence; + + return buffer; } /** |