v4l2object: Validate field in S/TRY_FMT

This is in preparation from removing the slow TRY_FMT probes for
interlacing. As we won't have tried that interlace-mode already
we need to validate that the driver isn't refusing it.

https://bugzilla.gnome.org/show_bug.cgi?id=785156
This commit is contained in:
Nicolas Dufresne 2017-07-19 21:56:14 -04:00
parent 81e5b0bdee
commit 336c8a7dad

View file

@ -3404,6 +3404,10 @@ gst_v4l2_object_set_format_full (GstV4l2Object * v4l2object, GstCaps * caps,
if (is_mplane && format.fmt.pix_mp.num_planes != n_v4l_planes)
goto invalid_planes;
if ((is_mplane && format.fmt.pix_mp.field != field)
|| format.fmt.pix.field != field)
goto invalid_field;
if (try_only) /* good enough for trying only */
return TRUE;
@ -3601,6 +3605,23 @@ invalid_planes:
}
return FALSE;
}
invalid_field:
{
enum v4l2_field wanted_field;
if (is_mplane)
wanted_field = format.fmt.pix_mp.field;
else
wanted_field = format.fmt.pix.field;
GST_V4L2_ERROR (error, RESOURCE, SETTINGS,
(_("Device '%s' does not support %s interlacing"),
v4l2object->videodev,
field == V4L2_FIELD_NONE ? "progressive" : "interleaved"),
("Device wants %s interlacing",
wanted_field == V4L2_FIELD_NONE ? "progressive" : "interleaved"));
return FALSE;
}
get_parm_failed:
{
/* it's possible that this call is not supported */