From 309af54c6fcbd00350af4f60f84994fbbaf785f5 Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Mon, 5 Sep 2022 11:32:15 +0100 Subject: lib: v4l2: Set sizeimage during v4l2_set_format() videobuf2 relies on the sizeimage field to calculate buffer size when the format is MJPEG, because the bytes-per-line calculation is missing. Fill in that field as part of v4l2_set_format() so the API works correctly. Reviewed-by: Kieran Bingham Signed-off-by: Daniel Scally --- lib/v4l2.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/v4l2.c b/lib/v4l2.c index de6ed88..6702ece 100644 --- a/lib/v4l2.c +++ b/lib/v4l2.c @@ -487,6 +487,7 @@ int v4l2_set_format(struct v4l2_device *dev, struct v4l2_pix_format *format) fmt.fmt.pix.height = format->height; fmt.fmt.pix.pixelformat = format->pixelformat; fmt.fmt.pix.field = V4L2_FIELD_ANY; + fmt.fmt.pix.sizeimage = format->sizeimage; ret = ioctl(dev->fd, VIDIOC_S_FMT, &fmt); if (ret < 0) { -- cgit v1.2.3