[FFmpeg-devel] [PATCH 2/2] avutil/hwcontext_videotoolbox: fix use of unknown builtin '__builtin_available'
James Almer
jamrial at gmail.com
Sun Oct 31 15:32:53 EET 2021
On 10/19/2021 11:52 AM, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
>
> OSX version: 10.11.6
> Apple LLVM version 8.0.0 (clang-800.0.42.1)
> Target: x86_64-apple-darwin15.6.0
>
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
> libavutil/hwcontext_videotoolbox.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c
> index 58095a1..5794cab 100644
> --- a/libavutil/hwcontext_videotoolbox.c
> +++ b/libavutil/hwcontext_videotoolbox.c
> @@ -375,9 +375,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc,
> switch (src->colorspace) {
> case AVCOL_SPC_BT2020_CL:
> case AVCOL_SPC_BT2020_NCL:
> +#if __has_builtin(__builtin_available)
AV_HAS_BUILTIN(__builtin_available)
I know it's not necessary per se since this is an OSX only file, but it
will help grepping in the future if there needs to be a change to the macro.
> if (__builtin_available(macOS 10.11, *))
> colormatrix = kCVImageBufferYCbCrMatrix_ITU_R_2020;
> else
> +#endif
> colormatrix = CFSTR("ITU_R_2020");
> break;
> case AVCOL_SPC_BT470BG:
> @@ -398,9 +400,11 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc,
>
> switch (src->color_primaries) {
> case AVCOL_PRI_BT2020:
> +#if __has_builtin(__builtin_available)
> if (__builtin_available(macOS 10.11, *))
> colorpri = kCVImageBufferColorPrimaries_ITU_R_2020;
> else
> +#endif
> colorpri = CFSTR("ITU_R_2020");
> break;
> case AVCOL_PRI_BT709:
> @@ -420,16 +424,20 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc,
>
> switch (src->color_trc) {
> case AVCOL_TRC_SMPTE2084:
> +#if __has_builtin(__builtin_available)
> if (__builtin_available(macOS 10.13, *))
> colortrc = kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ;
> else
> +#endif
> colortrc = CFSTR("SMPTE_ST_2084_PQ");
> break;
> case AVCOL_TRC_BT2020_10:
> case AVCOL_TRC_BT2020_12:
> +#if __has_builtin(__builtin_available)
> if (__builtin_available(macOS 10.11, *))
> colortrc = kCVImageBufferTransferFunction_ITU_R_2020;
> else
> +#endif
> colortrc = CFSTR("ITU_R_2020");
> break;
> case AVCOL_TRC_BT709:
> @@ -439,15 +447,19 @@ static int vt_pixbuf_set_colorspace(AVHWFramesContext *hwfc,
> colortrc = kCVImageBufferTransferFunction_SMPTE_240M_1995;
> break;
> case AVCOL_TRC_SMPTE428:
> +#if __has_builtin(__builtin_available)
> if (__builtin_available(macOS 10.12, *))
> colortrc = kCVImageBufferTransferFunction_SMPTE_ST_428_1;
> else
> +#endif
> colortrc = CFSTR("SMPTE_ST_428_1");
> break;
> case AVCOL_TRC_ARIB_STD_B67:
> +#if __has_builtin(__builtin_available)
> if (__builtin_available(macOS 10.13, *))
> colortrc = kCVImageBufferTransferFunction_ITU_R_2100_HLG;
> else
> +#endif
> colortrc = CFSTR("ITU_R_2100_HLG");
> break;
> case AVCOL_TRC_GAMMA22:
>
More information about the ffmpeg-devel
mailing list