diff --git a/src/CoreVideo/CVPixelBufferAttributes.cs b/src/CoreVideo/CVPixelBufferAttributes.cs index 9f7ba41d85ec..018e06afb5b8 100644 --- a/src/CoreVideo/CVPixelBufferAttributes.cs +++ b/src/CoreVideo/CVPixelBufferAttributes.cs @@ -71,6 +71,33 @@ public CVPixelFormatType? PixelFormatType { } } + /// The pixel formats of the pixel buffer. + /// + /// The property uses constant kCVPixelBufferPixelFormatTypeKey value to access the underlying dictionary. + public CVPixelFormatType []? PixelFormatTypes { + get { + var obj = GetNativeValue (CVPixelBuffer.PixelFormatTypeKey); + if (obj is null) { + return null; + } else if (obj is NSNumber number) { + return new CVPixelFormatType [] { (CVPixelFormatType) number.UInt32Value }; + } else if (obj is NSArray array) { + return Array.ConvertAll (array.ToArray (), (v) => (CVPixelFormatType) ((NSNumber) v).UInt32Value); + } else { + throw new InvalidOperationException ($"Unable to convert object of type {obj.GetType ()} into an array of CVPixelFormatType."); + } + } + set { + if (value is null) { + SetNumberValue (CVPixelBuffer.PixelFormatTypeKey, (uint?) null); + } else if (value.Length == 1) { + SetNumberValue (CVPixelBuffer.PixelFormatTypeKey, (uint?) value [0]); + } else { + SetArrayValue (CVPixelBuffer.PixelFormatTypeKey, Array.ConvertAll (value, (v) => new NSNumber ((uint) v))); + } + } + } + /// The allocator used for the pixel buffer. /// /// diff --git a/src/Foundation/NSIndexSet.cs b/src/Foundation/NSIndexSet.cs index 27f82b5484d5..c317c041a282 100644 --- a/src/Foundation/NSIndexSet.cs +++ b/src/Foundation/NSIndexSet.cs @@ -75,6 +75,24 @@ public nuint [] ToArray () return indexes; } + internal T [] ToInt64EnumArray () where T: System.Enum + { + var array = ToArray (); + var rv = new T [array.Length]; + for (var i = 0; i < array.Length; i++) + rv [i] = (T) (object) (long) array [i]; + return rv; + } + + internal HashSet ToInt64EnumHashSet () where T: System.Enum + { + var array = ToArray (); + var rv = new HashSet (); + for (var i = 0; i < array.Length; i++) + rv.Add ((T) (object) (long) array [i]); + return rv; + } + public static NSIndexSet FromArray (nuint [] items) { if (items is null) diff --git a/src/videotoolbox.cs b/src/videotoolbox.cs index 28c1300304c1..964287c91385 100644 --- a/src/videotoolbox.cs +++ b/src/videotoolbox.cs @@ -7,10 +7,13 @@ // Copyright 2014 Xamarin Inc // using System; +using System.Collections.Generic; using Foundation; using ObjCRuntime; using CoreMedia; using AVFoundation; +using CoreVideo; +using Metal; namespace VideoToolbox { @@ -2489,4 +2492,373 @@ interface VTSampleAttachmentQualityMetrics { // This can be either CFNumber or CFArray, so we have to bind it as NSObject NSString ChromaRedMeanSquaredError { get; } } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + interface VTFrameProcessor { + [Export ("startSessionWithConfiguration:error:")] + bool StartSession (IVTFrameProcessorConfiguration configuration, [NullAllowed] out NSError error); + + [Export ("processWithParameters:error:")] + bool Process (IVTFrameProcessorParameters parameters, [NullAllowed] out NSError error); + + [Export ("processWithParameters:completionHandler:")] + void Process (IVTFrameProcessorParameters parameters, VTFrameProcessorProcessHandler completionHandler); + + [Export ("processWithCommandBuffer:parameters:")] + void Process (IMTLCommandBuffer commandBuffer, IVTFrameProcessorParameters parameters); + + [Export ("endSession")] + void EndSession (); + } + + delegate void VTFrameProcessorProcessHandler (IVTFrameProcessorParameters parameters, [NullAllowed] NSError error); + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [Protocol (BackwardsCompatibleCodeGeneration = false)] + interface VTFrameProcessorConfiguration { + [Static, Abstract] + [Export ("processorSupported")] + bool ProcessorSupported { get; } + + [Abstract] + [Export ("frameSupportedPixelFormats")] + NSNumber [] WeakFrameSupportedPixelFormats { get; } + + CVPixelFormatType [] FrameSupportedPixelFormats { + [Wrap ("Array.ConvertAll (this.WeakFrameSupportedPixelFormats, (v) => (CVPixelFormatType) v.UInt32Value);")] + get; + } + + [Abstract] + [Export ("sourcePixelBufferAttributes")] + NSDictionary WeakSourcePixelBufferAttributes { get; } + + [Wrap ("WeakSourcePixelBufferAttributes")] + CVPixelBufferAttributes SourcePixelBufferAttributes { get; } + + [Abstract] + [Export ("destinationPixelBufferAttributes")] + NSDictionary WeakDestinationPixelBufferAttributes { get; } + + [Wrap ("WeakDestinationPixelBufferAttributes")] + CVPixelBufferAttributes DestinationPixelBufferAttributes { get; } + + [Export ("nextFrameCount")] + nint NextFrameCount { get; } + + [Export ("previousFrameCount")] + nint PreviousFrameCount { get; } + + [Static] + [Export ("maximumDimensions")] + CMVideoDimensions MaximumDimensions { get; } + + [Static] + [Export ("minimumDimensions")] + CMVideoDimensions MinimumDimensions { get; } + } + + interface IVTFrameProcessorConfiguration { } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] +#if !__MACCATALYST__ + [ErrorDomain ("VTFrameProcessorErrorDomain")] +#endif + [Native] + public enum VTFrameProcessorError : long { + UnknownError = -19730, + UnsupportedResolution = -19731, + SessionNotStarted = -19732, + SessionAlreadyActive = -19733, + FatalError = -19734, + SessionLevelError = -19735, + InitializationFailed = -19736, + UnsupportedInput = -19737, + MemoryAllocationFailure = -19738, + RevisionNotSupported = -19739, + ProcessingError = -19740, + InvalidParameterError = -19741, + InvalidFrameTiming = -19742 + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTFrameProcessorFrame { + [Export ("initWithBuffer:presentationTimeStamp:")] + NativeHandle Constructor (CVPixelBuffer buffer, CMTime presentationTimeStamp); + + [Export ("buffer")] + CVPixelBuffer Buffer { get; } + + [Export ("presentationTimeStamp")] + CMTime PresentationTimeStamp { get; } + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTFrameProcessorOpticalFlow { + [Export ("initWithForwardFlow:backwardFlow:")] + NativeHandle Constructor (CVPixelBuffer forwardFlow, CVPixelBuffer backwardFlow); + + [Export ("forwardFlow")] + CVPixelBuffer ForwardFlow { get; } + + [Export ("backwardFlow")] + CVPixelBuffer BackwardFlow { get; } + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [Protocol (BackwardsCompatibleCodeGeneration = false)] + interface VTFrameProcessorParameters { + [Abstract] + [Export ("sourceFrame")] + VTFrameProcessorFrame SourceFrame { get; } + } + + interface IVTFrameProcessorParameters { } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTFrameRateConversionConfigurationQualityPrioritization : long { + Normal = 1, + Quality = 2, + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTFrameRateConversionConfigurationRevision : long { + Revision1 = 1, + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTFrameRateConversionParametersSubmissionMode : long { + Random = 1, + Sequential = 2, + SequentialReferencesUnchanged = 3, + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTFrameRateConversionConfiguration : VTFrameProcessorConfiguration { + [Export ("initWithFrameWidth:frameHeight:usePrecomputedFlow:qualityPrioritization:revision:")] + NativeHandle Constructor (nint frameWidth, nint frameHeight, bool usePrecomputedFlow, VTFrameRateConversionConfigurationQualityPrioritization qualityPrioritization, VTFrameRateConversionConfigurationRevision revision); + + [Export ("frameWidth")] + nint FrameWidth { get; } + + [Export ("frameHeight")] + nint FrameHeight { get; } + + [Export ("usePrecomputedFlow")] + bool UsePrecomputedFlow { get; } + + [Export ("qualityPrioritization")] + VTFrameRateConversionConfigurationQualityPrioritization QualityPrioritization { get; } + + [Export ("revision")] + VTFrameRateConversionConfigurationRevision Revision { get; } + + [Static] + [Export ("supportedRevisions")] + NSIndexSet WeakSupportedRevisions { get; } + + [Static] + [Wrap ("WeakSupportedRevisions.ToInt64EnumHashSet ()")] + HashSet SupportedRevisions { get; } + + [Static] + [Export ("defaultRevision")] + VTFrameRateConversionConfigurationRevision DefaultRevision { get; } + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTFrameRateConversionParameters : VTFrameProcessorParameters { + [Export ("initWithSourceFrame:nextFrame:opticalFlow:interpolationPhase:submissionMode:destinationFrames:")] + NativeHandle Constructor (VTFrameProcessorFrame sourceFrame, VTFrameProcessorFrame nextFrame, [NullAllowed] VTFrameProcessorOpticalFlow opticalFlow, NSNumber [] interpolationPhase, VTFrameRateConversionParametersSubmissionMode submissionMode, VTFrameProcessorFrame [] destinationFrame); + + [Export ("sourceFrame")] + new VTFrameProcessorFrame SourceFrame { get; } + + [NullAllowed, Export ("nextFrame")] + VTFrameProcessorFrame NextFrame { get; } + + [NullAllowed, Export ("opticalFlow")] + VTFrameProcessorOpticalFlow OpticalFlow { get; } + + [BindAs (typeof (float []))] + [Export ("interpolationPhase")] + NSNumber [] InterpolationPhase { get; } + + [Export ("submissionMode")] + VTFrameRateConversionParametersSubmissionMode SubmissionMode { get; } + + [Export ("destinationFrames")] + VTFrameProcessorFrame [] DestinationFrames { get; } + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTMotionBlurConfigurationQualityPrioritization : long { + Normal = 1, + Quality = 2, + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTMotionBlurConfigurationRevision : long { + Revision1 = 1, + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTMotionBlurParametersSubmissionMode : long { + Random = 1, + Sequential = 2, + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTMotionBlurConfiguration : VTFrameProcessorConfiguration { + [Export ("initWithFrameWidth:frameHeight:usePrecomputedFlow:qualityPrioritization:revision:")] + NativeHandle Constructor (nint frameWidth, nint frameHeight, bool usePrecomputedFlow, VTMotionBlurConfigurationQualityPrioritization qualityPrioritization, VTMotionBlurConfigurationRevision revision); + + [Export ("frameWidth")] + nint FrameWidth { get; } + + [Export ("frameHeight")] + nint FrameHeight { get; } + + [Export ("usePrecomputedFlow")] + bool UsePrecomputedFlow { get; } + + [Export ("qualityPrioritization")] + VTMotionBlurConfigurationQualityPrioritization QualityPrioritization { get; } + + [Export ("revision")] + VTMotionBlurConfigurationRevision Revision { get; } + + [Static] + [Export ("supportedRevisions")] + NSIndexSet WeakSupportedRevisions { get; } + + [Static] + [Wrap ("WeakSupportedRevisions.ToInt64EnumHashSet ()")] + HashSet SupportedRevisions { get; } + + [Static] + [Export ("defaultRevision")] + VTMotionBlurConfigurationRevision DefaultRevision { get; } + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTMotionBlurParameters : VTFrameProcessorParameters { + [Export ("initWithSourceFrame:nextFrame:previousFrame:nextOpticalFlow:previousOpticalFlow:motionBlurStrength:submissionMode:destinationFrame:")] + NativeHandle Constructor (VTFrameProcessorFrame sourceFrame, [NullAllowed] VTFrameProcessorFrame nextFrame, [NullAllowed] VTFrameProcessorFrame previousFrame, [NullAllowed] VTFrameProcessorOpticalFlow nextOpticalFlow, [NullAllowed] VTFrameProcessorOpticalFlow previousOpticalFlow, nint motionBlurStrength, VTMotionBlurParametersSubmissionMode submissionMode, VTFrameProcessorFrame destinationFrame); + + [Export ("sourceFrame")] + new VTFrameProcessorFrame SourceFrame { get; } + + [NullAllowed, Export ("nextFrame")] + VTFrameProcessorFrame NextFrame { get; } + + [NullAllowed, Export ("previousFrame")] + VTFrameProcessorFrame PreviousFrame { get; } + + [NullAllowed, Export ("nextOpticalFlow")] + VTFrameProcessorOpticalFlow NextOpticalFlow { get; } + + [NullAllowed, Export ("previousOpticalFlow")] + VTFrameProcessorOpticalFlow PreviousOpticalFlow { get; } + + [Export ("motionBlurStrength")] + nint MotionBlurStrength { get; } + + [Export ("submissionMode")] + VTMotionBlurParametersSubmissionMode SubmissionMode { get; } + + [Export ("destinationFrame")] + VTFrameProcessorFrame DestinationFrame { get; } + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTOpticalFlowConfigurationQualityPrioritization : long { + Normal = 1, + Quality = 2, + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTOpticalFlowConfigurationRevision : long { + Revision1 = 1, + } + + [MacCatalyst (18, 4), NoTV, NoiOS, Mac (15, 4)] + [Native] + public enum VTOpticalFlowParametersSubmissionMode : long { + Random = 1, + Sequential = 2, + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTOpticalFlowConfiguration : VTFrameProcessorConfiguration { + [Export ("initWithFrameWidth:frameHeight:qualityPrioritization:revision:")] + NativeHandle Constructor (nint frameWidth, nint frameHeight, VTOpticalFlowConfigurationQualityPrioritization qualityPrioritization, VTOpticalFlowConfigurationRevision revision); + + [Export ("frameWidth")] + nint FrameWidth { get; } + + [Export ("frameHeight")] + nint FrameHeight { get; } + + [Export ("qualityPrioritization")] + VTOpticalFlowConfigurationQualityPrioritization QualityPrioritization { get; } + + [Export ("revision")] + VTOpticalFlowConfigurationRevision Revision { get; } + + [Static] + [Export ("supportedRevisions")] + NSIndexSet WeakSupportedRevisions { get; } + + [Static] + [Wrap ("WeakSupportedRevisions.ToInt64EnumHashSet ()")] + HashSet SupportedRevisions { get; } + + [Static] + [Export ("defaultRevision")] + VTOpticalFlowConfigurationRevision DefaultRevision { get; } + } + + [NoMacCatalyst, NoTV, NoiOS, Mac (15, 4)] + [BaseType (typeof (NSObject))] + [DisableDefaultCtor] + interface VTOpticalFlowParameters : VTFrameProcessorParameters { + [Export ("initWithSourceFrame:nextFrame:submissionMode:destinationOpticalFlow:")] + NativeHandle Constructor (VTFrameProcessorFrame sourceFrame, VTFrameProcessorFrame nextFrame, VTOpticalFlowParametersSubmissionMode submissionMode, VTFrameProcessorOpticalFlow destinationOpticalFlow); + + [Export ("sourceFrame")] + new VTFrameProcessorFrame SourceFrame { get; } + + [Export ("nextFrame")] + VTFrameProcessorFrame NextFrame { get; } + + [Export ("submissionMode")] + VTOpticalFlowParametersSubmissionMode SubmissionMode { get; } + + [Export ("destinationOpticalFlow")] + VTFrameProcessorOpticalFlow DestinationOpticalFlow { get; } + } } diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 0b205888701e..1f1735790fb0 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -12823,7 +12823,36 @@ F:VideoToolbox.HdrMetadataInsertionMode.None F:VideoToolbox.VTAlphaChannelMode.PremultipliedAlpha F:VideoToolbox.VTAlphaChannelMode.StraightAlpha F:VideoToolbox.VTDecodeInfoFlags.SkippedLeadingFrameDropped +F:VideoToolbox.VTFrameProcessorError.FatalError +F:VideoToolbox.VTFrameProcessorError.InitializationFailed +F:VideoToolbox.VTFrameProcessorError.InvalidFrameTiming +F:VideoToolbox.VTFrameProcessorError.InvalidParameterError +F:VideoToolbox.VTFrameProcessorError.MemoryAllocationFailure +F:VideoToolbox.VTFrameProcessorError.ProcessingError +F:VideoToolbox.VTFrameProcessorError.RevisionNotSupported +F:VideoToolbox.VTFrameProcessorError.SessionAlreadyActive +F:VideoToolbox.VTFrameProcessorError.SessionLevelError +F:VideoToolbox.VTFrameProcessorError.SessionNotStarted +F:VideoToolbox.VTFrameProcessorError.UnknownError +F:VideoToolbox.VTFrameProcessorError.UnsupportedInput +F:VideoToolbox.VTFrameProcessorError.UnsupportedResolution +F:VideoToolbox.VTFrameRateConversionConfigurationQualityPrioritization.Normal +F:VideoToolbox.VTFrameRateConversionConfigurationQualityPrioritization.Quality +F:VideoToolbox.VTFrameRateConversionConfigurationRevision.Revision1 +F:VideoToolbox.VTFrameRateConversionParametersSubmissionMode.Random +F:VideoToolbox.VTFrameRateConversionParametersSubmissionMode.Sequential +F:VideoToolbox.VTFrameRateConversionParametersSubmissionMode.SequentialReferencesUnchanged F:VideoToolbox.VTHdrPerFrameMetadataGenerationHdrFormatType.DolbyVision +F:VideoToolbox.VTMotionBlurConfigurationQualityPrioritization.Normal +F:VideoToolbox.VTMotionBlurConfigurationQualityPrioritization.Quality +F:VideoToolbox.VTMotionBlurConfigurationRevision.Revision1 +F:VideoToolbox.VTMotionBlurParametersSubmissionMode.Random +F:VideoToolbox.VTMotionBlurParametersSubmissionMode.Sequential +F:VideoToolbox.VTOpticalFlowConfigurationQualityPrioritization.Normal +F:VideoToolbox.VTOpticalFlowConfigurationQualityPrioritization.Quality +F:VideoToolbox.VTOpticalFlowConfigurationRevision.Revision1 +F:VideoToolbox.VTOpticalFlowParametersSubmissionMode.Random +F:VideoToolbox.VTOpticalFlowParametersSubmissionMode.Sequential F:VideoToolbox.VTQPModulationLevel.Default F:VideoToolbox.VTQPModulationLevel.Disable F:VideoToolbox.VTRotation.ClockwiseNinety @@ -39469,6 +39498,9 @@ M:VideoSubscriberAccount.VSUserAccountManager.QueryUserAccounts(VideoSubscriberA M:VideoSubscriberAccount.VSUserAccountManager.QueryUserAccountsAsync(VideoSubscriberAccount.VSUserAccountQueryOptions) M:VideoSubscriberAccount.VSUserAccountManager.UpdateUserAccount(VideoSubscriberAccount.VSUserAccount,System.Action{Foundation.NSError}) M:VideoSubscriberAccount.VSUserAccountManager.UpdateUserAccountAsync(VideoSubscriberAccount.VSUserAccount) +M:VideoToolbox.IVTFrameProcessorConfiguration.GetMaximumDimensions``1 +M:VideoToolbox.IVTFrameProcessorConfiguration.GetMinimumDimensions``1 +M:VideoToolbox.IVTFrameProcessorConfiguration.GetProcessorSupported``1 M:VideoToolbox.VTCompressionProperties.#ctor M:VideoToolbox.VTCompressionProperties.#ctor(Foundation.NSDictionary) M:VideoToolbox.VTCompressionSession.BeginPass(VideoToolbox.VTCompressionSessionOptionFlags) @@ -39502,6 +39534,15 @@ M:VideoToolbox.VTDecompressionSession.SetDecompressionProperties(VideoToolbox.VT M:VideoToolbox.VTDecompressionSession.WaitForAsynchronousFrames M:VideoToolbox.VTEncodeFrameOptions.#ctor M:VideoToolbox.VTEncodeFrameOptions.#ctor(Foundation.NSDictionary) +M:VideoToolbox.VTFrameProcessor.EndSession +M:VideoToolbox.VTFrameProcessor.Process(Metal.IMTLCommandBuffer,VideoToolbox.IVTFrameProcessorParameters) +M:VideoToolbox.VTFrameProcessor.Process(VideoToolbox.IVTFrameProcessorParameters,Foundation.NSError@) +M:VideoToolbox.VTFrameProcessor.Process(VideoToolbox.IVTFrameProcessorParameters,VideoToolbox.VTFrameProcessorProcessHandler) +M:VideoToolbox.VTFrameProcessor.StartSession(VideoToolbox.IVTFrameProcessorConfiguration,Foundation.NSError@) +M:VideoToolbox.VTFrameProcessorFrame.#ctor(CoreVideo.CVPixelBuffer,CoreMedia.CMTime) +M:VideoToolbox.VTFrameProcessorOpticalFlow.#ctor(CoreVideo.CVPixelBuffer,CoreVideo.CVPixelBuffer) +M:VideoToolbox.VTFrameRateConversionConfiguration.#ctor(System.IntPtr,System.IntPtr,System.Boolean,VideoToolbox.VTFrameRateConversionConfigurationQualityPrioritization,VideoToolbox.VTFrameRateConversionConfigurationRevision) +M:VideoToolbox.VTFrameRateConversionParameters.#ctor(VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTFrameProcessorOpticalFlow,Foundation.NSNumber[],VideoToolbox.VTFrameRateConversionParametersSubmissionMode,VideoToolbox.VTFrameProcessorFrame[]) M:VideoToolbox.VTFrameSilo.AddSampleBuffer(CoreMedia.CMSampleBuffer) M:VideoToolbox.VTFrameSilo.Create(Foundation.NSUrl,System.Nullable{CoreMedia.CMTimeRange}) M:VideoToolbox.VTFrameSilo.ForEach(System.Func{CoreMedia.CMSampleBuffer,VideoToolbox.VTStatus},System.Nullable{CoreMedia.CMTimeRange}) @@ -39510,12 +39551,16 @@ M:VideoToolbox.VTFrameSilo.SetTimeRangesForNextPass(CoreMedia.CMTimeRange[]) M:VideoToolbox.VTHdrPerFrameMetadataGenerationOptions.#ctor M:VideoToolbox.VTHdrPerFrameMetadataGenerationOptions.#ctor(Foundation.NSDictionary) M:VideoToolbox.VTHdrPerFrameMetadataGenerationSession.#ctor(ObjCRuntime.NativeHandle,System.Boolean) +M:VideoToolbox.VTMotionBlurConfiguration.#ctor(System.IntPtr,System.IntPtr,System.Boolean,VideoToolbox.VTMotionBlurConfigurationQualityPrioritization,VideoToolbox.VTMotionBlurConfigurationRevision) +M:VideoToolbox.VTMotionBlurParameters.#ctor(VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTFrameProcessorOpticalFlow,VideoToolbox.VTFrameProcessorOpticalFlow,System.IntPtr,VideoToolbox.VTMotionBlurParametersSubmissionMode,VideoToolbox.VTFrameProcessorFrame) M:VideoToolbox.VTMultiPassStorage.Close M:VideoToolbox.VTMultiPassStorage.Create(Foundation.NSUrl,System.Nullable{CoreMedia.CMTimeRange},Foundation.NSDictionary) M:VideoToolbox.VTMultiPassStorage.Create(VideoToolbox.VTMultiPassStorageCreationOptions,Foundation.NSUrl,System.Nullable{CoreMedia.CMTimeRange}) M:VideoToolbox.VTMultiPassStorage.Dispose(System.Boolean) M:VideoToolbox.VTMultiPassStorageCreationOptions.#ctor M:VideoToolbox.VTMultiPassStorageCreationOptions.#ctor(Foundation.NSDictionary) +M:VideoToolbox.VTOpticalFlowConfiguration.#ctor(System.IntPtr,System.IntPtr,VideoToolbox.VTOpticalFlowConfigurationQualityPrioritization,VideoToolbox.VTOpticalFlowConfigurationRevision) +M:VideoToolbox.VTOpticalFlowParameters.#ctor(VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTOpticalFlowParametersSubmissionMode,VideoToolbox.VTFrameProcessorOpticalFlow) M:VideoToolbox.VTPixelRotationProperties.#ctor M:VideoToolbox.VTPixelRotationProperties.#ctor(Foundation.NSDictionary) M:VideoToolbox.VTPixelRotationSession.Create @@ -54195,6 +54240,12 @@ P:VideoSubscriberAccount.VSUserAccount.SubscriptionBillingCycleEndDate P:VideoSubscriberAccount.VSUserAccount.TierIdentifiers P:VideoSubscriberAccount.VSUserAccount.UpdateUrl P:VideoSubscriberAccount.VSUserAccountManager.SharedUserAccountManager +P:VideoToolbox.IVTFrameProcessorConfiguration.NextFrameCount +P:VideoToolbox.IVTFrameProcessorConfiguration.PreviousFrameCount +P:VideoToolbox.IVTFrameProcessorConfiguration.WeakDestinationPixelBufferAttributes +P:VideoToolbox.IVTFrameProcessorConfiguration.WeakFrameSupportedPixelFormats +P:VideoToolbox.IVTFrameProcessorConfiguration.WeakSourcePixelBufferAttributes +P:VideoToolbox.IVTFrameProcessorParameters.SourceFrame P:VideoToolbox.VTCompressionProperties.AlphaChannelMode P:VideoToolbox.VTCompressionProperties.BaseLayerBitRateFraction P:VideoToolbox.VTCompressionProperties.CalculateMeanSquaredError @@ -54296,8 +54347,86 @@ P:VideoToolbox.VTExtensionPropertiesKey.ContainingBundleUrl P:VideoToolbox.VTExtensionPropertiesKey.ExtensionIdentifier P:VideoToolbox.VTExtensionPropertiesKey.ExtensionName P:VideoToolbox.VTExtensionPropertiesKey.ExtensionUrl +P:VideoToolbox.VTFrameProcessorFrame.Buffer +P:VideoToolbox.VTFrameProcessorFrame.PresentationTimeStamp +P:VideoToolbox.VTFrameProcessorOpticalFlow.BackwardFlow +P:VideoToolbox.VTFrameProcessorOpticalFlow.ForwardFlow +P:VideoToolbox.VTFrameRateConversionConfiguration.DefaultRevision +P:VideoToolbox.VTFrameRateConversionConfiguration.DestinationPixelBufferAttributes +P:VideoToolbox.VTFrameRateConversionConfiguration.FrameHeight +P:VideoToolbox.VTFrameRateConversionConfiguration.FrameSupportedPixelFormats +P:VideoToolbox.VTFrameRateConversionConfiguration.FrameWidth +P:VideoToolbox.VTFrameRateConversionConfiguration.MaximumDimensions +P:VideoToolbox.VTFrameRateConversionConfiguration.MinimumDimensions +P:VideoToolbox.VTFrameRateConversionConfiguration.NextFrameCount +P:VideoToolbox.VTFrameRateConversionConfiguration.PreviousFrameCount +P:VideoToolbox.VTFrameRateConversionConfiguration.ProcessorSupported +P:VideoToolbox.VTFrameRateConversionConfiguration.QualityPrioritization +P:VideoToolbox.VTFrameRateConversionConfiguration.Revision +P:VideoToolbox.VTFrameRateConversionConfiguration.SourcePixelBufferAttributes +P:VideoToolbox.VTFrameRateConversionConfiguration.SupportedRevisions +P:VideoToolbox.VTFrameRateConversionConfiguration.UsePrecomputedFlow +P:VideoToolbox.VTFrameRateConversionConfiguration.WeakDestinationPixelBufferAttributes +P:VideoToolbox.VTFrameRateConversionConfiguration.WeakFrameSupportedPixelFormats +P:VideoToolbox.VTFrameRateConversionConfiguration.WeakSourcePixelBufferAttributes +P:VideoToolbox.VTFrameRateConversionConfiguration.WeakSupportedRevisions +P:VideoToolbox.VTFrameRateConversionParameters.DestinationFrames +P:VideoToolbox.VTFrameRateConversionParameters.InterpolationPhase +P:VideoToolbox.VTFrameRateConversionParameters.NextFrame +P:VideoToolbox.VTFrameRateConversionParameters.OpticalFlow +P:VideoToolbox.VTFrameRateConversionParameters.SourceFrame +P:VideoToolbox.VTFrameRateConversionParameters.SubmissionMode P:VideoToolbox.VTHdrPerFrameMetadataGenerationOptions.HdrFormats P:VideoToolbox.VTHdrPerFrameMetadataGenerationOptionsKey.HdrFormats +P:VideoToolbox.VTMotionBlurConfiguration.DefaultRevision +P:VideoToolbox.VTMotionBlurConfiguration.DestinationPixelBufferAttributes +P:VideoToolbox.VTMotionBlurConfiguration.FrameHeight +P:VideoToolbox.VTMotionBlurConfiguration.FrameSupportedPixelFormats +P:VideoToolbox.VTMotionBlurConfiguration.FrameWidth +P:VideoToolbox.VTMotionBlurConfiguration.MaximumDimensions +P:VideoToolbox.VTMotionBlurConfiguration.MinimumDimensions +P:VideoToolbox.VTMotionBlurConfiguration.NextFrameCount +P:VideoToolbox.VTMotionBlurConfiguration.PreviousFrameCount +P:VideoToolbox.VTMotionBlurConfiguration.ProcessorSupported +P:VideoToolbox.VTMotionBlurConfiguration.QualityPrioritization +P:VideoToolbox.VTMotionBlurConfiguration.Revision +P:VideoToolbox.VTMotionBlurConfiguration.SourcePixelBufferAttributes +P:VideoToolbox.VTMotionBlurConfiguration.SupportedRevisions +P:VideoToolbox.VTMotionBlurConfiguration.UsePrecomputedFlow +P:VideoToolbox.VTMotionBlurConfiguration.WeakDestinationPixelBufferAttributes +P:VideoToolbox.VTMotionBlurConfiguration.WeakFrameSupportedPixelFormats +P:VideoToolbox.VTMotionBlurConfiguration.WeakSourcePixelBufferAttributes +P:VideoToolbox.VTMotionBlurConfiguration.WeakSupportedRevisions +P:VideoToolbox.VTMotionBlurParameters.DestinationFrame +P:VideoToolbox.VTMotionBlurParameters.MotionBlurStrength +P:VideoToolbox.VTMotionBlurParameters.NextFrame +P:VideoToolbox.VTMotionBlurParameters.NextOpticalFlow +P:VideoToolbox.VTMotionBlurParameters.PreviousFrame +P:VideoToolbox.VTMotionBlurParameters.PreviousOpticalFlow +P:VideoToolbox.VTMotionBlurParameters.SourceFrame +P:VideoToolbox.VTMotionBlurParameters.SubmissionMode +P:VideoToolbox.VTOpticalFlowConfiguration.DefaultRevision +P:VideoToolbox.VTOpticalFlowConfiguration.DestinationPixelBufferAttributes +P:VideoToolbox.VTOpticalFlowConfiguration.FrameHeight +P:VideoToolbox.VTOpticalFlowConfiguration.FrameSupportedPixelFormats +P:VideoToolbox.VTOpticalFlowConfiguration.FrameWidth +P:VideoToolbox.VTOpticalFlowConfiguration.MaximumDimensions +P:VideoToolbox.VTOpticalFlowConfiguration.MinimumDimensions +P:VideoToolbox.VTOpticalFlowConfiguration.NextFrameCount +P:VideoToolbox.VTOpticalFlowConfiguration.PreviousFrameCount +P:VideoToolbox.VTOpticalFlowConfiguration.ProcessorSupported +P:VideoToolbox.VTOpticalFlowConfiguration.QualityPrioritization +P:VideoToolbox.VTOpticalFlowConfiguration.Revision +P:VideoToolbox.VTOpticalFlowConfiguration.SourcePixelBufferAttributes +P:VideoToolbox.VTOpticalFlowConfiguration.SupportedRevisions +P:VideoToolbox.VTOpticalFlowConfiguration.WeakDestinationPixelBufferAttributes +P:VideoToolbox.VTOpticalFlowConfiguration.WeakFrameSupportedPixelFormats +P:VideoToolbox.VTOpticalFlowConfiguration.WeakSourcePixelBufferAttributes +P:VideoToolbox.VTOpticalFlowConfiguration.WeakSupportedRevisions +P:VideoToolbox.VTOpticalFlowParameters.DestinationOpticalFlow +P:VideoToolbox.VTOpticalFlowParameters.NextFrame +P:VideoToolbox.VTOpticalFlowParameters.SourceFrame +P:VideoToolbox.VTOpticalFlowParameters.SubmissionMode P:VideoToolbox.VTPixelRotationProperties.FlipHorizontalOrientation P:VideoToolbox.VTPixelRotationProperties.FlipVerticalOrientation P:VideoToolbox.VTPixelRotationProperties.Rotation @@ -61555,6 +61684,8 @@ T:VideoSubscriberAccount.VSUserAccountManager T:VideoSubscriberAccount.VSUserAccountQueryOptions T:VideoSubscriberAccount.VSUserAccountType T:VideoToolbox.HdrMetadataInsertionMode +T:VideoToolbox.IVTFrameProcessorConfiguration +T:VideoToolbox.IVTFrameProcessorParameters T:VideoToolbox.VTAlphaChannelMode T:VideoToolbox.VTCompressionSession T:VideoToolbox.VTCompressionSession.VTCompressionOutputCallback @@ -61563,11 +61694,31 @@ T:VideoToolbox.VTDecoderExtensionProperties T:VideoToolbox.VTDecompressionSession T:VideoToolbox.VTDecompressionSession.VTDecompressionOutputCallback T:VideoToolbox.VTExtensionPropertiesKey +T:VideoToolbox.VTFrameProcessor +T:VideoToolbox.VTFrameProcessorError +T:VideoToolbox.VTFrameProcessorFrame +T:VideoToolbox.VTFrameProcessorOpticalFlow +T:VideoToolbox.VTFrameProcessorProcessHandler +T:VideoToolbox.VTFrameRateConversionConfiguration +T:VideoToolbox.VTFrameRateConversionConfigurationQualityPrioritization +T:VideoToolbox.VTFrameRateConversionConfigurationRevision +T:VideoToolbox.VTFrameRateConversionParameters +T:VideoToolbox.VTFrameRateConversionParametersSubmissionMode T:VideoToolbox.VTFrameSilo T:VideoToolbox.VTHdrPerFrameMetadataGenerationHdrFormatType T:VideoToolbox.VTHdrPerFrameMetadataGenerationOptions T:VideoToolbox.VTHdrPerFrameMetadataGenerationOptionsKey +T:VideoToolbox.VTMotionBlurConfiguration +T:VideoToolbox.VTMotionBlurConfigurationQualityPrioritization +T:VideoToolbox.VTMotionBlurConfigurationRevision +T:VideoToolbox.VTMotionBlurParameters +T:VideoToolbox.VTMotionBlurParametersSubmissionMode T:VideoToolbox.VTMultiPassStorage +T:VideoToolbox.VTOpticalFlowConfiguration +T:VideoToolbox.VTOpticalFlowConfigurationQualityPrioritization +T:VideoToolbox.VTOpticalFlowConfigurationRevision +T:VideoToolbox.VTOpticalFlowParameters +T:VideoToolbox.VTOpticalFlowParametersSubmissionMode T:VideoToolbox.VTPixelRotationProperties T:VideoToolbox.VTPixelRotationPropertyKeys T:VideoToolbox.VTPixelRotationSession diff --git a/tests/introspection/ApiSelectorTest.cs b/tests/introspection/ApiSelectorTest.cs index fb5c5494c452..a60f72cc8694 100644 --- a/tests/introspection/ApiSelectorTest.cs +++ b/tests/introspection/ApiSelectorTest.cs @@ -1136,37 +1136,74 @@ protected virtual bool CheckResponse (bool value, Type actualType, MethodBase me if (value) return true; - var mname = method.Name; - // properties getter and setter will be methods in the _Extensions type - if (method.IsSpecialName) - mname = mname.Replace ("get_", "Get").Replace ("set_", "Set"); + if (CheckForInlinedProtocolMember (actualType, method)) + return true; + name = actualType.FullName + " : " + name; + return false; + } + + static bool CheckForInlinedProtocolMember (Type actualType, MethodBase method) + { // it's possible that the selector was inlined for an OPTIONAL protocol member // we do not want those reported (too many false positives) and we have other tests to find such mistakes foreach (var intf in actualType.GetInterfaces ()) { if (intf.GetCustomAttributes () is null) continue; + + // First check the actual interface + if (IsMethodImplemented (intf, intf, method, false)) + return true; + + // Then check any _Extensions class var ext = Type.GetType (intf.Namespace + "." + intf.Name.Remove (0, 1) + "_Extensions, " + intf.Assembly.FullName); - if (ext is null) - continue; - foreach (var m in ext.GetMethods ()) { - if (mname != m.Name) + if (IsMethodImplemented (intf, ext, method, true)) + return true; + } + + return false; + } + + static bool IsMethodImplemented (Type iface, Type type, MethodBase method, bool isExtensionMethod) + { + if (type is null) + return false; + + // properties getter and setter will be methods in the _Extensions type + var mname = method.Name; + if (method.IsSpecialName) + mname = mname.Replace ("get_", "Get").Replace ("set_", "Set"); + + foreach (var m in type.GetMethods ()) { + if (method.Name != m.Name) { + if (method.IsSpecialName) { + if (mname != m.Name) + continue; + } else { continue; - var parameters = method.GetParameters (); - var ext_params = m.GetParameters (); + } + } + var parametersA = method.GetParameters (); + var parametersB = m.GetParameters (); + var match = true; + if (isExtensionMethod) { // first parameters is `this XXX This` - if (parameters.Length == ext_params.Length - 1) { - bool match = true; - for (int i = 1; i < ext_params.Length; i++) { - match |= (parameters [i - 1].ParameterType == ext_params [i].ParameterType); - } - if (match) - return true; + if (parametersA.Length != parametersB.Length - 1) + continue; + match &= parametersB [0].ParameterType == iface; + for (var i = 1; i < parametersB.Length; i++) { + match &= parametersA [i - 1].ParameterType == parametersB [i].ParameterType; } + } else { + if (parametersA.Length != parametersB.Length) + continue; + for (var i = 0; i < parametersA.Length; i++) + match &= parametersA [i].ParameterType == parametersB [i].ParameterType; } + if (match) + return true; } - name = actualType.FullName + " : " + name; return false; } @@ -1398,11 +1435,14 @@ protected virtual void Dispose (NSObject obj, Type type) } // funny, this is how I envisioned the instance version... before hitting run :| - protected virtual bool CheckStaticResponse (bool value, Type actualType, Type declaredType, ref string name) + protected virtual bool CheckStaticResponse (bool value, Type actualType, Type declaredType, MethodBase method, ref string name) { if (value) return true; + if (CheckForInlinedProtocolMember (actualType, method)) + return true; + name = actualType.FullName + " : " + name; return false; } @@ -1440,7 +1480,7 @@ public void StaticMethods () continue; bool result = bool_objc_msgSend_IntPtr (class_ptr, responds_handle, Selector.GetHandle (name)); - bool response = CheckStaticResponse (result, t, m.DeclaringType, ref name); + bool response = CheckStaticResponse (result, t, m.DeclaringType, m, ref name); if (!response) ReportError (name); n++; diff --git a/tests/introspection/MacApiSelectorTest.cs b/tests/introspection/MacApiSelectorTest.cs index ec8c0038db71..f29e468e8271 100644 --- a/tests/introspection/MacApiSelectorTest.cs +++ b/tests/introspection/MacApiSelectorTest.cs @@ -1192,7 +1192,7 @@ protected override bool CheckResponse (bool value, Type actualType, MethodBase m return base.CheckResponse (value, actualType, method, ref name); } - protected override bool CheckStaticResponse (bool value, Type actualType, Type declaredType, ref string name) + protected override bool CheckStaticResponse (bool value, Type actualType, Type declaredType, MethodBase method, ref string name) { switch (name) { // 10.7 exceptions @@ -1214,7 +1214,7 @@ protected override bool CheckStaticResponse (bool value, Type actualType, Type d case "metadataItemsFromArray:filteredAndSortedAccordingToPreferredLanguages:": return true; } - return base.CheckStaticResponse (value, actualType, declaredType, ref name); + return base.CheckStaticResponse (value, actualType, declaredType, method, ref name); } protected override bool SkipInit (string selector, MethodBase m) diff --git a/tests/introspection/iOSApiSelectorTest.cs b/tests/introspection/iOSApiSelectorTest.cs index 7a62e91116c3..ffd30f98bda9 100644 --- a/tests/introspection/iOSApiSelectorTest.cs +++ b/tests/introspection/iOSApiSelectorTest.cs @@ -833,7 +833,7 @@ protected override bool CheckResponse (bool value, Type actualType, MethodBase m return base.CheckResponse (value, actualType, method, ref name); } - protected override bool CheckStaticResponse (bool value, Type actualType, Type declaredType, ref string name) + protected override bool CheckStaticResponse (bool value, Type actualType, Type declaredType, MethodBase method, ref string name) { switch (name) { // new API in iOS9 beta 5 but is does not respond when queried - https://bugzilla.xamarin.com/show_bug.cgi?id=33431 @@ -876,7 +876,7 @@ protected override bool CheckStaticResponse (bool value, Type actualType, Type d } break; } - return base.CheckStaticResponse (value, actualType, declaredType, ref name); + return base.CheckStaticResponse (value, actualType, declaredType, method, ref name); } static List do_not_dispose = new List (); diff --git a/tests/monotouch-test/VideoToolbox/VTFrameRateConversionConfigurationTest.cs b/tests/monotouch-test/VideoToolbox/VTFrameRateConversionConfigurationTest.cs new file mode 100644 index 000000000000..41aa6632f0f5 --- /dev/null +++ b/tests/monotouch-test/VideoToolbox/VTFrameRateConversionConfigurationTest.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#if __MACOS__ + +using System; +using System.Linq; + +using AVFoundation; +using CoreFoundation; +using CoreMedia; +using CoreVideo; +using Foundation; +using ObjCRuntime; +using VideoToolbox; + +using NUnit.Framework; + +using Xamarin.Utils; + +namespace MonoTouchFixtures.VideoToolbox { + + [TestFixture] + [Preserve (AllMembers = true)] + public class VTFrameRateConversionConfigurationTest { + [Test] + public void Properties () + { + TestRuntime.AssertXcodeVersion (16, 3); + + Assert.Multiple (() => { + using var obj = new VTFrameRateConversionConfiguration (320, 320, true, VTFrameRateConversionConfigurationQualityPrioritization.Normal, VTFrameRateConversionConfigurationRevision.Revision1); + Assert.That (obj.FrameWidth, Is.EqualTo ((nint) 320), "FrameWidth"); + Assert.That (obj.FrameHeight, Is.EqualTo ((nint) 320), "FrameHeight"); + Assert.That (obj.UsePrecomputedFlow, Is.EqualTo (true), "UsePrecomputedFlow"); + Assert.That (obj.QualityPrioritization, Is.EqualTo (VTFrameRateConversionConfigurationQualityPrioritization.Normal), "QualityPrioritization"); + Assert.That (obj.Revision, Is.EqualTo (VTFrameRateConversionConfigurationRevision.Revision1), "Revision"); + Assert.That (obj.FrameSupportedPixelFormats, Is.Not.Null, "FrameSupportedPixelFormats"); + Assert.That (obj.FrameSupportedPixelFormats.Length, Is.EqualTo (obj.WeakFrameSupportedPixelFormats.Length), "FrameSupportedPixelFormats.Length"); + + Assert.That (obj.SourcePixelBufferAttributes, Is.Not.Null, "SourcePixelBufferAttributes"); + Assert.That (obj.SourcePixelBufferAttributes.Height, Is.EqualTo ((nint) 320), "SourcePixelBufferAttributes.Height"); + Assert.That (obj.SourcePixelBufferAttributes.Width, Is.EqualTo ((nint) 320), "SourcePixelBufferAttributes.Width"); + Assert.That (obj.SourcePixelBufferAttributes.PixelFormatTypes, Is.Not.Null, "SourcePixelBufferAttributes.PixelFormatTypes"); + Assert.That (obj.SourcePixelBufferAttributes.PixelFormatTypes?.Length, Is.EqualTo (1), "SourcePixelBufferAttributes.PixelFormatTypes.Length"); + Assert.That (obj.SourcePixelBufferAttributes.PixelFormatTypes? [0], Is.EqualTo (CVPixelFormatType.CV64RGBAHalf), "SourcePixelBufferAttributes.PixelFormatTypes[0]"); + Assert.That (obj.WeakSourcePixelBufferAttributes, Is.Not.Null, "WeakSourcePixelBufferAttributes"); + + Assert.That (obj.DestinationPixelBufferAttributes, Is.Not.Null, "DestinationPixelBufferAttributes"); + Assert.That (obj.DestinationPixelBufferAttributes.Height, Is.EqualTo ((nint) 320), "DestinationPixelBufferAttributes.Height"); + Assert.That (obj.DestinationPixelBufferAttributes.Width, Is.EqualTo ((nint) 320), "DestinationPixelBufferAttributes.Width"); + Assert.That (obj.DestinationPixelBufferAttributes.PixelFormatTypes, Is.Not.Null, "DestinationPixelBufferAttributes.PixelFormatTypes"); + Assert.That (obj.DestinationPixelBufferAttributes.PixelFormatTypes?.Length, Is.EqualTo (1), "DestinationPixelBufferAttributes.PixelFormatTypes.Length"); + Assert.That (obj.DestinationPixelBufferAttributes.PixelFormatTypes? [0], Is.EqualTo (CVPixelFormatType.CV64RGBAHalf), "DestinationPixelBufferAttributes.PixelFormatTypes[0]"); + Assert.That (obj.WeakDestinationPixelBufferAttributes, Is.Not.Null, "WeakDestinationPixelBufferAttributes"); + + Assert.That (VTFrameRateConversionConfiguration.ProcessorSupported, Is.True, "ProcessorSupported"); + Assert.That (VTFrameRateConversionConfiguration.SupportedRevisions, Is.Not.Null, "SupportedRevisions"); + Assert.That (VTFrameRateConversionConfiguration.SupportedRevisions, Does.Contain (VTFrameRateConversionConfigurationRevision.Revision1), "SupportedRevisions.Contains"); + Assert.That (VTFrameRateConversionConfiguration.WeakSupportedRevisions, Is.Not.Null, "WeakSupportedRevisions"); + Assert.That (VTFrameRateConversionConfiguration.WeakSupportedRevisions, Does.Contain ((nuint) 1), "WeakSupportedRevisions.Contains"); + Assert.That (Enum.GetValues (), Does.Contain (VTFrameRateConversionConfiguration.DefaultRevision), "DefaultRevision"); + }); + } + } +} + +#endif // __MACOS__ diff --git a/tests/monotouch-test/VideoToolbox/VTMotionBlurConfigurationTest.cs b/tests/monotouch-test/VideoToolbox/VTMotionBlurConfigurationTest.cs new file mode 100644 index 000000000000..775312a0e23b --- /dev/null +++ b/tests/monotouch-test/VideoToolbox/VTMotionBlurConfigurationTest.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#if __MACOS__ + +using System; + +using AVFoundation; +using CoreFoundation; +using CoreMedia; +using CoreVideo; +using Foundation; +using ObjCRuntime; +using VideoToolbox; + +using NUnit.Framework; + +using Xamarin.Utils; + +namespace MonoTouchFixtures.VideoToolbox { + + [TestFixture] + [Preserve (AllMembers = true)] + public class VTMotionBlurConfigurationTEst { + [Test] + public void Properties () + { + TestRuntime.AssertXcodeVersion (16, 3); + + Assert.Multiple (() => { + using var obj = new VTMotionBlurConfiguration (320, 320, true, VTMotionBlurConfigurationQualityPrioritization.Normal, VTMotionBlurConfigurationRevision.Revision1); + Assert.That (obj.FrameWidth, Is.EqualTo ((nint) 320), "FrameWidth"); + Assert.That (obj.FrameHeight, Is.EqualTo ((nint) 320), "FrameHeight"); + Assert.That (obj.UsePrecomputedFlow, Is.EqualTo (true), "UsePrecomputedFlow"); + Assert.That (obj.QualityPrioritization, Is.EqualTo (VTMotionBlurConfigurationQualityPrioritization.Normal), "QualityPrioritization"); + Assert.That (obj.Revision, Is.EqualTo (VTMotionBlurConfigurationRevision.Revision1), "Revision"); + TestRuntime.NSLog ($"FrameSupportedPixelFormats: {obj.FrameSupportedPixelFormats}"); + TestRuntime.NSLog ($"SourcePixelBufferAttributes: {obj.SourcePixelBufferAttributes}"); + TestRuntime.NSLog ($"DestinationPixelBufferAttributes: {obj.DestinationPixelBufferAttributes}"); + Assert.That (VTMotionBlurConfiguration.ProcessorSupported, Is.True, "ProcessorSupported"); + + Assert.That (VTMotionBlurConfiguration.SupportedRevisions, Is.Not.Null, "SupportedRevisions"); + Assert.That (VTMotionBlurConfiguration.SupportedRevisions, Does.Contain (VTMotionBlurConfigurationRevision.Revision1), "SupportedRevisions.Contains"); + Assert.That (VTMotionBlurConfiguration.WeakSupportedRevisions, Is.Not.Null, "WeakSupportedRevisions"); + Assert.That (VTMotionBlurConfiguration.WeakSupportedRevisions, Does.Contain ((nuint) 1), "WeakSupportedRevisions.Contains"); + Assert.That (Enum.GetValues (), Does.Contain (VTMotionBlurConfiguration.DefaultRevision), "DefaultRevision"); + }); + } + } +} + +#endif // __MACOS__ diff --git a/tests/monotouch-test/VideoToolbox/VTOpticalFlowConfigurationTest.cs b/tests/monotouch-test/VideoToolbox/VTOpticalFlowConfigurationTest.cs new file mode 100644 index 000000000000..c3d85545d413 --- /dev/null +++ b/tests/monotouch-test/VideoToolbox/VTOpticalFlowConfigurationTest.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#if __MACOS__ + +using System; + +using AVFoundation; +using CoreFoundation; +using CoreMedia; +using CoreVideo; +using Foundation; +using ObjCRuntime; +using VideoToolbox; + +using NUnit.Framework; + +using Xamarin.Utils; + +namespace MonoTouchFixtures.VideoToolbox { + + [TestFixture] + [Preserve (AllMembers = true)] + public class VTOpticalFlowConfigurationTest { + [Test] + public void Properties () + { + TestRuntime.AssertXcodeVersion (16, 3); + + Assert.Multiple (() => { + using var obj = new VTOpticalFlowConfiguration (320, 320, VTOpticalFlowConfigurationQualityPrioritization.Normal, VTOpticalFlowConfigurationRevision.Revision1); + Assert.That (obj.FrameWidth, Is.EqualTo ((nint) 320), "FrameWidth"); + Assert.That (obj.FrameHeight, Is.EqualTo ((nint) 320), "FrameHeight"); + Assert.That (obj.QualityPrioritization, Is.EqualTo (VTOpticalFlowConfigurationQualityPrioritization.Normal), "QualityPrioritization"); + Assert.That (obj.Revision, Is.EqualTo (VTOpticalFlowConfigurationRevision.Revision1), "Revision"); + TestRuntime.NSLog ($"FrameSupportedPixelFormats: {obj.FrameSupportedPixelFormats}"); + TestRuntime.NSLog ($"SourcePixelBufferAttributes: {obj.SourcePixelBufferAttributes}"); + TestRuntime.NSLog ($"DestinationPixelBufferAttributes: {obj.DestinationPixelBufferAttributes}"); + Assert.That (VTOpticalFlowConfiguration.ProcessorSupported, Is.True, "ProcessorSupported"); + + Assert.That (VTOpticalFlowConfiguration.SupportedRevisions, Is.Not.Null, "SupportedRevisions"); + Assert.That (VTOpticalFlowConfiguration.SupportedRevisions, Does.Contain (VTOpticalFlowConfigurationRevision.Revision1), "SupportedRevisions.Contains"); + Assert.That (VTOpticalFlowConfiguration.WeakSupportedRevisions, Is.Not.Null, "WeakSupportedRevisions"); + Assert.That (VTOpticalFlowConfiguration.WeakSupportedRevisions, Does.Contain ((nuint) 1), "WeakSupportedRevisions.Contains"); + Assert.That (Enum.GetValues (), Does.Contain (VTOpticalFlowConfiguration.DefaultRevision), "DefaultRevision"); + }); + } + } +} + +#endif // __MACOS__ diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-VideoToolbox.todo b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-VideoToolbox.todo deleted file mode 100644 index d3475db51737..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-VideoToolbox.todo +++ /dev/null @@ -1,10 +0,0 @@ -!missing-enum! VTFrameProcessorError not bound -!missing-enum! VTFrameRateConversionConfigurationQualityPrioritization not bound -!missing-enum! VTFrameRateConversionConfigurationRevision not bound -!missing-enum! VTFrameRateConversionParametersSubmissionMode not bound -!missing-enum! VTMotionBlurConfigurationQualityPrioritization not bound -!missing-enum! VTMotionBlurConfigurationRevision not bound -!missing-enum! VTMotionBlurParametersSubmissionMode not bound -!missing-enum! VTOpticalFlowConfigurationQualityPrioritization not bound -!missing-enum! VTOpticalFlowConfigurationRevision not bound -!missing-enum! VTOpticalFlowParametersSubmissionMode not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-VideoToolbox.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-VideoToolbox.todo deleted file mode 100644 index 196ddd777f2d..000000000000 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-VideoToolbox.todo +++ /dev/null @@ -1,90 +0,0 @@ -!missing-enum! VTFrameProcessorError not bound -!missing-enum! VTFrameRateConversionConfigurationQualityPrioritization not bound -!missing-enum! VTFrameRateConversionConfigurationRevision not bound -!missing-enum! VTFrameRateConversionParametersSubmissionMode not bound -!missing-enum! VTMotionBlurConfigurationQualityPrioritization not bound -!missing-enum! VTMotionBlurConfigurationRevision not bound -!missing-enum! VTMotionBlurParametersSubmissionMode not bound -!missing-enum! VTOpticalFlowConfigurationQualityPrioritization not bound -!missing-enum! VTOpticalFlowConfigurationRevision not bound -!missing-enum! VTOpticalFlowParametersSubmissionMode not bound -!missing-field! VTFrameProcessorErrorDomain not bound -!missing-protocol! VTFrameProcessorConfiguration not bound -!missing-protocol! VTFrameProcessorParameters not bound -!missing-selector! +VTFrameRateConversionConfiguration::defaultRevision not bound -!missing-selector! +VTFrameRateConversionConfiguration::processorSupported not bound -!missing-selector! +VTFrameRateConversionConfiguration::supportedRevisions not bound -!missing-selector! +VTMotionBlurConfiguration::defaultRevision not bound -!missing-selector! +VTMotionBlurConfiguration::processorSupported not bound -!missing-selector! +VTMotionBlurConfiguration::supportedRevisions not bound -!missing-selector! +VTOpticalFlowConfiguration::defaultRevision not bound -!missing-selector! +VTOpticalFlowConfiguration::processorSupported not bound -!missing-selector! +VTOpticalFlowConfiguration::supportedRevisions not bound -!missing-selector! VTFrameProcessor::endSession not bound -!missing-selector! VTFrameProcessor::init not bound -!missing-selector! VTFrameProcessor::processWithParameters:completionHandler: not bound -!missing-selector! VTFrameProcessor::processWithParameters:error: not bound -!missing-selector! VTFrameProcessor::startSessionWithConfiguration:error: not bound -!missing-selector! VTFrameProcessorFrame::buffer not bound -!missing-selector! VTFrameProcessorFrame::initWithBuffer:presentationTimeStamp: not bound -!missing-selector! VTFrameProcessorFrame::presentationTimeStamp not bound -!missing-selector! VTFrameProcessorOpticalFlow::backwardFlow not bound -!missing-selector! VTFrameProcessorOpticalFlow::forwardFlow not bound -!missing-selector! VTFrameProcessorOpticalFlow::initWithForwardFlow:backwardFlow: not bound -!missing-selector! VTFrameRateConversionConfiguration::destinationPixelBufferAttributes not bound -!missing-selector! VTFrameRateConversionConfiguration::frameHeight not bound -!missing-selector! VTFrameRateConversionConfiguration::frameSupportedPixelFormats not bound -!missing-selector! VTFrameRateConversionConfiguration::frameWidth not bound -!missing-selector! VTFrameRateConversionConfiguration::initWithFrameWidth:frameHeight:usePrecomputedFlow:qualityPrioritization:revision: not bound -!missing-selector! VTFrameRateConversionConfiguration::qualityPrioritization not bound -!missing-selector! VTFrameRateConversionConfiguration::revision not bound -!missing-selector! VTFrameRateConversionConfiguration::sourcePixelBufferAttributes not bound -!missing-selector! VTFrameRateConversionConfiguration::usePrecomputedFlow not bound -!missing-selector! VTFrameRateConversionParameters::destinationFrames not bound -!missing-selector! VTFrameRateConversionParameters::initWithSourceFrame:nextFrame:opticalFlow:interpolationPhase:submissionMode:destinationFrames: not bound -!missing-selector! VTFrameRateConversionParameters::interpolationPhase not bound -!missing-selector! VTFrameRateConversionParameters::nextFrame not bound -!missing-selector! VTFrameRateConversionParameters::opticalFlow not bound -!missing-selector! VTFrameRateConversionParameters::sourceFrame not bound -!missing-selector! VTFrameRateConversionParameters::submissionMode not bound -!missing-selector! VTMotionBlurConfiguration::destinationPixelBufferAttributes not bound -!missing-selector! VTMotionBlurConfiguration::frameHeight not bound -!missing-selector! VTMotionBlurConfiguration::frameSupportedPixelFormats not bound -!missing-selector! VTMotionBlurConfiguration::frameWidth not bound -!missing-selector! VTMotionBlurConfiguration::initWithFrameWidth:frameHeight:usePrecomputedFlow:qualityPrioritization:revision: not bound -!missing-selector! VTMotionBlurConfiguration::qualityPrioritization not bound -!missing-selector! VTMotionBlurConfiguration::revision not bound -!missing-selector! VTMotionBlurConfiguration::sourcePixelBufferAttributes not bound -!missing-selector! VTMotionBlurConfiguration::usePrecomputedFlow not bound -!missing-selector! VTMotionBlurParameters::destinationFrame not bound -!missing-selector! VTMotionBlurParameters::initWithSourceFrame:nextFrame:previousFrame:nextOpticalFlow:previousOpticalFlow:motionBlurStrength:submissionMode:destinationFrame: not bound -!missing-selector! VTMotionBlurParameters::motionBlurStrength not bound -!missing-selector! VTMotionBlurParameters::nextFrame not bound -!missing-selector! VTMotionBlurParameters::nextOpticalFlow not bound -!missing-selector! VTMotionBlurParameters::previousFrame not bound -!missing-selector! VTMotionBlurParameters::previousOpticalFlow not bound -!missing-selector! VTMotionBlurParameters::sourceFrame not bound -!missing-selector! VTMotionBlurParameters::submissionMode not bound -!missing-selector! VTOpticalFlowConfiguration::destinationPixelBufferAttributes not bound -!missing-selector! VTOpticalFlowConfiguration::frameHeight not bound -!missing-selector! VTOpticalFlowConfiguration::frameSupportedPixelFormats not bound -!missing-selector! VTOpticalFlowConfiguration::frameWidth not bound -!missing-selector! VTOpticalFlowConfiguration::initWithFrameWidth:frameHeight:qualityPrioritization:revision: not bound -!missing-selector! VTOpticalFlowConfiguration::qualityPrioritization not bound -!missing-selector! VTOpticalFlowConfiguration::revision not bound -!missing-selector! VTOpticalFlowConfiguration::sourcePixelBufferAttributes not bound -!missing-selector! VTOpticalFlowParameters::destinationOpticalFlow not bound -!missing-selector! VTOpticalFlowParameters::initWithSourceFrame:nextFrame:submissionMode:destinationOpticalFlow: not bound -!missing-selector! VTOpticalFlowParameters::nextFrame not bound -!missing-selector! VTOpticalFlowParameters::sourceFrame not bound -!missing-selector! VTOpticalFlowParameters::submissionMode not bound -!missing-type! VTFrameProcessor not bound -!missing-type! VTFrameProcessorFrame not bound -!missing-type! VTFrameProcessorOpticalFlow not bound -!missing-type! VTFrameRateConversionConfiguration not bound -!missing-type! VTFrameRateConversionParameters not bound -!missing-type! VTMotionBlurConfiguration not bound -!missing-type! VTMotionBlurParameters not bound -!missing-type! VTOpticalFlowConfiguration not bound -!missing-type! VTOpticalFlowParameters not bound -!missing-selector! VTFrameProcessor::processWithCommandBuffer:parameters: not bound