v4l2object.c: add support for Apple's full-range bt709 colorspace variant

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2793>
This commit is contained in:
fduncanh 2022-07-24 23:44:10 -04:00
parent 2c1e61ea16
commit 197b72f32a

View file

@ -2443,6 +2443,20 @@ gst_v4l2_object_add_colorspace (GstV4l2Object * v4l2object, GstStructure * s,
if (colorspace == req_cspace) {
if (gst_v4l2_object_get_colorspace (v4l2object, &fmt, &cinfo))
gst_v4l2_object_fill_colorimetry_list (&list, &cinfo);
if (colorspace == V4L2_COLORSPACE_REC709) {
/* support for full-range variants of colorspaces V4L2_COLORSPACE_REC709
* (such as Apple's full-range bt709 variant 1:3:5:1) */
struct v4l2_format alt_fmt;
memcpy (&alt_fmt, &fmt, sizeof (alt_fmt));
if (V4L2_TYPE_IS_MULTIPLANAR (v4l2object->type))
alt_fmt.fmt.pix_mp.quantization = V4L2_QUANTIZATION_FULL_RANGE;
else
alt_fmt.fmt.pix.quantization = V4L2_QUANTIZATION_FULL_RANGE;
if (gst_v4l2_object_get_colorspace (v4l2object, &alt_fmt, &cinfo))
gst_v4l2_object_fill_colorimetry_list (&list, &cinfo);
}
}
}
}