[libcamera-devel] [RFC PATCH v1 12/12] libcamera: v4l2_videodevice: Use utils::enumerate()
Kieran Bingham
kieran.bingham at ideasonboard.com
Thu Sep 2 12:42:24 CEST 2021
On 02/09/2021 05:23, Laurent Pinchart wrote:
> Replace a manual counter with the utils::enumerate() utility function.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> src/libcamera/v4l2_videodevice.cpp | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp
> index b80b9038a914..8a7d847c060e 100644
> --- a/src/libcamera/v4l2_videodevice.cpp
> +++ b/src/libcamera/v4l2_videodevice.cpp
> @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)
> planes.resize(formatInfo_->numPlanes());
> const FileDescriptor &fd = planes[0].fd;
> size_t offset = 0;
> - for (size_t i = 0; i < planes.size(); ++i) {
> - planes[i].fd = fd;
> - planes[i].offset = offset;
> -
> + for (auto [i, plane] : utils::enumerate(planes)) {
> + plane.fd = fd;
> + plane.offset = offset;
> /* \todo Take the V4L2 stride into account */
Is this todo still valid ?
I don't think it's affected by this patch anyway though so:
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> - planes[i].length = formatInfo_->planeSize(format_.size, i);
> - offset += planes[i].length;
> + plane.length = formatInfo_->planeSize(format_.size, i);
> + offset += plane.length;
> }
> }
>
>
More information about the libcamera-devel
mailing list