Commit 336c8a7d authored by Nicolas Dufresne's avatar Nicolas Dufresne

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
parent 81e5b0bd
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment