diff options
author | rcombs <rcombs@rcombs.me> | 2021-12-18 06:46:32 -0600 |
---|---|---|
committer | rcombs <rcombs@rcombs.me> | 2021-12-22 18:43:34 -0600 |
commit | 5afc5661ac042f04111305c34020e9b0ff87400f (patch) | |
tree | 959917620f497e4d27fa803994b8fb2fd34d17fa /libavutil/hwcontext_videotoolbox.c | |
parent | b7e1ec7bda90f979e29f7e06dcd73b5e38ed3ac0 (diff) | |
download | ffmpeg-5afc5661ac042f04111305c34020e9b0ff87400f.tar.gz |
lavu/hwcontext_videotoolbox: use OS-provided mapping routines when available
Diffstat (limited to 'libavutil/hwcontext_videotoolbox.c')
-rw-r--r-- | libavutil/hwcontext_videotoolbox.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index eff5fdbef1..0a8dbe9f33 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -428,8 +428,12 @@ CFStringRef av_map_videotoolbox_color_matrix_from_av(enum AVColorSpace space) return kCVImageBufferYCbCrMatrix_ITU_R_709_2; case AVCOL_SPC_SMPTE240M: return kCVImageBufferYCbCrMatrix_SMPTE_240M_1995; - case AVCOL_SPC_UNSPECIFIED: default: +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG + if (__builtin_available(macOS 10.13, iOS 11, tvOS 11, watchOS 4, *)) + return CVYCbCrMatrixGetStringForIntegerCodePoint(space); +#endif + case AVCOL_SPC_UNSPECIFIED: return NULL; } } @@ -449,8 +453,12 @@ CFStringRef av_map_videotoolbox_color_primaries_from_av(enum AVColorPrimaries pr return kCVImageBufferColorPrimaries_SMPTE_C; case AVCOL_PRI_BT470BG: return kCVImageBufferColorPrimaries_EBU_3213; - case AVCOL_PRI_UNSPECIFIED: default: +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG + if (__builtin_available(macOS 10.13, iOS 11, tvOS 11, watchOS 4, *)) + return CVColorPrimariesGetStringForIntegerCodePoint(pri); +#endif + case AVCOL_PRI_UNSPECIFIED: return NULL; } } @@ -493,6 +501,10 @@ CFStringRef av_map_videotoolbox_color_trc_from_av(enum AVColorTransferCharacteri case AVCOL_TRC_GAMMA28: return kCVImageBufferTransferFunction_UseGamma; default: +#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_ITU_R_2100_HLG + if (__builtin_available(macOS 10.13, iOS 11, tvOS 11, watchOS 4, *)) + return CVTransferFunctionGetStringForIntegerCodePoint(trc); +#endif case AVCOL_TRC_UNSPECIFIED: return NULL; } |