mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
v4l2object: Validate colorimetry in S/TRY_FMT
This is in preparation for removing slow TRY_FMT probes for colorimetry. As we won't have tried that colorimetry we cannot assume the driver will accept it. https://bugzilla.gnome.org/show_bug.cgi?id=785156
This commit is contained in:
parent
336c8a7dad
commit
558e9f4e57
1 changed files with 22 additions and 0 deletions
|
@ -3408,6 +3408,14 @@ gst_v4l2_object_set_format_full (GstV4l2Object * v4l2object, GstCaps * caps,
|
|||
|| format.fmt.pix.field != field)
|
||||
goto invalid_field;
|
||||
|
||||
gst_v4l2_object_get_colorspace (&format, &info.colorimetry);
|
||||
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
if (gst_structure_has_field (s, "colorimetry") &&
|
||||
!gst_video_colorimetry_matches (&info.colorimetry,
|
||||
gst_structure_get_string (s, "colorimetry")))
|
||||
goto invalid_colorimetry;
|
||||
|
||||
if (try_only) /* good enough for trying only */
|
||||
return TRUE;
|
||||
|
||||
|
@ -3622,6 +3630,20 @@ invalid_field:
|
|||
wanted_field == V4L2_FIELD_NONE ? "progressive" : "interleaved"));
|
||||
return FALSE;
|
||||
}
|
||||
invalid_colorimetry:
|
||||
{
|
||||
gchar *wanted_colorimetry;
|
||||
|
||||
wanted_colorimetry = gst_video_colorimetry_to_string (&info.colorimetry);
|
||||
|
||||
GST_V4L2_ERROR (error, RESOURCE, SETTINGS,
|
||||
(_("Device '%s' does not support %s colorimetry"),
|
||||
v4l2object->videodev, gst_structure_get_string (s, "colorimetry")),
|
||||
("Device wants %s colorimetry", wanted_colorimetry));
|
||||
|
||||
g_free (wanted_colorimetry);
|
||||
return FALSE;
|
||||
}
|
||||
get_parm_failed:
|
||||
{
|
||||
/* it's possible that this call is not supported */
|
||||
|
|
Loading…
Reference in a new issue