From ad673ae7317b7fc448988c911abe5eb80ab3759d Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Fri, 24 Sep 2021 18:19:49 -0400 Subject: [PATCH] [CoreMedia] Add support for xcode13 (#12770) Co-authored-by: Rolf Bjarne Kvinge --- src/CoreMedia/CMSync.cs | 256 ++++++++++++++++-- .../CoreMedia/CMTimebaseTest.cs | 48 ++++ tests/xtro-sharpie/MacCatalyst-CoreMedia.todo | 20 -- tests/xtro-sharpie/common-CoreMedia.ignore | 18 ++ tests/xtro-sharpie/iOS-CoreMedia.todo | 28 -- tests/xtro-sharpie/macOS-CoreMedia.todo | 28 -- tests/xtro-sharpie/tvOS-CoreMedia.todo | 28 -- tests/xtro-sharpie/watchOS-CoreMedia.todo | 28 -- 8 files changed, 298 insertions(+), 156 deletions(-) delete mode 100644 tests/xtro-sharpie/MacCatalyst-CoreMedia.todo delete mode 100644 tests/xtro-sharpie/iOS-CoreMedia.todo delete mode 100644 tests/xtro-sharpie/macOS-CoreMedia.todo delete mode 100644 tests/xtro-sharpie/tvOS-CoreMedia.todo delete mode 100644 tests/xtro-sharpie/watchOS-CoreMedia.todo diff --git a/src/CoreMedia/CMSync.cs b/src/CoreMedia/CMSync.cs index 4087b5076a78..7a081f7d05c8 100644 --- a/src/CoreMedia/CMSync.cs +++ b/src/CoreMedia/CMSync.cs @@ -14,6 +14,8 @@ using CoreFoundation; using ObjCRuntime; +#nullable enable + namespace CoreMedia { // CMSync.h @@ -58,7 +60,7 @@ public CMTime CurrentTime { [DllImport(Constants.CoreMediaLibrary)] extern static /* OSStatus */ CMClockError CMAudioClockCreate (/* CFAllocatorRef */ IntPtr allocator, /* CMClockRef* */ out IntPtr clockOut); - public static CMClock CreateAudioClock (out CMClockError clockError) + public static CMClock? CreateAudioClock (out CMClockError clockError) { IntPtr ptr; clockError = CMAudioClockCreate (IntPtr.Zero, out ptr); @@ -118,6 +120,17 @@ private CMTimebase (IntPtr handle, bool owns) } #if !COREBUILD +#if !NET + [Deprecated (PlatformName.iOS, 8, 0)] + [Deprecated (PlatformName.TvOS, 9, 0)] + [Deprecated (PlatformName.MacOSX, 10, 10)] + [Deprecated (PlatformName.WatchOS, 6, 0)] +#else + [UnsupportedOSPlatform ("ios8.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.10")] +#endif [DllImport(Constants.CoreMediaLibrary)] extern static /* OSStatus */ CMTimebaseError CMTimebaseCreateWithMasterClock (/* CFAllocatorRef */ IntPtr allocator, /* CMClockRef */ IntPtr masterClock, /* CMTimebaseRef* */ out IntPtr timebaseOut); @@ -133,6 +146,17 @@ public CMTimebase (CMClock masterClock) CFObject.CFRetain (Handle); } +#if !NET + [Deprecated (PlatformName.iOS, 8, 0)] + [Deprecated (PlatformName.TvOS, 9, 0)] + [Deprecated (PlatformName.MacOSX, 10, 10)] + [Deprecated (PlatformName.WatchOS, 6, 0)] +#else + [UnsupportedOSPlatform ("ios8.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.10")] +#endif [DllImport(Constants.CoreMediaLibrary)] extern static /* OSStatus */ CMTimebaseError CMTimebaseCreateWithMasterTimebase (/* CFAllocatorRef */ IntPtr allocator, /* CMTimebaseRef */ IntPtr masterTimebase, /* CMTimebaseRef* */ out IntPtr timebaseOut); @@ -147,7 +171,52 @@ public CMTimebase (CMTimebase masterTimebase) CFObject.CFRetain (Handle); } + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + [DllImport(Constants.CoreMediaLibrary)] + static extern CMTimebaseError CMTimebaseCreateWithSourceClock (/* [NullAllowed] CFAllocatorRef */ IntPtr allocator, /* CMClock */ IntPtr sourceClock, /* CMTimebase */ out IntPtr timebaseOut); + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + public CMTimebase (CFAllocator? allocator, CMClock sourceClock) + { + if (sourceClock is null) + throw new ArgumentNullException (nameof (sourceClock)); + + var error = CMTimebaseCreateWithSourceClock (allocator.GetHandle (), sourceClock.Handle, out handle); + if (error != CMTimebaseError.None) + throw new ArgumentException (error.ToString ()); + } + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + [DllImport(Constants.CoreMediaLibrary)] + static extern CMTimebaseError CMTimebaseCreateWithSourceTimebase (/* [NullAllowed] CFAllocatorRef */ IntPtr allocator, /* CMTimebase */ IntPtr sourceTimebase, /* CMTimebase */ out IntPtr timebaseOut); + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + public CMTimebase (CFAllocator? allocator, CMTimebase sourceTimebase) + { + if (sourceTimebase is null) + throw new ArgumentNullException (nameof (sourceTimebase)); + var error = CMTimebaseCreateWithSourceTimebase (allocator.GetHandle (), sourceTimebase.Handle, out handle); + if (error != CMTimebaseError.None) + throw new ArgumentException (error.ToString ()); + } [DllImport(Constants.CoreMediaLibrary)] extern static /* Float64 */ double CMTimebaseGetEffectiveRate (/* CMTimebaseRef */ IntPtr timebase); @@ -215,7 +284,7 @@ public double Rate { [Obsolete ("Starting with macos10.11 use 'CopyMasterTimebase' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif #endif - public CMTimebase GetMasterTimebase () + public CMTimebase? GetMasterTimebase () { var ptr = CMTimebaseGetMasterTimebase (Handle); if (ptr == IntPtr.Zero) @@ -246,7 +315,7 @@ public CMTimebase GetMasterTimebase () [Obsolete ("Starting with macos10.11 use 'CopyMasterClock' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif #endif - public CMClock GetMasterClock () + public CMClock? GetMasterClock () { var ptr = CMTimebaseGetMasterClock (Handle); if (ptr == IntPtr.Zero) @@ -277,7 +346,7 @@ public CMClock GetMasterClock () [Obsolete ("Starting with macos10.11 use 'CopyMaster' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif #endif - public CMClockOrTimebase GetMaster () + public CMClockOrTimebase? GetMaster () { var ptr = CMTimebaseGetMaster (Handle); if (ptr == IntPtr.Zero) @@ -308,7 +377,7 @@ public CMClockOrTimebase GetMaster () [Obsolete ("Starting with macos10.11 use 'CopyUltimateMasterClock' instead.", DiagnosticId = "BI1234", UrlFormat = "https://github.com/xamarin/xamarin-macios/wiki/Obsolete")] #endif #endif - public CMClock GetUltimateMasterClock () + public CMClock? GetUltimateMasterClock () { var ptr = CMTimebaseGetUltimateMasterClock (Handle); if (ptr == IntPtr.Zero) @@ -411,20 +480,30 @@ public CMTimebaseError SetTimerToFireImmediately (NSTimer timer) #if !NET [TV (13,0), Mac (10,15), iOS (13,0)] + [Deprecated (PlatformName.iOS, 8, 0)] + [Deprecated (PlatformName.TvOS, 9, 0)] + [Deprecated (PlatformName.MacOSX, 10, 10)] + [Deprecated (PlatformName.WatchOS, 6, 0)] #else - [SupportedOSPlatform ("ios13.0")] - [SupportedOSPlatform ("tvos13.0")] - [SupportedOSPlatform ("macos10.15")] + [UnsupportedOSPlatform ("ios8.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.10")] #endif [DllImport(Constants.CoreMediaLibrary)] extern static CMTimebaseError CMTimebaseSetMasterTimebase (/* CMTimebaseRef* */ IntPtr timebase, /* CMTimebaseRef* */ IntPtr newMasterTimebase); #if !NET [TV (13,0), Mac (10,15), iOS (13,0)] + [Deprecated (PlatformName.iOS, 8, 0)] + [Deprecated (PlatformName.TvOS, 9, 0)] + [Deprecated (PlatformName.MacOSX, 10, 10)] + [Deprecated (PlatformName.WatchOS, 6, 0)] #else - [SupportedOSPlatform ("ios13.0")] - [SupportedOSPlatform ("tvos13.0")] - [SupportedOSPlatform ("macos10.15")] + [UnsupportedOSPlatform ("ios8.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.10")] #endif public CMTimebaseError SetMasterTimebase (CMTimebase newMasterTimebase) { @@ -436,20 +515,30 @@ public CMTimebaseError SetMasterTimebase (CMTimebase newMasterTimebase) #if !NET [TV (13,0), Mac (10,15), iOS (13,0)] + [Deprecated (PlatformName.iOS, 8, 0)] + [Deprecated (PlatformName.TvOS, 9, 0)] + [Deprecated (PlatformName.MacOSX, 10, 10)] + [Deprecated (PlatformName.WatchOS, 6, 0)] #else - [SupportedOSPlatform ("ios13.0")] - [SupportedOSPlatform ("tvos13.0")] - [SupportedOSPlatform ("macos10.15")] + [UnsupportedOSPlatform ("ios8.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.10")] #endif [DllImport(Constants.CoreMediaLibrary)] extern static CMTimebaseError CMTimebaseSetMasterClock (/* CMTimebaseRef* */ IntPtr timebase, /* CMClockRef* */ IntPtr newMasterClock); #if !NET [TV (13,0), Mac (10,15), iOS (13,0)] + [Deprecated (PlatformName.iOS, 8, 0)] + [Deprecated (PlatformName.TvOS, 9, 0)] + [Deprecated (PlatformName.MacOSX, 10, 10)] + [Deprecated (PlatformName.WatchOS, 6, 0)] #else - [SupportedOSPlatform ("ios13.0")] - [SupportedOSPlatform ("tvos13.0")] - [SupportedOSPlatform ("macos10.15")] + [UnsupportedOSPlatform ("ios8.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.10")] #endif public CMTimebaseError SetMasterClock (CMClock newMasterClock) { @@ -480,7 +569,7 @@ bool IsDeprecated () #endif } - public CMTimebase CopyMasterTimebase () + public CMTimebase? CopyMasterTimebase () { IntPtr ptr = IntPtr.Zero; bool deprecated = IsDeprecated (); @@ -497,7 +586,7 @@ public CMTimebase CopyMasterTimebase () return new CMTimebase (ptr, deprecated); } - public CMClock CopyMasterClock () + public CMClock? CopyMasterClock () { IntPtr ptr = IntPtr.Zero; bool deprecated = IsDeprecated (); @@ -514,7 +603,7 @@ public CMClock CopyMasterClock () return new CMClock (ptr, deprecated); } - public CMClockOrTimebase CopyMaster () + public CMClockOrTimebase? CopyMaster () { IntPtr ptr = IntPtr.Zero; bool deprecated = IsDeprecated (); @@ -531,7 +620,7 @@ public CMClockOrTimebase CopyMaster () return new CMClockOrTimebase (ptr, deprecated); } - public CMClock CopyUltimateMasterClock () + public CMClock? CopyUltimateMasterClock () { IntPtr ptr = IntPtr.Zero; bool deprecated = IsDeprecated (); @@ -549,25 +638,61 @@ public CMClock CopyUltimateMasterClock () } #if !NET - [iOS (9,0)][Mac (10,11)] + [iOS (9,0)][Mac (10,11), NoMacCatalyst] + [Deprecated (PlatformName.iOS, 9, 0, message: "Use 'CMTimebaseGetMasterTimebase' instead.")] + [Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'CMTimebaseGetMasterTimebase' instead.")] + [Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'CMTimebaseGetMasterTimebase' instead.")] + [Deprecated (PlatformName.WatchOS, 6, 0, message: "Use 'CMTimebaseGetMasterTimebase' instead.")] +#else + [UnsupportedOSPlatform ("ios15.0")] + [UnsupportedOSPlatform ("tvos15.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos12.0")] #endif [DllImport(Constants.CoreMediaLibrary)] static extern unsafe /* CMTimebaseRef */ IntPtr CMTimebaseCopyMasterTimebase (/* CMTimebaseRef */ IntPtr timebase); #if !NET [iOS (9,0)][Mac (10,11)] + [Deprecated (PlatformName.iOS, 9, 0, message: "Use 'CMTimebaseGetMasterClock' instead.")] + [Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'CMTimebaseGetMasterClock' instead.")] + [Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'CMTimebaseGetMasterClock' instead.")] + [Deprecated (PlatformName.WatchOS, 6, 0, message: "Use 'CMTimebaseGetMasterClock' instead.")] +#else + [UnsupportedOSPlatform ("ios9.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.11")] #endif [DllImport(Constants.CoreMediaLibrary)] static extern unsafe /* CMClockRef */ IntPtr CMTimebaseCopyMasterClock (/* CMTimebaseRef */ IntPtr timebase); #if !NET - [iOS (9,0)][Mac (10,11)] + [iOS (9,0)][Mac (10,11), NoMacCatalyst] + [Deprecated (PlatformName.iOS, 9, 0, message: "Use 'CMTimebaseGetMaster' instead.")] + [Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'CMTimebaseGetMaster' instead.")] + [Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'CMTimebaseGetMaster' instead.")] + [Deprecated (PlatformName.WatchOS, 6, 0, message: "Use 'CMTimebaseGetMaster' instead.")] +#else + [UnsupportedOSPlatform ("ios9.0")] + [UnsupportedOSPlatform ("tvos9.0")] + [UnsupportedOSPlatform ("maccatalyst")] + [UnsupportedOSPlatform ("macos10.11")] #endif [DllImport(Constants.CoreMediaLibrary)] static extern unsafe IntPtr /* void* */ CMTimebaseCopyMaster (/* CMTimebaseRef */ IntPtr timebase); #if !NET - [iOS (9,0)][Mac (10,11)] + [iOS (9,0)][Mac (10,11), NoMacCatalyst] + [Deprecated (PlatformName.iOS, 9, 0, message: "Use 'CMTimebaseGetUltimateMasterClock' instead.")] + [Deprecated (PlatformName.TvOS, 9, 0, message: "Use 'CMTimebaseGetUltimateMasterClock' instead.")] + [Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'CMTimebaseGetUltimateMasterClock' instead.")] + [Deprecated (PlatformName.WatchOS, 6, 0, message: "Use 'CMTimebaseGetUltimateMasterClock' instead.")] +#else + [UnsupportedOSPlatform ("ios15.0")] + [UnsupportedOSPlatform ("tvos15.0")] + [UnsupportedOSPlatform ("maccatalyst15.0")] + [UnsupportedOSPlatform ("macos12.0")] #endif [DllImport(Constants.CoreMediaLibrary)] static extern unsafe /* CMClockRef */ IntPtr CMTimebaseCopyUltimateMasterClock (/* CMTimebaseRef */ IntPtr timebase); @@ -699,6 +824,89 @@ public static bool MightDrift (CMClockOrTimebase clockOrTimebaseA, CMClockOrTime return CMSyncMightDrift (clockOrTimebaseA.Handle, clockOrTimebaseB.Handle); } + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + [DllImport (Constants.CoreMediaLibrary)] + static extern /* CMTimebase */ IntPtr CMTimebaseCopySourceTimebase (/* CMTimebase */ IntPtr timebase); + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + [DllImport(Constants.CoreMediaLibrary)] + static extern int CMTimebaseSetSourceTimebase (/* CMTimebase */ IntPtr timebase, /* CMTimebase */ IntPtr newSourceTimebase); + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + public CMTimebase? SourceTimebase { + get { + var source = CMTimebaseCopySourceTimebase (Handle); + return Runtime.GetINativeObject (source, true); + } + set { + CMTimebaseSetSourceTimebase (Handle, value.GetHandle ()); + } + } + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + [DllImport(Constants.CoreMediaLibrary)] + static extern /* CMClock */ IntPtr CMTimebaseCopySourceClock (/* CMTimebase */ IntPtr timebase); + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + [DllImport(Constants.CoreMediaLibrary)] + static extern int CMTimebaseSetSourceClock (/* CMTimebase */ IntPtr timebase, /* CMClock */ IntPtr newSourceClock); + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + public CMClock? SourceClock { + get { + var clock = CMTimebaseCopySourceClock (Handle); + return Runtime.GetINativeObject (clock, true); + } + set { + CMTimebaseSetSourceClock (Handle, value.GetHandle()); + } + } + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + [DllImport(Constants.CoreMediaLibrary)] + static extern /* CMClock */ IntPtr CMTimebaseCopyUltimateSourceClock (/* CMTimebase */ IntPtr timebase); + +#if !NET + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] +#else + [SupportedOSPlatform ("ios15.0"), SupportedOSPlatform ("tvos15.0"), SupportedOSPlatform ("macos12.0"), SupportedOSPlatform ("maccatalyst15.0")] +#endif + public CMClock? UltimateSourceClock { + get { + var clock = CMTimebaseCopyUltimateSourceClock (Handle); + return Runtime.GetINativeObject (clock, true); + } + } + #endif // !COREBUILD } } diff --git a/tests/monotouch-test/CoreMedia/CMTimebaseTest.cs b/tests/monotouch-test/CoreMedia/CMTimebaseTest.cs index b9e19cc0e7ea..0406205e4aa0 100644 --- a/tests/monotouch-test/CoreMedia/CMTimebaseTest.cs +++ b/tests/monotouch-test/CoreMedia/CMTimebaseTest.cs @@ -116,5 +116,53 @@ void AssertNullOrValidHandle (INativeObject o, string description) return; Assert.AreNotEqual (IntPtr.Zero, o.Handle, "AssertNullOrValidHandle - " + description); } + + [Test] + public void CMClockConstructor () + { + TestRuntime.AssertXcodeVersion (13,0); + Assert.Throws(() => { + var timebase = new CMTimebase (null, (CMClock) null); + }, "Null clock"); + + // if it throws we fail the test + using var timebase = new CMTimebase (null, CMClock.HostTimeClock); + Assert.NotNull (timebase, "Not null"); + } + + [Test] + public void SourceClockProperty () + { + TestRuntime.AssertXcodeVersion (13,0); + using var timebase = new CMTimebase (null, CMClock.HostTimeClock); + Assert.NotNull (timebase.SourceClock, "not null source clock"); + // set and if it throws we fail the test + timebase.SourceClock = CMClock.HostTimeClock; + } + + [Test] + public void CMTimebaseConstructor () + { + TestRuntime.AssertXcodeVersion (13,0); + Assert.Throws(() => { + var timebase = new CMTimebase (null, (CMTimebase) null); + }, "Null clock"); + + // if it throws we fail the test + using var mainTimebase = new CMTimebase (CMClock.HostTimeClock); + using var timebase = new CMTimebase (null, mainTimebase); + } + + [Test] + public void SourceTimebaseProperty () + { + TestRuntime.AssertXcodeVersion (13,0); + using var mainTimebase = new CMTimebase (CMClock.HostTimeClock); + using var timebase = new CMTimebase (null, mainTimebase); + Assert.NotNull (timebase.SourceTimebase, "Not null timebase"); + // if we throw we fail test test + using var secondTimebase = new CMTimebase (CMClock.HostTimeClock); + timebase.SourceTimebase = secondTimebase; + } } } diff --git a/tests/xtro-sharpie/MacCatalyst-CoreMedia.todo b/tests/xtro-sharpie/MacCatalyst-CoreMedia.todo deleted file mode 100644 index 155b99805fc8..000000000000 --- a/tests/xtro-sharpie/MacCatalyst-CoreMedia.todo +++ /dev/null @@ -1,20 +0,0 @@ -!missing-field! kCMFormatDescriptionExtension_AmbientViewingEnvironment not bound -!missing-field! kCMFormatDescriptionExtension_BitsPerComponent not bound -!missing-field! kCMFormatDescriptionExtension_HorizontalFieldOfView not bound -!missing-pinvoke! CMTimebaseCopySource is not bound -!missing-pinvoke! CMTimebaseCopySourceClock is not bound -!missing-pinvoke! CMTimebaseCopySourceTimebase is not bound -!missing-pinvoke! CMTimebaseCopyUltimateSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceTimebase is not bound -!missing-pinvoke! CMTimebaseSetSourceClock is not bound -!missing-pinvoke! CMTimebaseSetSourceTimebase is not bound -!unknown-pinvoke! CMTimebaseCopyMaster bound -!unknown-pinvoke! CMTimebaseCopyMasterClock bound -!unknown-pinvoke! CMTimebaseCopyMasterTimebase bound -!unknown-pinvoke! CMTimebaseCopyUltimateMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterTimebase bound -!unknown-pinvoke! CMTimebaseSetMasterClock bound -!unknown-pinvoke! CMTimebaseSetMasterTimebase bound -!missing-field! kCMSampleAttachmentKey_CryptorSubsampleAuxiliaryData not bound diff --git a/tests/xtro-sharpie/common-CoreMedia.ignore b/tests/xtro-sharpie/common-CoreMedia.ignore index f14fd2e8b975..cf388945c3a9 100644 --- a/tests/xtro-sharpie/common-CoreMedia.ignore +++ b/tests/xtro-sharpie/common-CoreMedia.ignore @@ -46,6 +46,9 @@ !missing-field! kCMFormatDescriptionExtension_AuxiliaryTypeInfo not bound !missing-field! kCMFormatDescriptionExtension_ContainsAlphaChannel not bound !missing-field! kCMFormatDescriptionExtension_ProtectedContentOriginalFormat not bound +!missing-field! kCMFormatDescriptionExtension_AmbientViewingEnvironment not bound +!missing-field! kCMFormatDescriptionExtension_BitsPerComponent not bound +!missing-field! kCMFormatDescriptionExtension_HorizontalFieldOfView not bound !missing-field! kCMFormatDescriptionExtensionKey_MetadataKeyTable not bound !missing-field! kCMFormatDescriptionFieldDetail_SpatialFirstLineEarly not bound !missing-field! kCMFormatDescriptionFieldDetail_SpatialFirstLineLate not bound @@ -378,6 +381,7 @@ !missing-pinvoke! CMVideoFormatDescriptionCopyAsBigEndianImageDescriptionBlockBuffer is not bound !missing-pinvoke! CMVideoFormatDescriptionCreateFromBigEndianImageDescriptionBlockBuffer is not bound !missing-pinvoke! CMVideoFormatDescriptionCreateFromBigEndianImageDescriptionData is not bound +!missing-field! kCMSampleAttachmentKey_CryptorSubsampleAuxiliaryData not bound ## block based version of CMBufferQueueCreate (which use callbacks and is already bound) !missing-pinvoke! CMBufferQueueCreateWithHandlers is not bound @@ -387,3 +391,17 @@ ## block based version of CMSampleBufferCreateForImageBuffer (which use callbacks and is already bound) !missing-pinvoke! CMSampleBufferCreateForImageBufferWithMakeDataReadyHandler is not bound + +# they are added because we need to be back compatible yet we do have code to choose the correct one +!unknown-pinvoke! CMTimebaseCopyMaster bound +!unknown-pinvoke! CMTimebaseCopyMasterClock bound +!unknown-pinvoke! CMTimebaseCopyMasterTimebase bound +!unknown-pinvoke! CMTimebaseCopyUltimateMasterClock bound +!unknown-pinvoke! CMTimebaseCreateWithMasterClock bound +!unknown-pinvoke! CMTimebaseCreateWithMasterTimebase bound +!unknown-pinvoke! CMTimebaseSetMasterClock bound +!unknown-pinvoke! CMTimebaseSetMasterTimebase bound + +# it can return a Clock or a Timebase but the API already has a way to access the clock source (CMTimebaseCopySourceClock) +# and the Timebase (CMTimebaseCopySourceTimebase) so there is no reason atm to add this method +!missing-pinvoke! CMTimebaseCopySource is not bound diff --git a/tests/xtro-sharpie/iOS-CoreMedia.todo b/tests/xtro-sharpie/iOS-CoreMedia.todo deleted file mode 100644 index 5cb5e32db156..000000000000 --- a/tests/xtro-sharpie/iOS-CoreMedia.todo +++ /dev/null @@ -1,28 +0,0 @@ -!deprecated-attribute-missing! CMTimebaseCopyMaster missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyUltimateMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterTimebase missing a [Deprecated] attribute -!missing-field! kCMFormatDescriptionExtension_AmbientViewingEnvironment not bound -!missing-field! kCMFormatDescriptionExtension_BitsPerComponent not bound -!missing-field! kCMFormatDescriptionExtension_HorizontalFieldOfView not bound -!missing-pinvoke! CMTimebaseCopySource is not bound -!missing-pinvoke! CMTimebaseCopySourceClock is not bound -!missing-pinvoke! CMTimebaseCopySourceTimebase is not bound -!missing-pinvoke! CMTimebaseCopyUltimateSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceTimebase is not bound -!missing-pinvoke! CMTimebaseSetSourceClock is not bound -!missing-pinvoke! CMTimebaseSetSourceTimebase is not bound -!unknown-pinvoke! CMTimebaseCopyMaster bound -!unknown-pinvoke! CMTimebaseCopyMasterClock bound -!unknown-pinvoke! CMTimebaseCopyMasterTimebase bound -!unknown-pinvoke! CMTimebaseCopyUltimateMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterTimebase bound -!unknown-pinvoke! CMTimebaseSetMasterClock bound -!unknown-pinvoke! CMTimebaseSetMasterTimebase bound -!missing-field! kCMSampleAttachmentKey_CryptorSubsampleAuxiliaryData not bound diff --git a/tests/xtro-sharpie/macOS-CoreMedia.todo b/tests/xtro-sharpie/macOS-CoreMedia.todo deleted file mode 100644 index 5cb5e32db156..000000000000 --- a/tests/xtro-sharpie/macOS-CoreMedia.todo +++ /dev/null @@ -1,28 +0,0 @@ -!deprecated-attribute-missing! CMTimebaseCopyMaster missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyUltimateMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterTimebase missing a [Deprecated] attribute -!missing-field! kCMFormatDescriptionExtension_AmbientViewingEnvironment not bound -!missing-field! kCMFormatDescriptionExtension_BitsPerComponent not bound -!missing-field! kCMFormatDescriptionExtension_HorizontalFieldOfView not bound -!missing-pinvoke! CMTimebaseCopySource is not bound -!missing-pinvoke! CMTimebaseCopySourceClock is not bound -!missing-pinvoke! CMTimebaseCopySourceTimebase is not bound -!missing-pinvoke! CMTimebaseCopyUltimateSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceTimebase is not bound -!missing-pinvoke! CMTimebaseSetSourceClock is not bound -!missing-pinvoke! CMTimebaseSetSourceTimebase is not bound -!unknown-pinvoke! CMTimebaseCopyMaster bound -!unknown-pinvoke! CMTimebaseCopyMasterClock bound -!unknown-pinvoke! CMTimebaseCopyMasterTimebase bound -!unknown-pinvoke! CMTimebaseCopyUltimateMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterTimebase bound -!unknown-pinvoke! CMTimebaseSetMasterClock bound -!unknown-pinvoke! CMTimebaseSetMasterTimebase bound -!missing-field! kCMSampleAttachmentKey_CryptorSubsampleAuxiliaryData not bound diff --git a/tests/xtro-sharpie/tvOS-CoreMedia.todo b/tests/xtro-sharpie/tvOS-CoreMedia.todo deleted file mode 100644 index 5cb5e32db156..000000000000 --- a/tests/xtro-sharpie/tvOS-CoreMedia.todo +++ /dev/null @@ -1,28 +0,0 @@ -!deprecated-attribute-missing! CMTimebaseCopyMaster missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyUltimateMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterTimebase missing a [Deprecated] attribute -!missing-field! kCMFormatDescriptionExtension_AmbientViewingEnvironment not bound -!missing-field! kCMFormatDescriptionExtension_BitsPerComponent not bound -!missing-field! kCMFormatDescriptionExtension_HorizontalFieldOfView not bound -!missing-pinvoke! CMTimebaseCopySource is not bound -!missing-pinvoke! CMTimebaseCopySourceClock is not bound -!missing-pinvoke! CMTimebaseCopySourceTimebase is not bound -!missing-pinvoke! CMTimebaseCopyUltimateSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceTimebase is not bound -!missing-pinvoke! CMTimebaseSetSourceClock is not bound -!missing-pinvoke! CMTimebaseSetSourceTimebase is not bound -!unknown-pinvoke! CMTimebaseCopyMaster bound -!unknown-pinvoke! CMTimebaseCopyMasterClock bound -!unknown-pinvoke! CMTimebaseCopyMasterTimebase bound -!unknown-pinvoke! CMTimebaseCopyUltimateMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterTimebase bound -!unknown-pinvoke! CMTimebaseSetMasterClock bound -!unknown-pinvoke! CMTimebaseSetMasterTimebase bound -!missing-field! kCMSampleAttachmentKey_CryptorSubsampleAuxiliaryData not bound diff --git a/tests/xtro-sharpie/watchOS-CoreMedia.todo b/tests/xtro-sharpie/watchOS-CoreMedia.todo deleted file mode 100644 index 5cb5e32db156..000000000000 --- a/tests/xtro-sharpie/watchOS-CoreMedia.todo +++ /dev/null @@ -1,28 +0,0 @@ -!deprecated-attribute-missing! CMTimebaseCopyMaster missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCopyUltimateMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseCreateWithMasterTimebase missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterClock missing a [Deprecated] attribute -!deprecated-attribute-missing! CMTimebaseSetMasterTimebase missing a [Deprecated] attribute -!missing-field! kCMFormatDescriptionExtension_AmbientViewingEnvironment not bound -!missing-field! kCMFormatDescriptionExtension_BitsPerComponent not bound -!missing-field! kCMFormatDescriptionExtension_HorizontalFieldOfView not bound -!missing-pinvoke! CMTimebaseCopySource is not bound -!missing-pinvoke! CMTimebaseCopySourceClock is not bound -!missing-pinvoke! CMTimebaseCopySourceTimebase is not bound -!missing-pinvoke! CMTimebaseCopyUltimateSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceClock is not bound -!missing-pinvoke! CMTimebaseCreateWithSourceTimebase is not bound -!missing-pinvoke! CMTimebaseSetSourceClock is not bound -!missing-pinvoke! CMTimebaseSetSourceTimebase is not bound -!unknown-pinvoke! CMTimebaseCopyMaster bound -!unknown-pinvoke! CMTimebaseCopyMasterClock bound -!unknown-pinvoke! CMTimebaseCopyMasterTimebase bound -!unknown-pinvoke! CMTimebaseCopyUltimateMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterClock bound -!unknown-pinvoke! CMTimebaseCreateWithMasterTimebase bound -!unknown-pinvoke! CMTimebaseSetMasterClock bound -!unknown-pinvoke! CMTimebaseSetMasterTimebase bound -!missing-field! kCMSampleAttachmentKey_CryptorSubsampleAuxiliaryData not bound