Commit 4bcec1b1 authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2object: Fix colorimetry validation

While not documented, gst_video_colorimetry_matches() only accepts well
known names. Looking at the code and unit test, this seems to be on
purpose, so fixing by parsing the string and compating the colorimetry
structures.
parent ef633e28
...@@ -3424,10 +3424,13 @@ gst_v4l2_object_set_format_full (GstV4l2Object * v4l2object, GstCaps * caps, ...@@ -3424,10 +3424,13 @@ gst_v4l2_object_set_format_full (GstV4l2Object * v4l2object, GstCaps * caps,
gst_v4l2_object_get_colorspace (&format, &info.colorimetry); gst_v4l2_object_get_colorspace (&format, &info.colorimetry);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
if (gst_structure_has_field (s, "colorimetry") && if (gst_structure_has_field (s, "colorimetry")) {
!gst_video_colorimetry_matches (&info.colorimetry, GstVideoColorimetry ci;
gst_structure_get_string (s, "colorimetry"))) if (!gst_video_colorimetry_from_string (&ci,
goto invalid_colorimetry; gst_structure_get_string (s, "colorimetry"))
|| !gst_video_colorimetry_is_equal (&ci, &info.colorimetry))
goto invalid_colorimetry;
}
/* In case we have skipped the try_fmt probes, we'll need to set the /* In case we have skipped the try_fmt probes, we'll need to set the
* colorimetry and interlace-mode back into the caps. */ * colorimetry and interlace-mode back into the caps. */
......
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