mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
gstreamer: Specify values for unspecified values
When the cicp values coming out of GStreamer are unspecified, replace them with the default cicp values for YUV video: 1/13/6. We still may end up with unspecified values inside the params, because GStreamer returns unspecified for primaries/tfs/matrices that aren't supported by cicp. See also https://github.com/AOMediaCodec/libavif/wiki/CICP#unspecified fora similar discussion.
This commit is contained in:
parent
da07f1221f
commit
cbe09373a5
@ -175,10 +175,23 @@ gtk_gst_color_state_from_colorimetry (GtkGstSink *self,
|
||||
GError *error = NULL;
|
||||
|
||||
params = gdk_cicp_params_new ();
|
||||
gdk_cicp_params_set_color_primaries (params, gst_video_color_primaries_to_iso (colorimetry->primaries));
|
||||
gdk_cicp_params_set_transfer_function (params, gst_video_transfer_function_to_iso (colorimetry->transfer));
|
||||
|
||||
if (colorimetry->primaries == GST_VIDEO_COLOR_PRIMARIES_UNKNOWN)
|
||||
gdk_cicp_params_set_color_primaries (params, 1);
|
||||
else
|
||||
gdk_cicp_params_set_color_primaries (params, gst_video_color_primaries_to_iso (colorimetry->primaries));
|
||||
|
||||
if (colorimetry->transfer == GST_VIDEO_TRANSFER_UNKNOWN)
|
||||
gdk_cicp_params_set_transfer_function (params, 13);
|
||||
else
|
||||
gdk_cicp_params_set_transfer_function (params, gst_video_transfer_function_to_iso (colorimetry->transfer));
|
||||
|
||||
#if 0
|
||||
gdk_cicp_params_set_matrix_coefficients (params, gst_video_color_matrix_to_iso (colorimetry->matrix));
|
||||
if (colorimetry->matrix == GST_VIDEO_COLOR_MATRIX_UNKNOWN)
|
||||
gdk_cicp_params_set_matrix_coefficients (params, 6);
|
||||
else
|
||||
gdk_cicp_params_set_matrix_coefficients (params, gst_video_color_matrix_to_iso (colorimetry->matrix));
|
||||
|
||||
gdk_cicp_params_set_range (params, colorimetry->range == GST_VIDEO_COLOR_RANGE_0_255 ? GDK_CICP_RANGE_FULL : GDK_CICP_RANGE_NARROW);
|
||||
#else
|
||||
gdk_cicp_params_set_matrix_coefficients (params, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user