[libcamera-devel,6/7] libcamera: v4l2_device: Set bytesperline in single plane S_FMT

Message ID 20190201154248.15006-7-jacopo@jmondi.org
State Accepted
Headers show
Series
  • libcamera: v4l2_device: Address comments for s/g_fmt
Related show

Commit Message

Jacopo Mondi Feb. 1, 2019, 3:42 p.m. UTC
The 'bytesperline' field of 'struct v4l2_pix_format' has to be set for
the single planar set format use case.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/v4l2_device.cpp | 1 +
 1 file changed, 1 insertion(+)

Comments

Laurent Pinchart Feb. 1, 2019, 10:38 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Fri, Feb 01, 2019 at 04:42:47PM +0100, Jacopo Mondi wrote:
> The 'bytesperline' field of 'struct v4l2_pix_format' has to be set for
> the single planar set format use case.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/libcamera/v4l2_device.cpp | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
> index b86a629..4d1f76b 100644
> --- a/src/libcamera/v4l2_device.cpp
> +++ b/src/libcamera/v4l2_device.cpp
> @@ -331,6 +331,7 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format)
>  	pix->width = format->width;
>  	pix->height = format->height;
>  	pix->pixelformat = format->fourcc;
> +	pix->bytesperline = format->planes[0].bpl;
>  
>  	ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Format);
>  	if (ret) {

Patch

diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index b86a629..4d1f76b 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -331,6 +331,7 @@  int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format)
 	pix->width = format->width;
 	pix->height = format->height;
 	pix->pixelformat = format->fourcc;
+	pix->bytesperline = format->planes[0].bpl;
 
 	ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Format);
 	if (ret) {