[vlc-devel] [PATCH] libvlc: cast between libvlc and vlc colorimetry to check values

Thomas Guillem thomas at gllm.fr
Mon May 13 14:14:41 CEST 2019


On Mon, May 13, 2019, at 14:07, Steve Lhomme wrote:
> Fixes many warnings

OK

> ---
>  lib/media_player.c | 45 +++++++++++++++++++++++++--------------------
>  1 file changed, 25 insertions(+), 20 deletions(-)
> 
> diff --git a/lib/media_player.c b/lib/media_player.c
> index fb18da1893..ccc163c2d0 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -2090,26 +2090,31 @@ int 
> libvlc_media_player_get_role(libvlc_media_player_t *mp)
>  
>  /* make sure surface structures from libvlc can be passed as such to 
> vlc
>     otherwise we will need wrappers between what libvlc understands and 
> what vlc uses */
> -
> -static_assert(libvlc_video_colorspace_BT601  == COLOR_SPACE_BT601 &&
> -              libvlc_video_colorspace_BT709  == COLOR_SPACE_BT709 &&
> -              libvlc_video_colorspace_BT2020 == COLOR_SPACE_BT2020
> +#define cast_  libvlc_video_color_space_t
> +static_assert(libvlc_video_colorspace_BT601  == 
> (cast_)COLOR_SPACE_BT601 &&
> +              libvlc_video_colorspace_BT709  == 
> (cast_)COLOR_SPACE_BT709 &&
> +              libvlc_video_colorspace_BT2020 == 
> (cast_)COLOR_SPACE_BT2020
>                , "libvlc video colorspace mismatch");
> -
> -static_assert(libvlc_video_transfer_func_LINEAR       == 
> TRANSFER_FUNC_LINEAR &&
> -              libvlc_video_transfer_func_SRGB         == 
> TRANSFER_FUNC_SRGB &&
> -              libvlc_video_transfer_func_BT470_BG     == 
> TRANSFER_FUNC_BT470_BG &&
> -              libvlc_video_transfer_func_BT470_M      == 
> TRANSFER_FUNC_BT470_M &&
> -              libvlc_video_transfer_func_BT709        == 
> TRANSFER_FUNC_BT709 &&
> -              libvlc_video_transfer_func_PQ           == 
> TRANSFER_FUNC_SMPTE_ST2084 &&
> -              libvlc_video_transfer_func_SMPTE_240    == 
> TRANSFER_FUNC_SMPTE_240 &&
> -              libvlc_video_transfer_func_HLG          == 
> TRANSFER_FUNC_HLG
> +#undef cast_
> +
> +#define cast_  libvlc_video_transfer_func_t
> +static_assert(libvlc_video_transfer_func_LINEAR       == 
> (cast_)TRANSFER_FUNC_LINEAR &&
> +              libvlc_video_transfer_func_SRGB         == 
> (cast_)TRANSFER_FUNC_SRGB &&
> +              libvlc_video_transfer_func_BT470_BG     == 
> (cast_)TRANSFER_FUNC_BT470_BG &&
> +              libvlc_video_transfer_func_BT470_M      == 
> (cast_)TRANSFER_FUNC_BT470_M &&
> +              libvlc_video_transfer_func_BT709        == 
> (cast_)TRANSFER_FUNC_BT709 &&
> +              libvlc_video_transfer_func_PQ           == 
> (cast_)TRANSFER_FUNC_SMPTE_ST2084 &&
> +              libvlc_video_transfer_func_SMPTE_240    == 
> (cast_)TRANSFER_FUNC_SMPTE_240 &&
> +              libvlc_video_transfer_func_HLG          == 
> (cast_)TRANSFER_FUNC_HLG
>                , "libvlc video transfer function mismatch");
> -
> -static_assert(libvlc_video_primaries_BT601_525 == 
> COLOR_PRIMARIES_BT601_525 &&
> -              libvlc_video_primaries_BT601_625 == 
> COLOR_PRIMARIES_BT601_625 &&
> -              libvlc_video_primaries_BT709     == 
> COLOR_PRIMARIES_BT709 &&
> -              libvlc_video_primaries_BT2020    == 
> COLOR_PRIMARIES_BT2020 &&
> -              libvlc_video_primaries_DCI_P3    == 
> COLOR_PRIMARIES_DCI_P3 &&
> -              libvlc_video_primaries_BT470_M   == 
> COLOR_PRIMARIES_BT470_M
> +#undef cast_
> +
> +#define cast_  libvlc_video_color_primaries_t
> +static_assert(libvlc_video_primaries_BT601_525 == 
> (cast_)COLOR_PRIMARIES_BT601_525 &&
> +              libvlc_video_primaries_BT601_625 == 
> (cast_)COLOR_PRIMARIES_BT601_625 &&
> +              libvlc_video_primaries_BT709     == 
> (cast_)COLOR_PRIMARIES_BT709 &&
> +              libvlc_video_primaries_BT2020    == 
> (cast_)COLOR_PRIMARIES_BT2020 &&
> +              libvlc_video_primaries_DCI_P3    == 
> (cast_)COLOR_PRIMARIES_DCI_P3 &&
> +              libvlc_video_primaries_BT470_M   == 
> (cast_)COLOR_PRIMARIES_BT470_M
>                , "libvlc video color primaries mismatch");
> +#undef cast_
> -- 
> 2.17.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list