Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VideoToolbox] Add support for Xcode13 beta5. #12466

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/VideoToolbox/VTVideoEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,26 @@ static public VTVideoEncoder [] GetEncoderList ()
#endif
public bool SupportsFrameReordering { get; private set; }

#if !NET
[NoiOS, NoTV, MacCatalyst (15,0), NoMac, NoWatch]
#else
[UnsupportedOSPlatform ("ios")]
[UnsupportedOSPlatform ("tvos")]
[SupportedOSPlatform ("maccatalyst15.0")]
[UnsupportedOSPlatform ("macos")]
#endif
public bool SupportsMultiPass { get; private set; }

#if !NET
[iOS (15,0), TV (15,0), MacCatalyst (15,0), Mac (12,0), Watch (8,0)]
#else
[SupportedOSPlatform ("ios15.0")]
[SupportedOSPlatform ("tvos15.0")]
[SupportedOSPlatform ("maccatalyst15.0")]
[SupportedOSPlatform ("macos12.0")]
#endif
public bool IncludeStandardDefinitionDVEncoders { get; private set; }

internal VTVideoEncoder (NSDictionary dict)
{
CodecType = (dict [VTVideoEncoderList.CodecType] as NSNumber).Int32Value;
Expand Down Expand Up @@ -164,6 +184,22 @@ internal VTVideoEncoder (NSDictionary dict)
var sfr = dict [constant] as NSNumber;
SupportsFrameReordering = sfr == null ? true : sfr.BoolValue; // optional, default true
}

// added in xcode 13
constant = VTVideoEncoderList.IncludeStandardDefinitionDVEncoders;
if (constant != null) {
var includeDef = dict [constant] as NSNumber;
IncludeStandardDefinitionDVEncoders = includeDef == null ? false : includeDef.BoolValue; // optional, default false
}

#if __MACCATALYST__
constant = VTVideoEncoderList.SupportsMultiPass;
if (constant != null) {
var multiPass = dict [constant] as NSNumber;
SupportsMultiPass = multiPass == null ? false : multiPass.BoolValue; // optional, default false
}
#endif

}

#if NET
Expand Down
48 changes: 48 additions & 0 deletions src/videotoolbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,22 @@ interface VTCompressionPropertyKey {
[MacCatalyst (14,5)]
[Field ("kVTVideoEncoderSpecification_EnableLowLatencyRateControl")]
NSString EnableLowLatencyRateControl { get; }

[TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)]
[Field ("kVTCompressionPropertyKey_BaseLayerBitRateFraction")]
NSString BaseLayerBitRateFraction { get; }

[TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)]
[Field ("kVTCompressionPropertyKey_EnableLTR")]
NSString EnableLtr { get; }

[TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)]
[Field ("kVTCompressionPropertyKey_MaxAllowedFrameQP")]
NSString MaxAllowedFrameQP { get; }

[TV (15, 0), Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)]
[Field ("kVTCompressionPropertyKey_SupportsBaseFrameQP")]
NSString SupportsBaseFrameQP { get; }
}

[Mac (10,15), iOS (13,0), TV (13,0)]
Expand Down Expand Up @@ -485,6 +501,14 @@ interface VTProfileLevelKeys {
[Mac (10,9)]
NSString H264_High_AutoLevel { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("kVTProfileLevel_H264_ConstrainedBaseline_AutoLevel")]
NSString H264_ConstrainedBaseline_AutoLevel { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("kVTProfileLevel_H264_ConstrainedHigh_AutoLevel")]
NSString H264_ConstrainedHigh_AutoLevel { get; }

// MP4V

[Field ("kVTProfileLevel_MP4V_Simple_L0")]
Expand Down Expand Up @@ -608,6 +632,22 @@ interface VTEncodeFrameOptionKey {

[Field ("kVTEncodeFrameOptionKey_ForceKeyFrame")]
NSString ForceKeyFrame { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("kVTEncodeFrameOptionKey_AcknowledgedLTRTokens")]
NSString AcknowledgedLtrTokens { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("kVTEncodeFrameOptionKey_BaseFrameQP")]
NSString BaseFrameQP { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("kVTEncodeFrameOptionKey_ForceLTRRefresh")]
NSString ForceLtrRefresh { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("kVTSampleAttachmentKey_RequireLTRAcknowledgementToken")]
NSString RequireLtrAcknowledgementToken { get; }
}

[iOS (8,0), TV (10,2)]
Expand Down Expand Up @@ -1004,6 +1044,14 @@ interface VTVideoEncoderList {
[Field ("kVTVideoEncoderList_SupportsFrameReordering")]
NSString SupportsFrameReordering { get; }

[NoTV, NoMac, NoiOS, MacCatalyst (15,0)]
[Field ("kVTVideoEncoderList_SupportsMultiPass")]
NSString SupportsMultiPass { get; }

[TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)]
[Field ("kVTVideoEncoderListOption_IncludeStandardDefinitionDVEncoders")]
NSString IncludeStandardDefinitionDVEncoders { get; }

// VTVideoEncoder.cs should be updated when new constants are added here
// some are missing https://github.com/xamarin/xamarin-macios/issues/9904
}
Expand Down
12 changes: 0 additions & 12 deletions tests/xtro-sharpie/MacCatalyst-VideoToolbox.todo

This file was deleted.

11 changes: 0 additions & 11 deletions tests/xtro-sharpie/iOS-VideoToolbox.todo

This file was deleted.

11 changes: 0 additions & 11 deletions tests/xtro-sharpie/macOS-VideoToolbox.todo

This file was deleted.

11 changes: 0 additions & 11 deletions tests/xtro-sharpie/tvOS-VideoToolbox.todo

This file was deleted.