+ if (!have_colorimetry && in_colorimetry != NULL) {
+ if ((GST_VIDEO_INFO_IS_YUV (&out_info)
+ && GST_VIDEO_INFO_IS_YUV (&in_info))
+ || (GST_VIDEO_INFO_IS_RGB (&out_info)
+ && GST_VIDEO_INFO_IS_RGB (&in_info))
+ || (GST_VIDEO_INFO_IS_GRAY (&out_info)
+ && GST_VIDEO_INFO_IS_GRAY (&in_info))) {
+ /* Can transfer the colorimetry intact from the input if it has it */
+ gst_structure_set_value (out_caps_s, "colorimetry", in_colorimetry);
+ } else {
+ gchar *colorimetry_str;
+
+ /* Changing between YUV/RGB - forward primaries and transfer function, but use
+ * default range and matrix.
+ * the primaries is used for conversion between RGB and XYZ (CIE 1931 coordinate).
+ * the transfer function could be another reference (e.g., HDR)
+ */
+ out_info.colorimetry.primaries = in_info.colorimetry.primaries;
+ out_info.colorimetry.transfer = in_info.colorimetry.transfer;
+
+ colorimetry_str =
+ gst_video_colorimetry_to_string (&out_info.colorimetry);
+ gst_caps_set_simple (out_caps, "colorimetry", G_TYPE_STRING,
+ colorimetry_str, NULL);
+ g_free (colorimetry_str);
+ }
+ }