v4l2object: handle unsupported hlg colorimetry gracefully

This patch addresses the issue where GStreamer would throw an error when
attempting to use bt2100-hlg colorimetry with V4L2, which is not
supported by the current V4L2 kernel. When bt2100-hlg colorimetry is set
from caps, the check for transfer (GST_VIDEO_TRANSFER_ARIB_STD_B67) is
bypassed.

The main improvement is to avoid checking the transfer value in
gst_v4l2_video_colorimetry_matches when it is
GST_VIDEO_TRANSFER_ARIB_STD_B67. This is because the transfer value in
the cinfo parameter comes from gst_v4l2_object_get_colorspace, which
converts the transfer to another value, causing a mismatch.

Since the kernel does not support GST_VIDEO_TRANSFER_ARIB_STD_B67,
gst_v4l2_object_get_colorspace cannot map it correctly from V4L2 to
GStreamer. Therefore, we ignore this check to prevent errors.

changes:
- Added a condition in gst_v4l2_video_colorimetry_matches to bypass the
  transfer check when the transfer is GST_VIDEO_TRANSFER_ARIB_STD_B67.
- Ensured that the pipeline does not throw errors due to unsupported
  bt2100-hlg colorimetry in V4L2.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7212>
This commit is contained in:
Qian Hu (胡骞) 2024-07-22 19:28:13 +08:00 committed by GStreamer Marge Bot
parent 0db6ce0f11
commit ddd00a9e1d

View file

@ -3756,6 +3756,18 @@ gst_v4l2_video_colorimetry_matches (const GstVideoColorimetry * cinfo,
&& gst_video_colorimetry_is_equal (cinfo, &ci_jpeg)) && gst_video_colorimetry_is_equal (cinfo, &ci_jpeg))
return TRUE; return TRUE;
/* bypass check the below GST_VIDEO_TRANSFER_ARIB_STD_B67 type,
* because kernel do not support it. GST_VIDEO_TRANSFER_ARIB_STD_B67 is cast
* to GST_VIDEO_TRANSFER_BT2020_12 type in gst_v4l2_object_get_colorspace */
if (info.colorimetry.transfer == GST_VIDEO_TRANSFER_ARIB_STD_B67) {
info.colorimetry.transfer = cinfo->transfer;
GST_WARNING
("v4l2 framework do not support GST_VIDEO_TRANSFER_ARIB_STD_B67");
if (gst_video_colorimetry_is_equal (&info.colorimetry, cinfo))
return TRUE;
}
/* bypass check the below transfer types, because those types are cast to /* 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 * 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 */ * type is cast to GST_VIDEO_TRANSFER_GAMMA10 type in gst_v4l2_object_get_colorspace */