libcamera: v4l2_device: s_format: Return the device format
Return the device format actually applied to the device on setFormat(). Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
f7e75d9e70
commit
cbbc315fe9
1 changed files with 28 additions and 0 deletions
|
@ -289,6 +289,10 @@ int V4L2Device::getFormat(V4L2DeviceFormat *format)
|
|||
|
||||
/**
|
||||
* \brief Configure an image format on the V4L2 device
|
||||
*
|
||||
* Apply the supplied \a format to the device, and return the actually
|
||||
* applied format parameters, as \ref V4L2Device::getFormat would do.
|
||||
*
|
||||
* \return 0 for success, a negative error code otherwise
|
||||
*/
|
||||
int V4L2Device::setFormat(V4L2DeviceFormat *format)
|
||||
|
@ -340,6 +344,17 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return to caller the format actually applied on the device,
|
||||
* which might differ from the requested one.
|
||||
*/
|
||||
format->width = pix->width;
|
||||
format->height = pix->height;
|
||||
format->fourcc = pix->pixelformat;
|
||||
format->planesCount = 1;
|
||||
format->planes[0].bpl = pix->bytesperline;
|
||||
format->planes[0].size = pix->sizeimage;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -394,6 +409,19 @@ int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return to caller the format actually applied on the device,
|
||||
* which might differ from the requested one.
|
||||
*/
|
||||
format->width = pix->width;
|
||||
format->height = pix->height;
|
||||
format->fourcc = pix->pixelformat;
|
||||
format->planesCount = pix->num_planes;
|
||||
for (unsigned int i = 0; i < format->planesCount; ++i) {
|
||||
format->planes[i].bpl = pix->plane_fmt[i].bytesperline;
|
||||
format->planes[i].size = pix->plane_fmt[i].sizeimage;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue