feat: update supportedVideoFormats according to YUV444 setting

This commit is contained in:
Acaki
2025-02-20 00:09:16 +08:00
parent 5302f418db
commit c91c40e79f
4 changed files with 52 additions and 6 deletions
+20
View File
@@ -86,8 +86,12 @@ void DrStop(void)
{
case VIDEO_FORMAT_H264:
return @"H.264";
case VIDEO_FORMAT_H264_HIGH8_444:
return @"H.264 YUV444";
case VIDEO_FORMAT_H265:
return @"HEVC";
case VIDEO_FORMAT_H265_REXT8_444:
return @"HEVC YUV444";
case VIDEO_FORMAT_H265_MAIN10:
if (LiGetCurrentHostDisplayHdrMode()) {
return @"HEVC Main 10 HDR";
@@ -95,8 +99,17 @@ void DrStop(void)
else {
return @"HEVC Main 10 SDR";
}
case VIDEO_FORMAT_H265_REXT10_444:
if (LiGetCurrentHostDisplayHdrMode()) {
return @"HEVC Main 10 YUV444 HDR";
}
else {
return @"HEVC Main 10 YUV444 SDR";
}
case VIDEO_FORMAT_AV1_MAIN8:
return @"AV1";
case VIDEO_FORMAT_AV1_HIGH8_444:
return @"AV1 YUV444";
case VIDEO_FORMAT_AV1_MAIN10:
if (LiGetCurrentHostDisplayHdrMode()) {
return @"AV1 10-bit HDR";
@@ -104,6 +117,13 @@ void DrStop(void)
else {
return @"AV1 10-bit SDR";
}
case VIDEO_FORMAT_AV1_HIGH10_444:
if (LiGetCurrentHostDisplayHdrMode()) {
return @"AV1 10-bit YUV444 HDR";
}
else {
return @"AV1 10-bit YUV444 SDR";
}
default:
return @"UNKNOWN";
}
+1
View File
@@ -16,6 +16,7 @@
@property NSString* appName;
@property NSString* rtspSessionUrl;
@property int serverCodecModeSupport;
@property BOOL enableYUV444;
@property int width;
@property int height;
@property int frameRate;
+1 -1
View File
@@ -9,5 +9,5 @@
#import "StreamConfiguration.h"
@implementation StreamConfiguration
@synthesize host, httpsPort, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, appName, optimizeGameSettings, playAudioOnPC, swapABXYButtons, audioConfiguration, supportedVideoFormats, multiController, serverCert, rtspSessionUrl, serverCodecModeSupport;
@synthesize host, httpsPort, appID, width, height, frameRate, bitRate, riKeyId, riKey, gamepadMask, appName, optimizeGameSettings, playAudioOnPC, swapABXYButtons, audioConfiguration, supportedVideoFormats, multiController, serverCert, rtspSessionUrl, serverCodecModeSupport, enableYUV444;
@end
@@ -660,6 +660,7 @@ static NSMutableSet* hostList;
}
#endif
_streamConfig.enableYUV444 = streamSettings.enableYUV444;
_streamConfig.bitRate = [streamSettings.bitrate intValue];
_streamConfig.optimizeGameSettings = streamSettings.optimizeGames;
_streamConfig.playAudioOnPC = streamSettings.playAudioOnPC;
@@ -693,7 +694,12 @@ static NSMutableSet* hostList;
case CODEC_PREF_AV1:
#if defined(__IPHONE_16_0) || defined(__TVOS_16_0)
if (VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1)) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN8;
if (streamSettings.enableYUV444) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_HIGH8_444;
}
else {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN8;
}
}
#endif
// Fall-through
@@ -701,12 +707,21 @@ static NSMutableSet* hostList;
case CODEC_PREF_AUTO:
case CODEC_PREF_HEVC:
if (VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC)) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265;
if (streamSettings.enableYUV444) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265_REXT8_444;
}
else {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265;
}
}
// Fall-through
case CODEC_PREF_H264:
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H264;
if (streamSettings.enableYUV444) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H264_HIGH8_444;
} else {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H264;
}
break;
}
@@ -716,7 +731,12 @@ static NSMutableSet* hostList;
// HEVC Main10 is supported if the user wants it and the display supports it
if (streamSettings.enableHdr && (AVPlayer.availableHDRModes & AVPlayerHDRModeHDR10) != 0) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265_MAIN10;
if (streamSettings.enableYUV444) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265_REXT10_444;
}
else {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_H265_MAIN10;
}
}
}
@@ -724,7 +744,11 @@ static NSMutableSet* hostList;
// Add the AV1 Main10 format if AV1 and HDR are both enabled and supported
if ((_streamConfig.supportedVideoFormats & VIDEO_FORMAT_MASK_AV1) && streamSettings.enableHdr &&
VTIsHardwareDecodeSupported(kCMVideoCodecType_AV1) && (AVPlayer.availableHDRModes & AVPlayerHDRModeHDR10) != 0) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10;
if (streamSettings.enableYUV444) {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_HIGH10_444;
} else {
_streamConfig.supportedVideoFormats |= VIDEO_FORMAT_AV1_MAIN10;
}
}
#endif
}
@@ -947,6 +971,7 @@ static NSMutableSet* hostList;
[settingsViewController.optimizeSettingsSelector setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController.audioOnPCSelector setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController.codecSelector setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController.yuv444Selector setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController.hdrSelector setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController.framePacingSelector setEnabled:!self.settingsExpandedInStreamView];
[settingsViewController.btMouseSelector setEnabled:!self.settingsExpandedInStreamView];