ffmpeg | branch: master | Marvin Scholz <epira...@gmail.com> | Tue Jul 9 16:46:47 2024 +0200| [2fc37c42391a38bfe0aea248f2fe75c9033f98e5] | committer: Zhao Zhili
avutil/hwcontext_videotoolbox: Fix build with older SDKs I've accidentally used API not available on the checked version. Additionally check for the SDK to be new enough to even have the CVImageBufferCreateColorSpaceFromAttachments API to not fail the build. Signed-off-by: Zhao Zhili <zhiliz...@tencent.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2fc37c42391a38bfe0aea248f2fe75c9033f98e5 --- libavutil/hwcontext_videotoolbox.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libavutil/hwcontext_videotoolbox.c b/libavutil/hwcontext_videotoolbox.c index dd89edfa08..ab7556936d 100644 --- a/libavutil/hwcontext_videotoolbox.c +++ b/libavutil/hwcontext_videotoolbox.c @@ -588,13 +588,26 @@ static int vt_pixbuf_set_colorspace(void *log_ctx, } else CVBufferRemoveAttachment(pixbuf, kCVImageBufferGammaLevelKey); - if (__builtin_available(macOS 12.0, iOS 15.0, *)) { - CFDictionaryRef attachments = CVBufferCopyAttachments(pixbuf, kCVAttachmentMode_ShouldPropagate); +#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MAX_ALLOWED >= 100800) || \ + (TARGET_OS_IOS && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000) + if (__builtin_available(macOS 10.8, iOS 10, *)) { + CFDictionaryRef attachments = NULL; + if (__builtin_available(macOS 12.0, iOS 15.0, *)) + attachments = CVBufferCopyAttachments(pixbuf, kCVAttachmentMode_ShouldPropagate); +#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED <= 120000) || \ + (TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED <= 150000) + else { + CFDictionaryRef tmp = CVBufferGetAttachments(pixbuf, kCVAttachmentMode_ShouldPropagate); + if (tmp) + attachments = CFDictionaryCreateCopy(NULL, tmp); + } +#endif if (attachments) { colorspace = CVImageBufferCreateColorSpaceFromAttachments(attachments); CFRelease(attachments); } } +#endif if (colorspace) { CVBufferSetAttachment(pixbuf, kCVImageBufferCGColorSpaceKey, _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".