v4l2object: Fix try/s_fmt errors

According to the spec,TRY_FMT cannot return EBUSY, though it can
return EINVAL if it was not possible to update the format to
something supported.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
This commit is contained in:
Nicolas Dufresne 2017-07-19 22:03:29 -04:00
parent 558e9f4e57
commit c00d4cae3c

View file

@ -3552,9 +3552,16 @@ invalid_caps:
}
try_fmt_failed:
{
if (errno == EBUSY) {
GST_V4L2_ERROR (error, RESOURCE, BUSY,
(_("Device '%s' is busy"), v4l2object->videodev),
if (errno == EINVAL) {
GST_V4L2_ERROR (error, RESOURCE, SETTINGS,
(_("Device '%s' has no supported format"), v4l2object->videodev),
("Call to TRY_FMT failed for %" GST_FOURCC_FORMAT " @ %dx%d: %s",
GST_FOURCC_ARGS (pixelformat), width, height,
g_strerror (errno)));
} else {
GST_V4L2_ERROR (error, RESOURCE, FAILED,
(_("Device '%s' failed during initialization"),
v4l2object->videodev),
("Call to TRY_FMT failed for %" GST_FOURCC_FORMAT " @ %dx%d: %s",
GST_FOURCC_ARGS (pixelformat), width, height,
g_strerror (errno)));
@ -3569,10 +3576,16 @@ set_fmt_failed:
("Call to S_FMT failed for %" GST_FOURCC_FORMAT " @ %dx%d: %s",
GST_FOURCC_ARGS (pixelformat), width, height,
g_strerror (errno)));
} else {
} else if (errno == EINVAL) {
GST_V4L2_ERROR (error, RESOURCE, SETTINGS,
(_("Device '%s' cannot capture at %dx%d"),
v4l2object->videodev, width, height),
(_("Device '%s' has no supported format"), v4l2object->videodev),
("Call to S_FMT failed for %" GST_FOURCC_FORMAT " @ %dx%d: %s",
GST_FOURCC_ARGS (pixelformat), width, height,
g_strerror (errno)));
} else {
GST_V4L2_ERROR (error, RESOURCE, FAILED,
(_("Device '%s' failed during initialization"),
v4l2object->videodev),
("Call to S_FMT failed for %" GST_FOURCC_FORMAT " @ %dx%d: %s",
GST_FOURCC_ARGS (pixelformat), width, height,
g_strerror (errno)));