camera: fix obtaining the current format

This commit is contained in:
Pierre Pronchery 2024-07-29 19:28:45 +02:00
parent ae0b7954b9
commit 809d06dc3e

View File

@ -1490,10 +1490,11 @@ static int _open_setup(Camera * camera)
_("Cropping not supported")); _("Cropping not supported"));
} }
/* obtain the current format */ /* obtain the current format */
camera->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if(_camera_ioctl(camera, VIDIOC_G_FMT, &camera->format) == -1) if(_camera_ioctl(camera, VIDIOC_G_FMT, &camera->format) == -1)
return -error_set_code(1, "%s: %s", camera->device, return -error_set_code(1, "%s: %s", camera->device,
_("Could not obtain the video capture format")); _("Could not obtain the video capture format"));
/* check the current format */ /* verify the current format */
if(camera->format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if(camera->format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -error_set_code(1, "%s: %s", camera->device, return -error_set_code(1, "%s: %s", camera->device,
_("Unsupported video capture type")); _("Unsupported video capture type"));