summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-01 21:00:24 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-07 19:18:27 +0300
commit0f4d81c2bf40b1aba07dc5ef66aaa7484496eedf (patch)
treea7d71756889f717f4c2820ea63a332cf89fc53b3
parentc64f7eb5c038b00c875f77fef56d96f5d4e0866d (diff)
libcamera: v4l2_videodevice: Use utils::enumerate()
Replace a manual counter with the utils::enumerate() utility function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
-rw-r--r--src/libcamera/v4l2_videodevice.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
index 2e458fcc..281f3f13 100644
--- a/src/libcamera/v4l2_videodevice.cpp
+++ b/src/libcamera/v4l2_videodevice.cpp
@@ -1356,7 +1356,7 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
const FileDescriptor &fd = planes[0].fd;
size_t offset = 0;
- for (size_t i = 0; i < planes.size(); ++i) {
+ for (auto [i, plane] : utils::enumerate(planes)) {
/*
* The stride is reported by V4L2 for the first plane
* only. Compute the stride of the other planes by
@@ -1368,11 +1368,11 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
* formatInfo_->planes[i].bytesPerGroup
/ formatInfo_->planes[0].bytesPerGroup;
- planes[i].fd = fd;
- planes[i].offset = offset;
- planes[i].length = formatInfo_->planeSize(format_.size.height,
- i, stride);
- offset += planes[i].length;
+ plane.fd = fd;
+ plane.offset = offset;
+ plane.length = formatInfo_->planeSize(format_.size.height,
+ i, stride);
+ offset += plane.length;
}
}