[FFmpeg-devel] [PATCH 2/2] avutil/hwcontext_videotoolbox: fix use of unknown builtin '__builtin_available'

lance.lmwang at gmail.com lance.lmwang at gmail.com
Tue Oct 19 17:52:29 EEST 2021


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)
         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:
-- 
1.8.3.1



More information about the ffmpeg-devel mailing list