diff mbox series

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

Message ID 1634655149-14972-2-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] configure: add hls demuxer link dependencies
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Limin Wang Oct. 19, 2021, 2:52 p.m. UTC
From: Limin Wang <lance.lmwang@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@gmail.com>
---
 libavutil/hwcontext_videotoolbox.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

James Almer Oct. 31, 2021, 1:32 p.m. UTC | #1
On 10/19/2021 11:52 AM, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@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@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:
>
James Almer Oct. 31, 2021, 1:34 p.m. UTC | #2
On 10/31/2021 10:32 AM, James Almer wrote:
> On 10/19/2021 11:52 AM, lance.lmwang@gmail.com wrote:
>> From: Limin Wang <lance.lmwang@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@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.

Oh, nevermind, i missed the v2.
diff mbox series

Patch

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: