diff --git a/src/CoreVideo/CVBuffer.cs b/src/CoreVideo/CVBuffer.cs index 76e0f8ef270..4f1bb523637 100644 --- a/src/CoreVideo/CVBuffer.cs +++ b/src/CoreVideo/CVBuffer.cs @@ -31,6 +31,8 @@ using ObjCRuntime; using Foundation; +#nullable enable + namespace CoreVideo { // CVBuffer.h diff --git a/src/CoreVideo/CVDisplayLink.cs b/src/CoreVideo/CVDisplayLink.cs index 70fcc472237..213132fbe59 100644 --- a/src/CoreVideo/CVDisplayLink.cs +++ b/src/CoreVideo/CVDisplayLink.cs @@ -32,6 +32,8 @@ using Foundation; using OpenGL; +#nullable enable + namespace CoreVideo { public class CVDisplayLink : INativeObject, IDisposable { IntPtr handle; diff --git a/src/CoreVideo/CVEnums.cs b/src/CoreVideo/CVEnums.cs index cc3d645989a..947e3931a38 100644 --- a/src/CoreVideo/CVEnums.cs +++ b/src/CoreVideo/CVEnums.cs @@ -31,6 +31,8 @@ using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreVideo { // uint32_t -> CVBuffer.h diff --git a/src/CoreVideo/CVImageBuffer.cs b/src/CoreVideo/CVImageBuffer.cs index 3e8a05e146f..0efbbb62036 100644 --- a/src/CoreVideo/CVImageBuffer.cs +++ b/src/CoreVideo/CVImageBuffer.cs @@ -32,6 +32,8 @@ using Foundation; using CoreGraphics; +#nullable enable + namespace CoreVideo { // CVImageBuffer.h @@ -93,7 +95,7 @@ public bool IsFlipped { [Deprecated (PlatformName.MacOSX, 10, 4)] [Unavailable (PlatformName.iOS)] - public CGColorSpace ColorSpace { + public CGColorSpace? ColorSpace { get { var h = CVImageBufferGetColorSpace (handle); return h == IntPtr.Zero ? null : new CGColorSpace (h); @@ -105,7 +107,7 @@ public CGColorSpace ColorSpace { #if IOS [Obsolete ("This API is not available on this platform.")] #endif - public CGColorSpace ColorSpace { + public CGColorSpace? ColorSpace { get { return null; } @@ -116,7 +118,7 @@ public CGColorSpace ColorSpace { [DllImport (Constants.CoreVideoLibrary)] extern static /* CGColorSpaceRef */ IntPtr CVImageBufferCreateColorSpaceFromAttachments (/* CFDictionaryRef */ IntPtr attachments); - public static CGColorSpace CreateFrom (NSDictionary attachments) + public static CGColorSpace? CreateFrom (NSDictionary attachments) { if (attachments == null) throw new ArgumentNullException ("attachments"); @@ -132,7 +134,7 @@ public static CGColorSpace CreateFrom (NSDictionary attachments) [iOS (11, 0), Mac (10, 13), TV (11, 0)] public static int GetCodePoint (CVImageBufferYCbCrMatrix yCbCrMatrix) { - return CVYCbCrMatrixGetIntegerCodePointForString (yCbCrMatrix.GetConstant ().Handle); + return CVYCbCrMatrixGetIntegerCodePointForString (yCbCrMatrix.GetConstant ()!.Handle); } [DllImport (Constants.CoreVideoLibrary)] @@ -142,7 +144,7 @@ public static int GetCodePoint (CVImageBufferYCbCrMatrix yCbCrMatrix) [iOS (11, 0), Mac (10, 13), TV (11, 0)] public static int GetCodePoint (CVImageBufferColorPrimaries color) { - return CVColorPrimariesGetIntegerCodePointForString (color.GetConstant ().Handle); + return CVColorPrimariesGetIntegerCodePointForString (color.GetConstant ()!.Handle); } [DllImport (Constants.CoreVideoLibrary)] @@ -152,7 +154,7 @@ public static int GetCodePoint (CVImageBufferColorPrimaries color) [iOS (11, 0), Mac (10, 13), TV (11, 0)] public static int GetCodePoint (CVImageBufferTransferFunction function) { - return CVTransferFunctionGetIntegerCodePointForString (function.GetConstant ().Handle); + return CVTransferFunctionGetIntegerCodePointForString (function.GetConstant ()!.Handle); } [DllImport (Constants.CoreVideoLibrary)] diff --git a/src/CoreVideo/CVMetalTexture.cs b/src/CoreVideo/CVMetalTexture.cs index 904876a43bb..881eec630ab 100644 --- a/src/CoreVideo/CVMetalTexture.cs +++ b/src/CoreVideo/CVMetalTexture.cs @@ -18,6 +18,8 @@ using Foundation; using Metal; +#nullable enable + namespace CoreVideo { [iOS (8,0)] diff --git a/src/CoreVideo/CVMetalTextureAttributes.cs b/src/CoreVideo/CVMetalTextureAttributes.cs index 47d44aae4f0..9963eec5f06 100644 --- a/src/CoreVideo/CVMetalTextureAttributes.cs +++ b/src/CoreVideo/CVMetalTextureAttributes.cs @@ -11,6 +11,8 @@ using Foundation; using Metal; +#nullable enable + namespace CoreVideo { public partial class CVMetalTextureAttributes : DictionaryContainer { diff --git a/src/CoreVideo/CVMetalTextureCache.cs b/src/CoreVideo/CVMetalTextureCache.cs index a5bfa452ce0..a35843affd0 100644 --- a/src/CoreVideo/CVMetalTextureCache.cs +++ b/src/CoreVideo/CVMetalTextureCache.cs @@ -17,6 +17,8 @@ using Foundation; using Metal; +#nullable enable + namespace CoreVideo { [iOS (8,0)] @@ -74,7 +76,7 @@ public CVMetalTextureCache (IMTLDevice metalDevice) throw new Exception ("Could not create the texture cache"); } - public static CVMetalTextureCache FromDevice (IMTLDevice metalDevice) + public static CVMetalTextureCache? FromDevice (IMTLDevice metalDevice) { if (metalDevice == null) throw new ArgumentNullException ("metalDevice"); @@ -104,7 +106,7 @@ public CVMetalTextureCache (IMTLDevice metalDevice, CVMetalTextureAttributes tex throw new Exception ($"Could not create the texture cache, Reason: {err}."); } - public static CVMetalTextureCache FromDevice (IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes, out CVReturn creationErr) + public static CVMetalTextureCache? FromDevice (IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes, out CVReturn creationErr) { if (metalDevice == null) throw new ArgumentNullException (nameof (metalDevice)); @@ -119,13 +121,13 @@ public static CVMetalTextureCache FromDevice (IMTLDevice metalDevice, CVMetalTex return null; } - public static CVMetalTextureCache FromDevice (IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes) + public static CVMetalTextureCache? FromDevice (IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes) { CVReturn creationErr; return FromDevice (metalDevice, textureAttributes, out creationErr); } - public CVMetalTexture TextureFromImage (CVImageBuffer imageBuffer, MTLPixelFormat format, nint width, nint height, nint planeIndex, out CVReturn errorCode) + public CVMetalTexture? TextureFromImage (CVImageBuffer imageBuffer, MTLPixelFormat format, nint width, nint height, nint planeIndex, out CVReturn errorCode) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); diff --git a/src/CoreVideo/CVOpenGLESTexture.cs b/src/CoreVideo/CVOpenGLESTexture.cs index edffea40b07..8b16f3b962f 100644 --- a/src/CoreVideo/CVOpenGLESTexture.cs +++ b/src/CoreVideo/CVOpenGLESTexture.cs @@ -22,6 +22,8 @@ using Foundation; using OpenGLES; +#nullable enable + namespace CoreVideo { // CVOpenGLESTexture.h diff --git a/src/CoreVideo/CVOpenGLESTextureCache.cs b/src/CoreVideo/CVOpenGLESTextureCache.cs index 80cbcf5627a..6a229d190fe 100644 --- a/src/CoreVideo/CVOpenGLESTextureCache.cs +++ b/src/CoreVideo/CVOpenGLESTextureCache.cs @@ -21,6 +21,8 @@ using Foundation; using OpenGLES; +#nullable enable + namespace CoreVideo { // CVOpenGLESTextureCache.h diff --git a/src/CoreVideo/CVPixelBuffer.cs b/src/CoreVideo/CVPixelBuffer.cs index cbfd3d5560e..aef0f80a55a 100644 --- a/src/CoreVideo/CVPixelBuffer.cs +++ b/src/CoreVideo/CVPixelBuffer.cs @@ -11,6 +11,14 @@ using CoreFoundation; using ObjCRuntime; using Foundation; +#if NET +using System.Runtime.Versioning; +#endif + +using CFDictionaryRef=System.IntPtr; +using CVPixelBufferRef=System.IntPtr; + +#nullable enable namespace CoreVideo { @@ -38,17 +46,17 @@ extern static CVReturn CVPixelBufferCreate ( /* CVPixelBufferRef __nullable * __nonnull */ out IntPtr pixelBufferOut); public CVPixelBuffer (nint width, nint height, CVPixelFormatType pixelFormat) - : this (width, height, pixelFormat, (NSDictionary) null) + : this (width, height, pixelFormat, (NSDictionary?) null) { } - public CVPixelBuffer (nint width, nint height, CVPixelFormatType pixelFormatType, CVPixelBufferAttributes attributes) + public CVPixelBuffer (nint width, nint height, CVPixelFormatType pixelFormatType, CVPixelBufferAttributes? attributes) : this (width, height, pixelFormatType, attributes == null ? null : attributes.Dictionary) { } [Advice ("Use constructor with CVPixelBufferAttributes")] - CVPixelBuffer (nint width, nint height, CVPixelFormatType pixelFormatType, NSDictionary pixelBufferAttributes) + CVPixelBuffer (nint width, nint height, CVPixelFormatType pixelFormatType, NSDictionary? pixelBufferAttributes) { if (width <= 0) throw new ArgumentOutOfRangeException ("width"); @@ -84,6 +92,30 @@ public NSDictionary GetAttributes (NSDictionary [] attributes) throw new ArgumentException (ret.ToString ()); return Runtime.GetNSObject (resolvedDictionaryOut); } + +#if NET + [SupportedOSPlatform ("ios15.0")] + [SupportedOSPlatform ("tvos15.0")] + [SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("maccatalyst")] +#else + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), NoMacCatalyst] +#endif + [DllImport (Constants.CoreVideoLibrary)] + static extern CFDictionaryRef CVPixelBufferCopyCreationAttributes (CVPixelBufferRef pixelBuffer); + +#if NET + [SupportedOSPlatform ("ios15.0")] + [SupportedOSPlatform ("tvos15.0")] + [SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("maccatalyst")] +#else + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), NoMacCatalyst] +#endif + public CVPixelBufferAttributes? GetPixelBufferCreationAttributes () { + var attrs = CVPixelBufferCopyCreationAttributes (handle); + return (attrs == IntPtr.Zero) ? null : new CVPixelBufferAttributes (new NSDictionary (attrs)); + } #endif /* CVPixelBufferCreateWithBytes */ @@ -114,13 +146,13 @@ static extern CVReturn CVPixelBufferCreateWithBytes ( /* CFDictionaryRef CV_NULLABLE */ IntPtr pixelBufferAttributes, /* CV_RETURNS_RETAINED_PARAMETER CVPixelBufferRef CV_NULLABLE * CV_NONNULL */ out IntPtr pixelBufferOut);// __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0); - public static CVPixelBuffer Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[] data, nint bytesPerRow, CVPixelBufferAttributes pixelBufferAttributes) + public static CVPixelBuffer? Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[] data, nint bytesPerRow, CVPixelBufferAttributes pixelBufferAttributes) { CVReturn status; return Create (width, height, pixelFormatType, data, bytesPerRow, pixelBufferAttributes, out status); } - public static CVPixelBuffer Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[] data, nint bytesPerRow, CVPixelBufferAttributes pixelBufferAttributes, out CVReturn status) + public static CVPixelBuffer? Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[] data, nint bytesPerRow, CVPixelBufferAttributes pixelBufferAttributes, out CVReturn status) { IntPtr handle; GCHandle gchandle; @@ -147,7 +179,7 @@ public static CVPixelBuffer Create (nint width, nint height, CVPixelFormatType p class PlaneData { - public GCHandle[] dataHandles; + public GCHandle[] dataHandles = Array.Empty (); } delegate void CVPixelBufferReleasePlanarBytesCallback ( @@ -163,7 +195,7 @@ delegate void CVPixelBufferReleasePlanarBytesCallback ( static void ReleasePlanarBytesCallback (IntPtr releaseRefCon, IntPtr dataPtr, nint dataSize, nint numberOfPlanes, IntPtr planeAddresses) { GCHandle handle = GCHandle.FromIntPtr (releaseRefCon); - PlaneData data = (PlaneData) handle.Target; + PlaneData data = (PlaneData) handle.Target!; for (int i = 0; i < data.dataHandles.Length; i++) data.dataHandles[i].Free (); handle.Free (); @@ -187,13 +219,13 @@ static extern CVReturn CVPixelBufferCreateWithPlanarBytes ( /* CFDictionaryRef CV_NULLABLE */ IntPtr pixelBufferAttributes, /* CV_RETURNS_RETAINED_PARAMETER CVPixelBufferRef CV_NULLABLE * CV_NONNULL */ out IntPtr pixelBufferOut); // __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_4_0); - public static CVPixelBuffer Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[][] planes, nint[] planeWidths, nint[] planeHeights, nint[] planeBytesPerRow, CVPixelBufferAttributes pixelBufferAttributes) + public static CVPixelBuffer? Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[][] planes, nint[] planeWidths, nint[] planeHeights, nint[] planeBytesPerRow, CVPixelBufferAttributes pixelBufferAttributes) { CVReturn status; return Create (width, height, pixelFormatType, planes, planeWidths, planeHeights, planeBytesPerRow, pixelBufferAttributes, out status); } - public static CVPixelBuffer Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[][] planes, nint[] planeWidths, nint[] planeHeights, nint[] planeBytesPerRow, CVPixelBufferAttributes pixelBufferAttributes, out CVReturn status) + public static CVPixelBuffer? Create (nint width, nint height, CVPixelFormatType pixelFormatType, byte[][] planes, nint[] planeWidths, nint[] planeHeights, nint[] planeBytesPerRow, CVPixelBufferAttributes pixelBufferAttributes, out CVReturn status) { IntPtr handle; IntPtr[] addresses; diff --git a/src/CoreVideo/CVPixelBufferAttributes.cs b/src/CoreVideo/CVPixelBufferAttributes.cs index 0adbb45be0d..5e31296f759 100644 --- a/src/CoreVideo/CVPixelBufferAttributes.cs +++ b/src/CoreVideo/CVPixelBufferAttributes.cs @@ -30,6 +30,8 @@ using CoreFoundation; using ObjCRuntime; +#nullable enable + namespace CoreVideo { [Watch (4,0)] @@ -63,7 +65,7 @@ public CVPixelFormatType? PixelFormatType { } } - public CFAllocator MemoryAllocator { + public CFAllocator? MemoryAllocator { get { return GetNativeValue (CVPixelBuffer.MemoryAllocatorKey); } diff --git a/src/CoreVideo/CVPixelBufferIOSurface.cs b/src/CoreVideo/CVPixelBufferIOSurface.cs index 248307c36ad..f73612f1bdc 100644 --- a/src/CoreVideo/CVPixelBufferIOSurface.cs +++ b/src/CoreVideo/CVPixelBufferIOSurface.cs @@ -13,6 +13,8 @@ using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreVideo { public partial class CVPixelBuffer : CVImageBuffer { @@ -23,7 +25,7 @@ public partial class CVPixelBuffer : CVImageBuffer { ); [iOS (11,0), Mac (10,13), TV (11,0), NoWatch] - public IOSurface.IOSurface GetIOSurface () + public IOSurface.IOSurface? GetIOSurface () { if (Handle == IntPtr.Zero) throw new ObjectDisposedException ("CVPixelBuffer"); @@ -45,7 +47,7 @@ public IOSurface.IOSurface GetIOSurface () ); [iOS (11,0), Mac (10,13), TV (11,0), NoWatch] - public static CVPixelBuffer Create (IOSurface.IOSurface surface, out CVReturn result, CVPixelBufferAttributes pixelBufferAttributes = null) + public static CVPixelBuffer? Create (IOSurface.IOSurface surface, out CVReturn result, CVPixelBufferAttributes? pixelBufferAttributes = null) { if (surface == null) throw new ArgumentNullException (nameof (surface)); @@ -65,7 +67,7 @@ public static CVPixelBuffer Create (IOSurface.IOSurface surface, out CVReturn re } [iOS (11,0), Mac (10,13), TV (11,0), NoWatch] - public static CVPixelBuffer Create (IOSurface.IOSurface surface, CVPixelBufferAttributes pixelBufferAttributes = null) + public static CVPixelBuffer? Create (IOSurface.IOSurface surface, CVPixelBufferAttributes? pixelBufferAttributes = null) { CVReturn result; return Create (surface, out result, pixelBufferAttributes); diff --git a/src/CoreVideo/CVPixelBufferPool.cs b/src/CoreVideo/CVPixelBufferPool.cs index ceb8326d8e8..2e111316cda 100644 --- a/src/CoreVideo/CVPixelBufferPool.cs +++ b/src/CoreVideo/CVPixelBufferPool.cs @@ -13,6 +13,8 @@ using ObjCRuntime; using Foundation; +#nullable enable + namespace CoreVideo { // CVPixelBufferPool.h @@ -101,7 +103,7 @@ public NSDictionary Attributes { } } - public CVPixelBufferPoolSettings Settings { + public CVPixelBufferPoolSettings? Settings { get { var attr = Attributes; return attr == null ? null : new CVPixelBufferPoolSettings (attr); @@ -132,7 +134,7 @@ extern static CVReturn CVPixelBufferPoolCreatePixelBufferWithAuxAttributes ( /* CFDictionaryRef __nullable */ IntPtr auxAttributes, /* CVPixelBufferRef __nullable * __nonnull */ out IntPtr pixelBufferOut); - public CVPixelBuffer CreatePixelBuffer (CVPixelBufferPoolAllocationSettings allocationSettings, out CVReturn error) + public CVPixelBuffer? CreatePixelBuffer (CVPixelBufferPoolAllocationSettings allocationSettings, out CVReturn error) { IntPtr pb; error = CVPixelBufferPoolCreatePixelBufferWithAuxAttributes (IntPtr.Zero, handle, allocationSettings.GetHandle (), out pb); @@ -159,7 +161,7 @@ public CVPixelBufferPool (NSDictionary poolAttributes, NSDictionary pixelBufferA } public CVPixelBufferPool (CVPixelBufferPoolSettings settings, CVPixelBufferAttributes pixelBufferAttributes) - : this (settings.GetDictionary (), pixelBufferAttributes.GetDictionary ()) + : this (settings.GetDictionary ()!, pixelBufferAttributes.GetDictionary ()!) { } diff --git a/src/CoreVideo/CVPixelBufferPoolSettings.cs b/src/CoreVideo/CVPixelBufferPoolSettings.cs index 492ad11e90c..898465a3799 100644 --- a/src/CoreVideo/CVPixelBufferPoolSettings.cs +++ b/src/CoreVideo/CVPixelBufferPoolSettings.cs @@ -31,6 +31,8 @@ using CoreFoundation; using ObjCRuntime; +#nullable enable + namespace CoreVideo { [Watch (4,0)] diff --git a/src/CoreVideo/CVPixelFormatDescription.cs b/src/CoreVideo/CVPixelFormatDescription.cs index d9edd9f91b5..f34c9fcc72b 100644 --- a/src/CoreVideo/CVPixelFormatDescription.cs +++ b/src/CoreVideo/CVPixelFormatDescription.cs @@ -31,6 +31,8 @@ using ObjCRuntime; using Foundation; +#nullable enable + namespace CoreVideo { [Watch (4,0)] diff --git a/src/CoreVideo/CVPixelFormatType.cs b/src/CoreVideo/CVPixelFormatType.cs index 38783365590..8a7dea35147 100644 --- a/src/CoreVideo/CVPixelFormatType.cs +++ b/src/CoreVideo/CVPixelFormatType.cs @@ -27,7 +27,13 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; +using System.Runtime.InteropServices; using ObjCRuntime; +#if NET +using System.Runtime.Versioning; +#endif + +#nullable enable namespace CoreVideo { @@ -121,4 +127,32 @@ public enum CVPixelFormatType : uint { // iOS 14.2 CV64RgbaLE = 0x6C363472, } + +#if !COREBUILD + public static class CVPixelFormatTypeExtensions { + +#if NET + [SupportedOSPlatform ("ios15.0")] + [SupportedOSPlatform ("tvos15.0")] + [SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("maccatalyst")] +#else + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), NoMacCatalyst] +#endif + [DllImport (Constants.CoreVideoLibrary)] + [return: MarshalAs (UnmanagedType.I1)] + static extern bool CVIsCompressedPixelFormatAvailable (uint pixelFormatType); + +#if NET + [SupportedOSPlatform ("ios15.0")] + [SupportedOSPlatform ("tvos15.0")] + [SupportedOSPlatform ("macos12.0")] + [UnsupportedOSPlatform ("maccatalyst")] +#else + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), NoMacCatalyst] +#endif + public static bool IsCompressedPixelFormatAvailable (this CVPixelFormatType type) + => CVIsCompressedPixelFormatAvailable ((uint) type); + } +#endif } diff --git a/src/CoreVideo/CVTime.cs b/src/CoreVideo/CVTime.cs index 84fde9d725d..2f44d4de154 100644 --- a/src/CoreVideo/CVTime.cs +++ b/src/CoreVideo/CVTime.cs @@ -30,6 +30,8 @@ using CoreFoundation; using ObjCRuntime; +#nullable enable + namespace CoreVideo { // CVBase.h @@ -45,13 +47,13 @@ public struct CVTime { #if !COREBUILD public static CVTime ZeroTime { get { - return (CVTime) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVZeroTime"), typeof (CVTime)); + return (CVTime) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVZeroTime"), typeof (CVTime))!; } } public static CVTime IndefiniteTime { get { - return (CVTime) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVIndefiniteTime"), typeof (CVTime)); + return (CVTime) Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVIndefiniteTime"), typeof (CVTime))!; } } #endif diff --git a/src/CoreVideo/CoreVideo.cs b/src/CoreVideo/CoreVideo.cs index ac69aebffad..196c04bffe8 100644 --- a/src/CoreVideo/CoreVideo.cs +++ b/src/CoreVideo/CoreVideo.cs @@ -31,6 +31,8 @@ using Foundation; using ObjCRuntime; +#nullable enable + namespace CoreVideo { // CVPixelBuffer.h diff --git a/src/corevideo.cs b/src/corevideo.cs index fe6327007cc..87f3002ab54 100644 --- a/src/corevideo.cs +++ b/src/corevideo.cs @@ -261,6 +261,14 @@ interface CVImageBuffer : CVBuffer { [TV (13, 0), NoWatch, Mac (10, 15), iOS (13, 0)] [Field ("kCVImageBufferAlphaChannelModeKey")] NSString AlphaChannelModeKey { get; } + + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("kCVImageBufferRegionOfInterestKey")] + NSString RegionOfInterestKey { get; } + + [Watch (8,0), TV (15,0), Mac (12,0), iOS (15,0), MacCatalyst (15,0)] + [Field ("kCVImageBufferAmbientViewingEnvironmentKey")] + NSString AmbientViewingEnvironmentKey { get; } } [Watch (4,0)] @@ -428,58 +436,47 @@ interface CVPixelBuffer { [Field ("kCVPixelBufferMetalCompatibilityKey")] NSString MetalCompatibilityKey { get; } -#if MONOMAC - [Mac (10,11)] + [NoiOS, NoTV, NoWatch, Mac (10,11), MacCatalyst (15,0)] [Field ("kCVPixelBufferOpenGLTextureCacheCompatibilityKey")] NSString OpenGLTextureCacheCompatibilityKey { get; } -#endif - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_BlackLevel")] NSString ProResRawKey_BlackLevel { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_ColorMatrix")] NSString ProResRawKey_ColorMatrix { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_GainFactor")] NSString ProResRawKey_GainFactor { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac(12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_RecommendedCrop")] NSString ProResRawKey_RecommendedCrop { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_SenselSitingOffsets")] NSString ProResRawKey_SenselSitingOffsets { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_WhiteBalanceBlueFactor")] NSString ProResRawKey_WhiteBalanceBlueFactor { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_WhiteBalanceCCT")] NSString ProResRawKey_WhiteBalanceCct { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_WhiteBalanceRedFactor")] NSString ProResRawKey_WhiteBalanceRedFactor { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferProResRAWKey_WhiteLevel")] NSString ProResRawKey_WhiteLevel { get; } - [Unavailable (PlatformName.MacCatalyst), Advice ("This API is not available when using MacCatalyst.")] - [NoWatch, NoTV, NoMac, iOS (14, 0)] + [NoWatch, NoTV, Mac (12,0), iOS (14, 0), MacCatalyst (15,0)] [Field ("kCVPixelBufferVersatileBayerKey_BayerPattern")] NSString VersatileBayerKey_BayerPattern { get; } } diff --git a/src/frameworks.sources b/src/frameworks.sources index 40ce7211359..e2968fb00cc 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -656,7 +656,6 @@ CORETELEPHONY_CORE_SOURCES = \ COREVIDEO_API_SOURCES = \ CoreVideo/CVEnums.cs \ - CoreVideo/CVPixelFormatType.cs \ COREVIDEO_CORE_SOURCES = \ CoreVideo/CoreVideo.cs \ @@ -665,6 +664,7 @@ COREVIDEO_CORE_SOURCES = \ CoreVideo/CVPixelBuffer.cs \ CoreVideo/CVPixelBufferAttributes.cs \ CoreVideo/CVPixelBufferPool.cs \ + CoreVideo/CVPixelFormatType.cs \ COREVIDEO_SOURCES = \ CoreVideo/CVDisplayLink.cs \ diff --git a/tests/xtro-sharpie/MacCatalyst-CoreVideo.ignore b/tests/xtro-sharpie/MacCatalyst-CoreVideo.ignore index 562087150eb..08f7fd7d4de 100644 --- a/tests/xtro-sharpie/MacCatalyst-CoreVideo.ignore +++ b/tests/xtro-sharpie/MacCatalyst-CoreVideo.ignore @@ -1,2 +1,48 @@ !missing-field! kCVPixelBufferOpenGLESCompatibilityKey not bound !missing-field! kCVPixelBufferOpenGLESTextureCacheCompatibilityKey not bound + +## deprecated in favor of metal +!missing-field! kCVOpenGLBufferHeight not bound +!missing-field! kCVOpenGLBufferInternalFormat not bound +!missing-field! kCVOpenGLBufferMaximumMipmapLevel not bound +!missing-field! kCVOpenGLBufferPoolMaximumBufferAgeKey not bound +!missing-field! kCVOpenGLBufferPoolMinimumBufferCountKey not bound +!missing-field! kCVOpenGLBufferTarget not bound +!missing-field! kCVOpenGLBufferWidth not bound +!missing-field! kCVOpenGLTextureCacheChromaSamplingModeAutomatic not bound +!missing-field! kCVOpenGLTextureCacheChromaSamplingModeBestPerformance not bound +!missing-field! kCVOpenGLTextureCacheChromaSamplingModeHighestQuality not bound +!missing-field! kCVOpenGLTextureCacheChromaSamplingModeKey not bound +!missing-pinvoke! CVOpenGLBufferAttach is not bound +!missing-pinvoke! CVOpenGLBufferCreate is not bound +!missing-pinvoke! CVOpenGLBufferGetAttributes is not bound +!missing-pinvoke! CVOpenGLBufferGetTypeID is not bound +!missing-pinvoke! CVOpenGLBufferPoolCreate is not bound +!missing-pinvoke! CVOpenGLBufferPoolCreateOpenGLBuffer is not bound +!missing-pinvoke! CVOpenGLBufferPoolGetAttributes is not bound +!missing-pinvoke! CVOpenGLBufferPoolGetOpenGLBufferAttributes is not bound +!missing-pinvoke! CVOpenGLBufferPoolGetTypeID is not bound +!missing-pinvoke! CVOpenGLBufferPoolRelease is not bound +!missing-pinvoke! CVOpenGLBufferPoolRetain is not bound +!missing-pinvoke! CVOpenGLBufferRelease is not bound +!missing-pinvoke! CVOpenGLBufferRetain is not bound +!missing-pinvoke! CVOpenGLTextureCacheCreate is not bound +!missing-pinvoke! CVOpenGLTextureCacheCreateTextureFromImage is not bound +!missing-pinvoke! CVOpenGLTextureCacheFlush is not bound +!missing-pinvoke! CVOpenGLTextureCacheGetTypeID is not bound +!missing-pinvoke! CVOpenGLTextureCacheRelease is not bound +!missing-pinvoke! CVOpenGLTextureCacheRetain is not bound +!missing-pinvoke! CVOpenGLTextureGetCleanTexCoords is not bound +!missing-pinvoke! CVOpenGLTextureGetName is not bound +!missing-pinvoke! CVOpenGLTextureGetTarget is not bound +!missing-pinvoke! CVOpenGLTextureGetTypeID is not bound +!missing-pinvoke! CVOpenGLTextureIsFlipped is not bound +!missing-pinvoke! CVOpenGLTextureRelease is not bound +!missing-pinvoke! CVOpenGLTextureRetain is not bound + +# ignored as with macOS +!missing-field! kCVImageBufferTransferFunction_EBU_3213 not bound +!missing-field! kCVImageBufferTransferFunction_SMPTE_C not bound +!missing-field! kCVPixelBufferIOSurfaceOpenGLFBOCompatibilityKey not bound +!missing-field! kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey not bound + diff --git a/tests/xtro-sharpie/MacCatalyst-CoreVideo.todo b/tests/xtro-sharpie/MacCatalyst-CoreVideo.todo deleted file mode 100644 index 4e49776944b..00000000000 --- a/tests/xtro-sharpie/MacCatalyst-CoreVideo.todo +++ /dev/null @@ -1,57 +0,0 @@ -!missing-field! kCVImageBufferTransferFunction_EBU_3213 not bound -!missing-field! kCVImageBufferTransferFunction_SMPTE_C not bound -!missing-field! kCVOpenGLBufferHeight not bound -!missing-field! kCVOpenGLBufferInternalFormat not bound -!missing-field! kCVOpenGLBufferMaximumMipmapLevel not bound -!missing-field! kCVOpenGLBufferPoolMaximumBufferAgeKey not bound -!missing-field! kCVOpenGLBufferPoolMinimumBufferCountKey not bound -!missing-field! kCVOpenGLBufferTarget not bound -!missing-field! kCVOpenGLBufferWidth not bound -!missing-field! kCVOpenGLTextureCacheChromaSamplingModeAutomatic not bound -!missing-field! kCVOpenGLTextureCacheChromaSamplingModeBestPerformance not bound -!missing-field! kCVOpenGLTextureCacheChromaSamplingModeHighestQuality not bound -!missing-field! kCVOpenGLTextureCacheChromaSamplingModeKey not bound -!missing-field! kCVPixelBufferIOSurfaceOpenGLFBOCompatibilityKey not bound -!missing-field! kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey not bound -!missing-field! kCVPixelBufferOpenGLTextureCacheCompatibilityKey not bound -!missing-field! kCVPixelBufferProResRAWKey_BlackLevel not bound -!missing-field! kCVPixelBufferProResRAWKey_ColorMatrix not bound -!missing-field! kCVPixelBufferProResRAWKey_GainFactor not bound -!missing-field! kCVPixelBufferProResRAWKey_RecommendedCrop not bound -!missing-field! kCVPixelBufferProResRAWKey_SenselSitingOffsets not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteBalanceBlueFactor not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteBalanceCCT not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteBalanceRedFactor not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteLevel not bound -!missing-field! kCVPixelBufferVersatileBayerKey_BayerPattern not bound -!missing-pinvoke! CVOpenGLBufferAttach is not bound -!missing-pinvoke! CVOpenGLBufferCreate is not bound -!missing-pinvoke! CVOpenGLBufferGetAttributes is not bound -!missing-pinvoke! CVOpenGLBufferGetTypeID is not bound -!missing-pinvoke! CVOpenGLBufferPoolCreate is not bound -!missing-pinvoke! CVOpenGLBufferPoolCreateOpenGLBuffer is not bound -!missing-pinvoke! CVOpenGLBufferPoolGetAttributes is not bound -!missing-pinvoke! CVOpenGLBufferPoolGetOpenGLBufferAttributes is not bound -!missing-pinvoke! CVOpenGLBufferPoolGetTypeID is not bound -!missing-pinvoke! CVOpenGLBufferPoolRelease is not bound -!missing-pinvoke! CVOpenGLBufferPoolRetain is not bound -!missing-pinvoke! CVOpenGLBufferRelease is not bound -!missing-pinvoke! CVOpenGLBufferRetain is not bound -!missing-pinvoke! CVOpenGLTextureCacheCreate is not bound -!missing-pinvoke! CVOpenGLTextureCacheCreateTextureFromImage is not bound -!missing-pinvoke! CVOpenGLTextureCacheFlush is not bound -!missing-pinvoke! CVOpenGLTextureCacheGetTypeID is not bound -!missing-pinvoke! CVOpenGLTextureCacheRelease is not bound -!missing-pinvoke! CVOpenGLTextureCacheRetain is not bound -!missing-pinvoke! CVOpenGLTextureGetCleanTexCoords is not bound -!missing-pinvoke! CVOpenGLTextureGetName is not bound -!missing-pinvoke! CVOpenGLTextureGetTarget is not bound -!missing-pinvoke! CVOpenGLTextureGetTypeID is not bound -!missing-pinvoke! CVOpenGLTextureIsFlipped is not bound -!missing-pinvoke! CVOpenGLTextureRelease is not bound -!missing-pinvoke! CVOpenGLTextureRetain is not bound -## appended from unclassified file -!missing-field! kCVImageBufferAmbientViewingEnvironmentKey not bound -!missing-field! kCVImageBufferRegionOfInterestKey not bound -!missing-pinvoke! CVIsCompressedPixelFormatAvailable is not bound -!missing-pinvoke! CVPixelBufferCopyCreationAttributes is not bound diff --git a/tests/xtro-sharpie/iOS-CoreVideo.todo b/tests/xtro-sharpie/iOS-CoreVideo.todo deleted file mode 100644 index 79a8a84b8bf..00000000000 --- a/tests/xtro-sharpie/iOS-CoreVideo.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-field! kCVImageBufferAmbientViewingEnvironmentKey not bound -!missing-field! kCVImageBufferRegionOfInterestKey not bound -!missing-pinvoke! CVIsCompressedPixelFormatAvailable is not bound -!missing-pinvoke! CVPixelBufferCopyCreationAttributes is not bound diff --git a/tests/xtro-sharpie/macOS-CoreVideo.todo b/tests/xtro-sharpie/macOS-CoreVideo.todo deleted file mode 100644 index 482cd73578a..00000000000 --- a/tests/xtro-sharpie/macOS-CoreVideo.todo +++ /dev/null @@ -1,14 +0,0 @@ -!missing-field! kCVImageBufferAmbientViewingEnvironmentKey not bound -!missing-field! kCVImageBufferRegionOfInterestKey not bound -!missing-field! kCVPixelBufferProResRAWKey_BlackLevel not bound -!missing-field! kCVPixelBufferProResRAWKey_ColorMatrix not bound -!missing-field! kCVPixelBufferProResRAWKey_GainFactor not bound -!missing-field! kCVPixelBufferProResRAWKey_RecommendedCrop not bound -!missing-field! kCVPixelBufferProResRAWKey_SenselSitingOffsets not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteBalanceBlueFactor not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteBalanceCCT not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteBalanceRedFactor not bound -!missing-field! kCVPixelBufferProResRAWKey_WhiteLevel not bound -!missing-field! kCVPixelBufferVersatileBayerKey_BayerPattern not bound -!missing-pinvoke! CVIsCompressedPixelFormatAvailable is not bound -!missing-pinvoke! CVPixelBufferCopyCreationAttributes is not bound diff --git a/tests/xtro-sharpie/tvOS-CoreVideo.todo b/tests/xtro-sharpie/tvOS-CoreVideo.todo deleted file mode 100644 index 79a8a84b8bf..00000000000 --- a/tests/xtro-sharpie/tvOS-CoreVideo.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-field! kCVImageBufferAmbientViewingEnvironmentKey not bound -!missing-field! kCVImageBufferRegionOfInterestKey not bound -!missing-pinvoke! CVIsCompressedPixelFormatAvailable is not bound -!missing-pinvoke! CVPixelBufferCopyCreationAttributes is not bound diff --git a/tests/xtro-sharpie/watchOS-CoreVideo.todo b/tests/xtro-sharpie/watchOS-CoreVideo.todo deleted file mode 100644 index 79a8a84b8bf..00000000000 --- a/tests/xtro-sharpie/watchOS-CoreVideo.todo +++ /dev/null @@ -1,4 +0,0 @@ -!missing-field! kCVImageBufferAmbientViewingEnvironmentKey not bound -!missing-field! kCVImageBufferRegionOfInterestKey not bound -!missing-pinvoke! CVIsCompressedPixelFormatAvailable is not bound -!missing-pinvoke! CVPixelBufferCopyCreationAttributes is not bound