From 63ff99ca8e9332dab33dc4a157eb357fe0fee82a Mon Sep 17 00:00:00 2001 From: Elliot Chen Date: Mon, 21 Nov 2022 15:35:58 +0800 Subject: [PATCH] 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: --- .../gst-plugins-good/sys/v4l2/gstv4l2object.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c index 8899d1f1a2..ecaaaad160 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c @@ -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; }