summaryrefslogtreecommitdiff
path: root/sys/v4l2/gstv4l2object.c
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2017-07-21 23:34:59 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2017-07-21 23:34:59 -0400
commit4bcec1b190d0919b512065b53a74ccc95015b015 (patch)
tree1f121bea214270110832788e008493a8edb854c4 /sys/v4l2/gstv4l2object.c
parentef633e28f8f0465b7a5ad4a859b3176d2f7a9e96 (diff)
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.
Diffstat (limited to 'sys/v4l2/gstv4l2object.c')
-rw-r--r--sys/v4l2/gstv4l2object.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c
index 0658e7ca5..859925e6b 100644
--- a/sys/v4l2/gstv4l2object.c
+++ b/sys/v4l2/gstv4l2object.c
@@ -3424,10 +3424,13 @@ gst_v4l2_object_set_format_full (GstV4l2Object * v4l2object, GstCaps * caps,
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 (gst_structure_has_field (s, "colorimetry")) {
+ GstVideoColorimetry ci;
+ if (!gst_video_colorimetry_from_string (&ci,
+ 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
* colorimetry and interlace-mode back into the caps. */