v4l2: bypass check some transfer types in colorimetry

v4l2 will report fail for some streams whose colorimetry value such as 2:4:8:3.
Can bypass check these transfer types in colorimetry to avoid error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3440>
This commit is contained in:
Elliot Chen 2022-11-21 15:35:58 +08:00 committed by GStreamer Marge Bot
parent 65e142c6ed
commit 63ff99ca8e

View file

@ -3494,6 +3494,18 @@ gst_v4l2_video_colorimetry_matches (const GstVideoColorimetry * cinfo,
&& gst_video_colorimetry_is_equal (cinfo, &ci_jpeg))
return TRUE;
/* bypass check the below transfer types, because those types are cast to
* V4L2_XFER_FUNC_NONE type when try format or set format and V4L2_XFER_FUNC_NONE
* type is cast to GST_VIDEO_TRANSFER_GAMMA10 type in gst_v4l2_object_get_colorspace */
if ((info.colorimetry.transfer == GST_VIDEO_TRANSFER_GAMMA18) ||
(info.colorimetry.transfer == GST_VIDEO_TRANSFER_GAMMA20) ||
(info.colorimetry.transfer == GST_VIDEO_TRANSFER_GAMMA22) ||
(info.colorimetry.transfer == GST_VIDEO_TRANSFER_GAMMA28)) {
info.colorimetry.transfer = GST_VIDEO_TRANSFER_GAMMA10;
if (gst_video_colorimetry_is_equal (&info.colorimetry, cinfo))
return TRUE;
}
return FALSE;
}