diff --git a/src/AVFoundation/AVTypes.cs b/src/AVFoundation/AVTypes.cs index 2d1198e0f12f..805bc12b1f07 100644 --- a/src/AVFoundation/AVTypes.cs +++ b/src/AVFoundation/AVTypes.cs @@ -362,13 +362,18 @@ public enum AVCaptionUnitsType : long { [StructLayout (LayoutKind.Sequential)] public struct AVCaptionDimension { public nfloat Value; - public AVCaptionUnitsType Units; + public nuint units; + + public AVCaptionUnitsType Units { + get => (AVCaptionUnitsType) (long) units; + set => units = (nuint) (long) value; + } [DllImport (Constants.AVFoundationLibrary)] - static extern AVCaptionDimension AVCaptionDimensionMake (nfloat dimension, AVCaptionUnitsType units); + static extern AVCaptionDimension AVCaptionDimensionMake (nfloat dimension, /* AVCaptionUnitsType */ nuint units); public static AVCaptionDimension Create (nfloat dimension, AVCaptionUnitsType units) - => AVCaptionDimensionMake (dimension, units); + => AVCaptionDimensionMake (dimension, (nuint) (long)units); } #if !NET diff --git a/src/AVFoundation/Enums.cs b/src/AVFoundation/Enums.cs index 6df628fb8b2c..fa4b95c2e9ef 100644 --- a/src/AVFoundation/Enums.cs +++ b/src/AVFoundation/Enums.cs @@ -1349,7 +1349,7 @@ public enum AVCaptionFontStyle : long { #endif [Flags] [Native] - public enum AVCaptionDecoration : ulong { + public enum AVCaptionDecoration : ulong { None = 0x0, Underline = 1uL << 0, LineThrough = 1uL << 1, @@ -1357,9 +1357,9 @@ public enum AVCaptionDecoration : ulong { } #if !NET - [NoWatch, NoTV, NoiOS, Mac (12,0), NoMacCatalyst] + [NoWatch, NoTV, NoiOS, Mac (12,0), NoMacCatalyst] #else - [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), UnsupportedOSPlatform ("maccatalyst"), SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), UnsupportedOSPlatform ("maccatalyst"), SupportedOSPlatform ("macos12.0")] #endif [Native] public enum AVCaptionTextCombine : long { @@ -1372,9 +1372,9 @@ public enum AVCaptionTextCombine : long { } #if !NET - [NoWatch, NoTV, NoiOS, Mac (12,0), NoMacCatalyst] + [NoWatch, NoTV, NoiOS, Mac (12,0), NoMacCatalyst] #else - [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), UnsupportedOSPlatform ("maccatalyst"), SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("ios"), UnsupportedOSPlatform ("tvos"), UnsupportedOSPlatform ("maccatalyst"), SupportedOSPlatform ("macos12.0")] #endif [Native] public enum AVCaptionTextAlignment : long { @@ -1394,7 +1394,7 @@ public enum AVCaptionTextAlignment : long { public enum AVCaptionRegionWritingMode : long { LeftToRightAndTopToBottom = 0, - TopToBottomAndRightToLeft = 2 + TopToBottomAndRightToLeft = 2, } #if !NET diff --git a/src/avfoundation.cs b/src/avfoundation.cs index c5fc7f4276cb..1fdcbed80b3e 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -3184,12 +3184,12 @@ interface AVAsset : NSCopying { [Async] [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] [Export ("loadChapterMetadataGroupsBestMatchingPreferredLanguages:completionHandler:")] - void LoadChapterMetadataGroups (string[] preferredLanguages, Action, NSError> completionHandler); + void LoadChapterMetadataGroups (string[] bestMatchingPreferredLanguages, Action, NSError> completionHandler); [Async] [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] [Export ("loadChapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:completionHandler:")] - void LoadChapterMetadataGroups (NSLocale locale, string[] commonKeys, Action, NSError> completionHandler); + void LoadChapterMetadataGroups (NSLocale titleLocale, string[] commonKeys, Action, NSError> completionHandler); [Async] [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] @@ -3204,7 +3204,7 @@ interface AVAsset : NSCopying { [Async] [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] [Export ("loadTrackWithTrackID:completionHandler:")] - void LoadTrack (int trackID, Action completionHandler); + void LoadTrack (int trackId, Action completionHandler); [Async] [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] @@ -3498,7 +3498,6 @@ interface AVQueuedSampleBufferRendering [BaseType (typeof(NSObject))] interface AVSampleBufferAudioRenderer : AVQueuedSampleBufferRendering { - [Export ("status")] AVQueuedSampleBufferRenderingStatus Status { get; } @@ -11403,7 +11402,7 @@ enum AVPlayerWaitingReason { [TV (15, 0), NoWatch, Mac (12, 0), iOS (15, 0), MacCatalyst (15,0)] [Field ("AVPlayerWaitingForCoordinatedPlaybackReason")] - aitingForCoordinatedPlayback, + WaitingForCoordinatedPlayback, } [Watch (6,0)] @@ -14905,7 +14904,7 @@ interface AVAssetVariantAudioAttributes [Export ("renditionSpecificAttributesForMediaOption:")] [return: NullAllowed] - AVAssetVariantAudioRenditionSpecificAttributes RenditionSpecificAttributesForMediaOption (AVMediaSelectionOption mediaSelectionOption); + AVAssetVariantAudioRenditionSpecificAttributes GetRenditionSpecificAttributesForMediaOption (AVMediaSelectionOption mediaSelectionOption); } [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] @@ -14941,7 +14940,7 @@ interface AVAssetVariantQualifier : NSCopying [Internal] [Static] [Export ("predicateForPresentationHeight:operatorType:")] - NSPredicate PredicateForPresentationHeight (nfloat height, NSPredicateOperatorType operatorType); + NSPredicate GetPredicateForPresentationHeight (nfloat height, NSPredicateOperatorType operatorType); } [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] @@ -15215,7 +15214,7 @@ interface AVAssetReaderOutputCaptionAdaptor [NoMacCatalyst] [Export ("nextCaptionGroup")] [return: NullAllowed] - AVCaptionGroup NextCaptionGroup (); + AVCaptionGroup GetNextCaptionGroup (); [NoMacCatalyst] [Export ("captionsNotPresentInPreviousGroupsInCaptionGroup:")] @@ -15400,19 +15399,19 @@ interface AVCaptionRegion : NSCopying, NSMutableCopying, NSSecureCoding { [Static] [Export ("appleITTTopRegion")] - AVCaptionRegion AppleITTTopRegion { get; } + AVCaptionRegion AppleiTTTopRegion { get; } [Static] [Export ("appleITTBottomRegion")] - AVCaptionRegion AppleITTBottomRegion { get; } + AVCaptionRegion AppleiTTBottomRegion { get; } [Static] [Export ("appleITTLeftRegion")] - AVCaptionRegion AppleITTLeftRegion { get; } + AVCaptionRegion AppleiTTLeftRegion { get; } [Static] [Export ("appleITTRightRegion")] - AVCaptionRegion AppleITTRightRegion { get; } + AVCaptionRegion AppleiTTRightRegion { get; } [Static] [Export ("subRipTextBottomRegion")] diff --git a/tests/monotouch-test/AVFoundation/AVCaptionDimensionTest.cs b/tests/monotouch-test/AVFoundation/AVCaptionDimensionTest.cs new file mode 100644 index 000000000000..017ca126b1bc --- /dev/null +++ b/tests/monotouch-test/AVFoundation/AVCaptionDimensionTest.cs @@ -0,0 +1,32 @@ +#if __MACOS__ +using System; +using Foundation; +using AVFoundation; +using NUnit.Framework; +using ObjCRuntime; + +namespace MonoTouchFixtures.AVFoundation { + + [TestFixture] + [Preserve (AllMembers = true)] + public class AVCaptionDimensionTest { + + [SetUp] + public void SetUp () + { + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12,0); + } + + [TestCase] + public void CreateTest () + { + // create a new struct, test that we do have the expected values + nfloat val = 10; + var units = AVCaptionUnitsType.Cells; + var dimension = AVCaptionDimension.Create (val, units); + Assert.AreEqual (val, dimension.Value, "Value"); + Assert.AreEqual (units, dimension.Units); + } + } +} +#endif diff --git a/tests/monotouch-test/AVFoundation/AVCaptionPointTest.cs b/tests/monotouch-test/AVFoundation/AVCaptionPointTest.cs new file mode 100644 index 000000000000..61a39c3dc303 --- /dev/null +++ b/tests/monotouch-test/AVFoundation/AVCaptionPointTest.cs @@ -0,0 +1,34 @@ +#if __MACOS__ +using System; +using Foundation; +using AVFoundation; +using NUnit.Framework; +using ObjCRuntime; + +namespace MonoTouchFixtures.AVFoundation { + + [TestFixture] + [Preserve (AllMembers = true)] + public class AVCaptionPointTest { + + [SetUp] + public void SetUp () + { + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12,0); + } + + [TestCase] + public void CreateTest () + { + nfloat val = 10; + var units = AVCaptionUnitsType.Cells; + var firstDimension = AVCaptionDimension.Create (val, units); + var secondDimension = AVCaptionDimension.Create (val, units); + + var point = AVCaptionPoint.Create (firstDimension, secondDimension); + Assert.AreEqual (val, point.X.Value, "X"); + Assert.AreEqual (val, point.Y.Value, "Y"); + } + } +} +#endif diff --git a/tests/monotouch-test/AVFoundation/AVCaptionSizeTest.cs b/tests/monotouch-test/AVFoundation/AVCaptionSizeTest.cs new file mode 100644 index 000000000000..18f579d6335a --- /dev/null +++ b/tests/monotouch-test/AVFoundation/AVCaptionSizeTest.cs @@ -0,0 +1,34 @@ +#if __MACOS__ +using System; +using Foundation; +using AVFoundation; +using NUnit.Framework; +using ObjCRuntime; + +namespace MonoTouchFixtures.AVFoundation { + + [TestFixture] + [Preserve (AllMembers = true)] + public class AVCaptionSizeTest { + + [SetUp] + public void SetUp () + { + TestRuntime.AssertSystemVersion (PlatformName.MacOSX, 12,0); + } + + [Test] + public void CreateTest () + { + nfloat val = 10; + var units = AVCaptionUnitsType.Cells; + var firstDimension = AVCaptionDimension.Create (val, units); + var secondDimension = AVCaptionDimension.Create (val, units); + + var size = AVCaptionSize.Create (firstDimension, secondDimension); + Assert.AreEqual (val, size.Width.Value, "Width"); + Assert.AreEqual (val, size.Height.Value, "Height"); + } + } +} +#endif diff --git a/tests/xtro-sharpie/iOS-AVFoundation.ignore b/tests/xtro-sharpie/iOS-AVFoundation.ignore index 5567f62d0f56..6349f779eec7 100644 --- a/tests/xtro-sharpie/iOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/iOS-AVFoundation.ignore @@ -13,5 +13,3 @@ # Deprecated in iOS 6.0 but we have same C# signature as a method that was deprecated in iOS 8.0 !deprecated-attribute-wrong! AVAudioRecorderDelegate::audioRecorderEndInterruption:withFlags: has 8.0 not 6.0 on [Deprecated] attribute - -# Initial result from new rule missing-release-attribute-on-return-value diff --git a/tests/xtro-sharpie/macOS-AVFoundation.ignore b/tests/xtro-sharpie/macOS-AVFoundation.ignore index 838a53f47031..ca5374711eec 100644 --- a/tests/xtro-sharpie/macOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/macOS-AVFoundation.ignore @@ -25,8 +25,6 @@ ## https://github.com/xamarin/xamarin-macios/issues/3213 should be fixed before conformance to 'AVQueuedSampleBufferRendering' is restored. !missing-protocol-conformance! AVSampleBufferDisplayLayer should conform to AVQueuedSampleBufferRendering (defined in 'AVSampleBufferDisplayLayerQueueManagement' category) -# Initial result from new rule missing-release-attribute-on-return-value - # AVFoundation differs between IOS and macOS. Fields not availble in macOS 10.15. !missing-field! AVMetadataIdentifierQuickTimeMetadataAutoLivePhoto not bound !missing-field! AVMetadataIdentifierQuickTimeMetadataDetectedCatBody not bound diff --git a/tests/xtro-sharpie/tvOS-AVFoundation.ignore b/tests/xtro-sharpie/tvOS-AVFoundation.ignore index 0a628ff649c8..b38f714b9d18 100644 --- a/tests/xtro-sharpie/tvOS-AVFoundation.ignore +++ b/tests/xtro-sharpie/tvOS-AVFoundation.ignore @@ -9,7 +9,5 @@ !unknown-field! AVAssetDownloadTaskMediaSelectionKey bound !unknown-field! AVAssetDownloadTaskMinimumRequiredMediaBitrateKey bound -# Initial result from new rule missing-release-attribute-on-return-value - # not used on tvOS !missing-enum! AVAudioSessionInterruptionReason not bound