Remove superfluous availability checks

This commit is contained in:
Cameron Gutman 2022-01-06 23:05:18 -06:00
parent 77d07c7c4d
commit 8302187dee

View File

@ -336,26 +336,13 @@ public:
int err; int err;
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) { if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
// Prior to 10.13, we'll just assume everything has
// H.264 support and fail open to allow VT decode.
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
if (__builtin_available(macOS 10.13, *)) {
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_H264)) { if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_H264)) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"No HW accelerated H.264 decode via VT"); "No HW accelerated H.264 decode via VT");
return false; return false;
} }
} }
else
#endif
{
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Assuming H.264 HW decode on < macOS 10.13");
}
}
else if (params->videoFormat & VIDEO_FORMAT_MASK_H265) { else if (params->videoFormat & VIDEO_FORMAT_MASK_H265) {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101300
if (__builtin_available(macOS 10.13, *)) {
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) { if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"No HW accelerated HEVC decode via VT"); "No HW accelerated HEVC decode via VT");
@ -366,8 +353,6 @@ public:
// simple API to check for Main10 hardware decoding, and if we don't // simple API to check for Main10 hardware decoding, and if we don't
// have it, we'll silently get software decoding with horrible performance. // have it, we'll silently get software decoding with horrible performance.
if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) { if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400
if (__builtin_available(macOS 10.14, *)) {
id<MTLDevice> device = MTLCreateSystemDefaultDevice(); id<MTLDevice> device = MTLCreateSystemDefaultDevice();
if (device == nullptr) { if (device == nullptr) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
@ -402,24 +387,6 @@ public:
[device release]; [device release];
} }
else
#endif
{
// Fail closed for HEVC Main10 if we're not on 10.14+
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"No HEVC Main10 support on < macOS 10.14");
return false;
}
}
}
else
#endif
{
// Fail closed for HEVC if we're not on 10.13+
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"No HEVC support on < macOS 10.13");
return false;
}
} }
SDL_SysWMinfo info; SDL_SysWMinfo info;