Add guards around AV1 checks

This commit is contained in:
Cameron Gutman 2023-11-04 01:08:56 -05:00
parent ce25a66dc5
commit 75a7b9e477
2 changed files with 8 additions and 1 deletions

View File

@ -664,9 +664,11 @@ static NSMutableSet* hostList;
switch (streamSettings.preferredCodec) { switch (streamSettings.preferredCodec) {
case CODEC_PREF_AV1: case CODEC_PREF_AV1:
#if defined(__IPHONE_16_0) || defined(__TVOS_16_0)
if (VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) { if (VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN8; _streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN8;
} }
#endif
// Fall-through // Fall-through
case CODEC_PREF_AUTO: case CODEC_PREF_AUTO:
@ -691,11 +693,13 @@ static NSMutableSet* hostList;
} }
} }
#if defined(__IPHONE_16_0) || defined(__TVOS_16_0)
// Add the AV1 Main10 format if AV1 and HDR are both enabled and supported // Add the AV1 Main10 format if AV1 and HDR are both enabled and supported
if ((_streamConfig.supportedVideoFormats & VIDEO_FORMAT_MASK_AV1) && streamSettings.enableHdr && if ((_streamConfig.supportedVideoFormats & VIDEO_FORMAT_MASK_AV1) && streamSettings.enableHdr &&
VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1) && (AVPlayer.availableHDRModes & AVPlayerHDRModeHDR10) != 0) { VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1) && (AVPlayer.availableHDRModes & AVPlayerHDRModeHDR10) != 0) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10; _streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10;
} }
#endif
} }
- (void)appLongClicked:(TemporaryApp *)app view:(UIView *)view { - (void)appLongClicked:(TemporaryApp *)app view:(UIView *)view {

View File

@ -200,7 +200,10 @@ BOOL isCustomResolution(CGSize res) {
} }
// Disable codec selector segments for unsupported codecs // Disable codec selector segments for unsupported codecs
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) { #if defined(__IPHONE_16_0) || defined(__TVOS_16_0)
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1))
#endif
{
[self.codecSelector setEnabled:NO forSegmentAtIndex:2]; [self.codecSelector setEnabled:NO forSegmentAtIndex:2];
} }
if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) { if (!VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {