summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Scally <dan.scally@ideasonboard.com>2022-09-05 11:32:15 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2022-11-17 23:35:33 +0000
commit309af54c6fcbd00350af4f60f84994fbbaf785f5 (patch)
treef96ccc20bd4db500e885f1e210ec728fbb5e72a5
parent2474ba2db603fe8ec0c8ef2055b3ceded99d3354 (diff)
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 <kieran.bingham@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
-rw-r--r--lib/v4l2.c1
1 files changed, 1 insertions, 0 deletions
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) {