From ea61503742414511c458c83f54acd1d26b5ebce5 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Wed, 20 Mar 2024 09:17:17 +0100 Subject: [PATCH 11/16] videotoolbox: disable H.264 10-bit on Intel macOS, it's not decoded properly. Disable H.264 level 6.1 and 6.2 too, seems to have issue in some specific cases. --- libavcodec/videotoolbox.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index f4da80640d..634830b04c 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -915,6 +915,23 @@ static int videotoolbox_start(AVCodecContext *avctx) break; } +#if ARCH_X86_64 + if (avctx->codec_id == AV_CODEC_ID_H264 && + avctx->sw_pix_fmt == AV_PIX_FMT_YUV420P10) + { + // 10-bit H.264 is not supported on x86_64 + return AVERROR(ENOSYS); + } +#endif + + if (avctx->codec_id == AV_CODEC_ID_H264 && + (avctx->level == 61 || avctx->level == 62)) + { + // H.264 Level 6.1 and 6.2 can't be + // decoded properly + return AVERROR(ENOSYS); + } + #if defined(MAC_OS_X_VERSION_10_9) && !TARGET_OS_IPHONE && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9) && AV_HAS_BUILTIN(__builtin_available) if (avctx->codec_id == AV_CODEC_ID_PRORES) { if (__builtin_available(macOS 10.9, *)) { -- 2.39.3 (Apple Git-146)