From ba6b60e1109bdf0186847939d8e1ebdfface4bf8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 19 Jan 2023 10:35:29 +0100 Subject: [PATCH] [AVFoundation] Add a few missing APIs. Fixes #16954. Fixes https://github.com/xamarin/xamarin-macios/issues/16954. --- src/avfoundation.cs | 53 ++++++++++++++++++- .../iOS-AVFoundation.todo | 16 ------ .../macOS-AVFoundation.todo | 8 --- tests/xtro-sharpie/iOS-AVFoundation.todo | 16 ------ tests/xtro-sharpie/macOS-AVFoundation.todo | 8 --- 5 files changed, 52 insertions(+), 49 deletions(-) diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 2d4a742fe700..2d9137c0b2c9 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -9969,6 +9969,9 @@ interface AVCapturePhotoSettings : NSCopying { [Export ("autoStillImageStabilizationEnabled")] bool IsAutoStillImageStabilizationEnabled { [Bind ("isAutoStillImageStabilizationEnabled")] get; set; } + [Deprecated (PlatformName.iOS, 16, 0, message: "Use 'MaxPhotoDimensions' instead.")] + [Deprecated (PlatformName.MacCatalyst, 16, 0, message: "Use 'MaxPhotoDimensions' instead.")] + [Deprecated (PlatformName.MacOSX, 13, 0, message: "Use 'MaxPhotoDimensions' instead.")] [Export ("highResolutionPhotoEnabled")] bool IsHighResolutionPhotoEnabled { [Bind ("isHighResolutionPhotoEnabled")] get; set; } @@ -10106,6 +10109,12 @@ interface AVCapturePhotoSettings : NSCopying { [NoMac] [Export ("autoContentAwareDistortionCorrectionEnabled")] bool AutoContentAwareDistortionCorrectionEnabled { [Bind ("isAutoContentAwareDistortionCorrectionEnabled")] get; set; } + + [iOS (16, 0)] + [MacCatalyst (16, 0)] + [Mac (13, 0)] + [Export ("maxPhotoDimensions")] + CMVideoDimensions MaxPhotoDimensions { get; set; } } [Introduced (PlatformName.MacCatalyst, 14, 0)] @@ -10312,7 +10321,10 @@ interface AVCapturePhotoOutput { [NullAllowed, Export ("photoSettingsForSceneMonitoring", ArgumentSemantic.Copy)] AVCapturePhotoSettings PhotoSettingsForSceneMonitoring { get; set; } - [NoMac] + [Mac (10, 15)] + [Deprecated (PlatformName.iOS, 16, 0, message: "Use 'MaxPhotoDimensions' instead.")] + [Deprecated (PlatformName.MacCatalyst, 16, 0, message: "Use 'MaxPhotoDimensions' instead.")] + [Deprecated (PlatformName.MacOSX, 13, 0, message: "Use 'MaxPhotoDimensions' instead.")] [Export ("highResolutionCaptureEnabled")] bool IsHighResolutionCaptureEnabled { [Bind ("isHighResolutionCaptureEnabled")] get; set; } @@ -10480,6 +10492,18 @@ interface AVCapturePhotoOutput { [NoMac] [Export ("contentAwareDistortionCorrectionEnabled")] bool ContentAwareDistortionCorrectionEnabled { [Bind ("isContentAwareDistortionCorrectionEnabled")] get; set; } + + [iOS (16, 0)] + [MacCatalyst (16, 0)] + [Mac (13, 0)] + [Export ("maxPhotoDimensions")] + CMVideoDimensions MaxPhotoDimensions { get; set; } + + [iOS (16, 0)] + [MacCatalyst (16, 0)] + [Mac (13, 0)] + [Export ("preservesLivePhotoCaptureSuspendedOnSessionStop")] + bool PreservesLivePhotoCaptureSuspendedOnSessionStop { get; set; } } [Introduced (PlatformName.MacCatalyst, 14, 0)] @@ -11509,14 +11533,20 @@ interface AVCaptureDeviceFormat { #endif [iOS (8, 0), NoMac] + [Deprecated (PlatformName.iOS, 16, 0, message: "Use 'SupportedMaxPhotoDimension' instead.")] + [Deprecated (PlatformName.MacCatalyst, 16, 0, message: "Use 'SupportedMaxPhotoDimension' instead.")] [Export ("highResolutionStillImageDimensions")] CMVideoDimensions HighResolutionStillImageDimensions { get; } [iOS (11, 0), NoMac] + [Deprecated (PlatformName.iOS, 16, 0, message: "Use 'SupportedVideoZoomFactorsForDepthDataDelivery' instead.")] + [Deprecated (PlatformName.MacCatalyst, 16, 0, message: "Use 'SupportedVideoZoomFactorsForDepthDataDelivery' instead.")] [Export ("videoMinZoomFactorForDepthDataDelivery")] nfloat VideoMinZoomFactorForDepthDataDelivery { get; } [iOS (11, 0), NoMac] + [Deprecated (PlatformName.iOS, 16, 0, message: "Use 'SupportedVideoZoomFactorsForDepthDataDelivery' instead.")] + [Deprecated (PlatformName.MacCatalyst, 16, 0, message: "Use 'SupportedVideoZoomFactorsForDepthDataDelivery' instead.")] [Export ("videoMaxZoomFactorForDepthDataDelivery")] nfloat VideoMaxZoomFactorForDepthDataDelivery { get; } @@ -11596,6 +11626,27 @@ interface AVCaptureDeviceFormat { [NoWatch, NoTV, MacCatalyst (15, 0), Mac (12, 0), iOS (15, 0)] [Export ("videoFrameRateRangeForPortraitEffect")] AVFrameRateRange VideoFrameRateRangeForPortraitEffect { get; } + + [iOS (16, 0)] + [MacCatalyst (16, 0)] + [Mac (13, 0)] + [BindAs (typeof (CMVideoDimensions[]))] + [Export ("supportedMaxPhotoDimensions")] + NSValue[] SupportedMaxPhotoDimensions { get; } + + [iOS (16, 0)] + [MacCatalyst (16, 0)] + [Mac (13, 0)] + [BindAs (typeof (nfloat[]))] + [Export ("secondaryNativeResolutionZoomFactors")] + NSNumber[] SecondaryNativeResolutionZoomFactors { get; } + + [iOS (16, 0)] + [MacCatalyst (16, 0)] + [Mac (13, 0)] + [BindAs (typeof (nfloat[]))] + [Export ("supportedVideoZoomFactorsForDepthDataDelivery")] + NSNumber[] SupportedVideoZoomFactorsForDepthDataDelivery { get; } } delegate void AVCaptureCompletionHandler (CMSampleBuffer imageDataSampleBuffer, NSError error); diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo index aa8f3b802390..0dc2e10de3e5 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-AVFoundation.todo @@ -313,19 +313,3 @@ !missing-type! AVSpeechSynthesisProviderVoice not bound !missing-enum-value! AVSpeechSynthesisVoiceQuality native value AVSpeechSynthesisVoiceQualityPremium = 3 not bound !missing-selector! AVPlayerLayer::copyDisplayedPixelBuffer not bound -!missing-selector! AVCapturePhotoOutput::preservesLivePhotoCaptureSuspendedOnSessionStop not bound -!missing-selector! AVCapturePhotoOutput::setPreservesLivePhotoCaptureSuspendedOnSessionStop: not bound -!deprecated-attribute-missing! AVCaptureDeviceFormat::highResolutionStillImageDimensions missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCaptureDeviceFormat::videoMaxZoomFactorForDepthDataDelivery missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCaptureDeviceFormat::videoMinZoomFactorForDepthDataDelivery missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoOutput::isHighResolutionCaptureEnabled missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoOutput::setHighResolutionCaptureEnabled: missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoSettings::isHighResolutionPhotoEnabled missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoSettings::setHighResolutionPhotoEnabled: missing a [Deprecated] attribute -!missing-selector! AVCaptureDeviceFormat::secondaryNativeResolutionZoomFactors not bound -!missing-selector! AVCaptureDeviceFormat::supportedMaxPhotoDimensions not bound -!missing-selector! AVCaptureDeviceFormat::supportedVideoZoomFactorsForDepthDataDelivery not bound -!missing-selector! AVCapturePhotoOutput::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoOutput::setMaxPhotoDimensions: not bound -!missing-selector! AVCapturePhotoSettings::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoSettings::setMaxPhotoDimensions: not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo index 66b8cb22f7d2..095c41c13826 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo +++ b/tests/xtro-sharpie/api-annotations-dotnet/macOS-AVFoundation.todo @@ -281,19 +281,11 @@ !missing-type! AVSpeechSynthesisProviderVoice not bound !missing-enum-value! AVSpeechSynthesisVoiceQuality native value AVSpeechSynthesisVoiceQualityPremium = 3 not bound !missing-selector! AVPlayerLayer::copyDisplayedPixelBuffer not bound -!missing-selector! AVCapturePhotoOutput::preservesLivePhotoCaptureSuspendedOnSessionStop not bound -!missing-selector! AVCapturePhotoOutput::setPreservesLivePhotoCaptureSuspendedOnSessionStop: not bound !missing-selector! AVCaptureDeskViewApplication::presentWithCompletionHandler: not bound !missing-selector! AVCaptureDeskViewApplication::presentWithLaunchConfiguration:completionHandler: not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::mainWindowFrame not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::requiresSetUpModeCompletion not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::setMainWindowFrame: not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::setRequiresSetUpModeCompletion: not bound -!missing-selector! AVCaptureDeviceFormat::secondaryNativeResolutionZoomFactors not bound -!missing-selector! AVCaptureDeviceFormat::supportedMaxPhotoDimensions not bound -!missing-selector! AVCapturePhotoOutput::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoOutput::setMaxPhotoDimensions: not bound -!missing-selector! AVCapturePhotoSettings::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoSettings::setMaxPhotoDimensions: not bound !missing-type! AVCaptureDeskViewApplication not bound !missing-type! AVCaptureDeskViewApplicationLaunchConfiguration not bound diff --git a/tests/xtro-sharpie/iOS-AVFoundation.todo b/tests/xtro-sharpie/iOS-AVFoundation.todo index aa8f3b802390..0dc2e10de3e5 100644 --- a/tests/xtro-sharpie/iOS-AVFoundation.todo +++ b/tests/xtro-sharpie/iOS-AVFoundation.todo @@ -313,19 +313,3 @@ !missing-type! AVSpeechSynthesisProviderVoice not bound !missing-enum-value! AVSpeechSynthesisVoiceQuality native value AVSpeechSynthesisVoiceQualityPremium = 3 not bound !missing-selector! AVPlayerLayer::copyDisplayedPixelBuffer not bound -!missing-selector! AVCapturePhotoOutput::preservesLivePhotoCaptureSuspendedOnSessionStop not bound -!missing-selector! AVCapturePhotoOutput::setPreservesLivePhotoCaptureSuspendedOnSessionStop: not bound -!deprecated-attribute-missing! AVCaptureDeviceFormat::highResolutionStillImageDimensions missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCaptureDeviceFormat::videoMaxZoomFactorForDepthDataDelivery missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCaptureDeviceFormat::videoMinZoomFactorForDepthDataDelivery missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoOutput::isHighResolutionCaptureEnabled missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoOutput::setHighResolutionCaptureEnabled: missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoSettings::isHighResolutionPhotoEnabled missing a [Deprecated] attribute -!deprecated-attribute-missing! AVCapturePhotoSettings::setHighResolutionPhotoEnabled: missing a [Deprecated] attribute -!missing-selector! AVCaptureDeviceFormat::secondaryNativeResolutionZoomFactors not bound -!missing-selector! AVCaptureDeviceFormat::supportedMaxPhotoDimensions not bound -!missing-selector! AVCaptureDeviceFormat::supportedVideoZoomFactorsForDepthDataDelivery not bound -!missing-selector! AVCapturePhotoOutput::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoOutput::setMaxPhotoDimensions: not bound -!missing-selector! AVCapturePhotoSettings::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoSettings::setMaxPhotoDimensions: not bound diff --git a/tests/xtro-sharpie/macOS-AVFoundation.todo b/tests/xtro-sharpie/macOS-AVFoundation.todo index 66b8cb22f7d2..095c41c13826 100644 --- a/tests/xtro-sharpie/macOS-AVFoundation.todo +++ b/tests/xtro-sharpie/macOS-AVFoundation.todo @@ -281,19 +281,11 @@ !missing-type! AVSpeechSynthesisProviderVoice not bound !missing-enum-value! AVSpeechSynthesisVoiceQuality native value AVSpeechSynthesisVoiceQualityPremium = 3 not bound !missing-selector! AVPlayerLayer::copyDisplayedPixelBuffer not bound -!missing-selector! AVCapturePhotoOutput::preservesLivePhotoCaptureSuspendedOnSessionStop not bound -!missing-selector! AVCapturePhotoOutput::setPreservesLivePhotoCaptureSuspendedOnSessionStop: not bound !missing-selector! AVCaptureDeskViewApplication::presentWithCompletionHandler: not bound !missing-selector! AVCaptureDeskViewApplication::presentWithLaunchConfiguration:completionHandler: not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::mainWindowFrame not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::requiresSetUpModeCompletion not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::setMainWindowFrame: not bound !missing-selector! AVCaptureDeskViewApplicationLaunchConfiguration::setRequiresSetUpModeCompletion: not bound -!missing-selector! AVCaptureDeviceFormat::secondaryNativeResolutionZoomFactors not bound -!missing-selector! AVCaptureDeviceFormat::supportedMaxPhotoDimensions not bound -!missing-selector! AVCapturePhotoOutput::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoOutput::setMaxPhotoDimensions: not bound -!missing-selector! AVCapturePhotoSettings::maxPhotoDimensions not bound -!missing-selector! AVCapturePhotoSettings::setMaxPhotoDimensions: not bound !missing-type! AVCaptureDeskViewApplication not bound !missing-type! AVCaptureDeskViewApplicationLaunchConfiguration not bound