[FFmpeg-devel] [PATCH] lavc/videotoolboxenc.c: Add trc for iec61966-2-1 when available
Hao Guan
hguandl at gmail.com
Fri Jul 23 11:03:37 EEST 2021
Signed-off-by: Hao Guan <hguandl at gmail.com>
---
Notes:
I have checked out the code about other functions introduced after macOS 10.13 and noticed that the availability is checked during configure. Therefore I add the check for sRGB function too. It should compile now.
configure | 2 ++
libavcodec/videotoolboxenc.c | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/configure b/configure
index bb6b096414..644d9f3537 100755
--- a/configure
+++ b/configure
@@ -2325,6 +2325,7 @@ TYPES_LIST="
kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
kCVImageBufferTransferFunction_ITU_R_2100_HLG
kCVImageBufferTransferFunction_Linear
+ kCVImageBufferTransferFunction_sRGB
socklen_t
struct_addrinfo
struct_group_source_req
@@ -6278,6 +6279,7 @@ enabled videotoolbox && {
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
+ check_func_headers CoreVideo/CVImageBuffer.h kCVImageBufferTransferFunction_sRGB "-framework CoreVideo"
}
check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 4eaabed5d8..4cba781e9b 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -977,6 +977,11 @@ static int get_cv_transfer_function(AVCodecContext *avctx,
*transfer_fnc = kCVImageBufferTransferFunction_ITU_R_2100_HLG;
break;
#endif
+#if HAVE_KCVIMAGEBUFFERTRANSFERFUNCTION_SRGB
+ case AVCOL_TRC_IEC61966_2_1:
+ *transfer_fnc = kCVImageBufferTransferFunction_sRGB;
+ break;
+#endif
case AVCOL_TRC_GAMMA22:
gamma = 2.2;
--
2.30.1 (Apple Git-130)
More information about the ffmpeg-devel
mailing list