Skip to content

Commit

Permalink
video: Rename gst_video_color_transfer_*() to gst_video_transfer_func…
Browse files Browse the repository at this point in the history
…tion_*() in new API

The type is called GstVideoTransferFunction so the function names should
match, otherwise gobject-introspection is keeping the functions as
global functions instead of methods on the type.

The same mistake was also made in lots of other APIs over the years, but
here we can at least fix it for 1.18 still.

Thanks to Marijn Suijten for noticing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/807>
  • Loading branch information
sdroege committed Sep 7, 2020
1 parent 24d939a commit 91ec4e0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions gst-libs/gst/video/video-color.c
Expand Up @@ -669,7 +669,7 @@ gst_video_color_matrix_to_iso (GstVideoColorMatrix matrix)
}

/**
* gst_video_color_transfer_to_iso:
* gst_video_transfer_function_to_iso:
* @func: a #GstVideoTransferFunction
*
* Converts #GstVideoTransferFunction to the "transfer characteristics"
Expand All @@ -682,7 +682,7 @@ gst_video_color_matrix_to_iso (GstVideoColorMatrix matrix)
* Since: 1.18
*/
guint
gst_video_color_transfer_to_iso (GstVideoTransferFunction func)
gst_video_transfer_function_to_iso (GstVideoTransferFunction func)
{
switch (func) {
case GST_VIDEO_TRANSFER_BT709:
Expand Down Expand Up @@ -804,7 +804,7 @@ gst_video_color_matrix_from_iso (guint value)
}

/**
* gst_video_color_transfer_from_iso:
* gst_video_transfer_function_from_iso:
* @value: a ITU-T H.273 transfer characteristics value
*
* Converts the @value to the #GstVideoTransferFunction
Expand All @@ -818,7 +818,7 @@ gst_video_color_matrix_from_iso (guint value)
* Since: 1.18
*/
GstVideoTransferFunction
gst_video_color_transfer_from_iso (guint value)
gst_video_transfer_function_from_iso (guint value)
{
switch (value) {
case 1:
Expand Down Expand Up @@ -918,7 +918,7 @@ map_equivalent_transfer (GstVideoTransferFunction func, guint bpp)
}

/**
* gst_video_color_transfer_is_equivalent:
* gst_video_transfer_function_is_equivalent:
* @from_func: #GstVideoTransferFunction to convert from
* @from_bpp: bits per pixel to convert from
* @to_func: #GstVideoTransferFunction to convert into
Expand All @@ -935,7 +935,7 @@ map_equivalent_transfer (GstVideoTransferFunction func, guint bpp)
* Since: 1.18
*/
gboolean
gst_video_color_transfer_is_equivalent (GstVideoTransferFunction from_func,
gst_video_transfer_function_is_equivalent (GstVideoTransferFunction from_func,
guint from_bpp, GstVideoTransferFunction to_func, guint to_bpp)
{
from_func = map_equivalent_transfer (from_func, from_bpp);
Expand Down
12 changes: 6 additions & 6 deletions gst-libs/gst/video/video-color.h
Expand Up @@ -275,7 +275,7 @@ GST_VIDEO_API
guint gst_video_color_matrix_to_iso (GstVideoColorMatrix matrix);

GST_VIDEO_API
guint gst_video_color_transfer_to_iso (GstVideoTransferFunction func);
guint gst_video_transfer_function_to_iso (GstVideoTransferFunction func);

GST_VIDEO_API
guint gst_video_color_primaries_to_iso (GstVideoColorPrimaries primaries);
Expand All @@ -284,16 +284,16 @@ GST_VIDEO_API
GstVideoColorMatrix gst_video_color_matrix_from_iso (guint value);

GST_VIDEO_API
GstVideoTransferFunction gst_video_color_transfer_from_iso (guint value);
GstVideoTransferFunction gst_video_transfer_function_from_iso (guint value);

GST_VIDEO_API
GstVideoColorPrimaries gst_video_color_primaries_from_iso (guint value);

GST_VIDEO_API
gboolean gst_video_color_transfer_is_equivalent (GstVideoTransferFunction from_func,
guint from_bpp,
GstVideoTransferFunction to_func,
guint to_bpp);
gboolean gst_video_transfer_function_is_equivalent (GstVideoTransferFunction from_func,
guint from_bpp,
GstVideoTransferFunction to_func,
guint to_bpp);

G_END_DECLS

Expand Down
2 changes: 1 addition & 1 deletion gst-libs/gst/video/video-converter.c
Expand Up @@ -6764,7 +6764,7 @@ video_converter_lookup_fastpath (GstVideoConverter * convert)

/* fastpaths don't do gamma */
if (CHECK_GAMMA_REMAP (convert) && (!same_size
|| !gst_video_color_transfer_is_equivalent (in_transf, in_bpp,
|| !gst_video_transfer_function_is_equivalent (in_transf, in_bpp,
out_transf, out_bpp)))
return FALSE;

Expand Down
6 changes: 3 additions & 3 deletions gst/videoconvert/gstvideoconvert.c
Expand Up @@ -459,9 +459,9 @@ gst_video_convert_set_info (GstVideoFilter * filter,
tmp_info = *in_info;
tmp_info.colorimetry.transfer = out_info->colorimetry.transfer;
if (gst_video_info_is_equal (&tmp_info, out_info)) {
if (gst_video_color_transfer_is_equivalent (in_info->colorimetry.transfer,
in_info->finfo->bits, out_info->colorimetry.transfer,
out_info->finfo->bits)) {
if (gst_video_transfer_function_is_equivalent (in_info->
colorimetry.transfer, in_info->finfo->bits,
out_info->colorimetry.transfer, out_info->finfo->bits)) {
gstbasetransform_class->passthrough_on_same_caps = FALSE;
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (filter), TRUE);
return TRUE;
Expand Down
4 changes: 2 additions & 2 deletions tests/check/libs/video.c
Expand Up @@ -3208,7 +3208,7 @@ GST_START_TEST (test_video_color_from_to_iso)
}

for (i = 0; i <= GST_VIDEO_TRANSFER_ARIB_STD_B67; i++) {
guint transfer_val = gst_video_color_transfer_to_iso (i);
guint transfer_val = gst_video_transfer_function_to_iso (i);

/* don't know how to map below values to spec. */
if (i == GST_VIDEO_TRANSFER_GAMMA18 || i == GST_VIDEO_TRANSFER_GAMMA20
Expand All @@ -3217,7 +3217,7 @@ GST_START_TEST (test_video_color_from_to_iso)
continue;
}

fail_unless_equals_int (gst_video_color_transfer_from_iso (transfer_val),
fail_unless_equals_int (gst_video_transfer_function_from_iso (transfer_val),
i);
}

Expand Down

0 comments on commit 91ec4e0

Please sign in to comment.