From dbaca549abcf3bfd296867f488a8b7958d05107d Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 18 Oct 2018 22:23:31 -0400 Subject: [PATCH] v4l2object: Read driver selected interlace mode If there was no interlace-mode field in the caps. Read back the value selected by the driver. This way, if the driver does not support progressive, then it will automatically negotiate the returned mode unless this mode is not supported by GStreamer. This method was already used for colorimetry. Just like colorimetry, the interlace mode is not longer probed by v4l2src dues to performance issues. Fixes #511 --- sys/v4l2/gstv4l2object.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 8f8c23999..81e0ad2f1 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -3583,13 +3583,18 @@ 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) + /* used to check colorimetry and interlace mode fields presence */ + s = gst_caps_get_structure (caps, 0); + + if (!gst_v4l2_object_get_interlace_mode (format.fmt.pix.field, + &info.interlace_mode)) goto invalid_field; + if (gst_structure_has_field (s, "interlace-mode")) { + if (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")) { if (!gst_v4l2_video_colorimetry_matches (&info.colorimetry, gst_structure_get_string (s, "colorimetry"))) -- GitLab