summaryrefslogtreecommitdiff
path: root/src/v4l2/v4l2_camera_proxy.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-11-22 16:22:56 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-01-12 16:10:38 +0100
commit9217f274f64f690b768d332663e1731a3ee5ef15 (patch)
treeee152928be1eaea656c929e56e27e97b175de435 /src/v4l2/v4l2_camera_proxy.cpp
parenteb4030f6c07174a520be1ebd73628e9ae4789569 (diff)
libcamera: Switch to FrameBuffer interface
Switch to the FrameBuffer interface where all buffers are treated as external buffers and are allocated outside the camera. Applications allocating buffers using libcamera are switched to use the FrameBufferAllocator helper. Follow-up changes to this one will finalize the transition to the new FrameBuffer interface by removing code that is left unused after this change. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/v4l2/v4l2_camera_proxy.cpp')
-rw-r--r--src/v4l2/v4l2_camera_proxy.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp
index 5158eac4..28e58722 100644
--- a/src/v4l2/v4l2_camera_proxy.cpp
+++ b/src/v4l2/v4l2_camera_proxy.cpp
@@ -187,17 +187,18 @@ void V4L2CameraProxy::querycap(std::shared_ptr<Camera> camera)
void V4L2CameraProxy::updateBuffers()
{
- std::vector<V4L2FrameMetadata> completedBuffers = vcam_->completedBuffers();
- for (V4L2FrameMetadata &fmd : completedBuffers) {
- struct v4l2_buffer &buf = buffers_[fmd.index()];
+ std::vector<V4L2Camera::Buffer> completedBuffers = vcam_->completedBuffers();
+ for (const V4L2Camera::Buffer &buffer : completedBuffers) {
+ const FrameMetadata &fmd = buffer.data;
+ struct v4l2_buffer &buf = buffers_[buffer.index];
- switch (fmd.status()) {
+ switch (fmd.status) {
case FrameMetadata::FrameSuccess:
- buf.bytesused = fmd.bytesused();
+ buf.bytesused = fmd.planes[0].bytesused;
buf.field = V4L2_FIELD_NONE;
- buf.timestamp.tv_sec = fmd.timestamp() / 1000000000;
- buf.timestamp.tv_usec = fmd.timestamp() % 1000000;
- buf.sequence = fmd.sequence();
+ buf.timestamp.tv_sec = fmd.timestamp / 1000000000;
+ buf.timestamp.tv_usec = fmd.timestamp % 1000000;
+ buf.sequence = fmd.sequence;
buf.flags |= V4L2_BUF_FLAG_DONE;
break;