Skip to content

Commit

Permalink
[AVKit] Add missing APIs and fix all xtro issues. (#21836)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Dec 20, 2024
1 parent 648eb5d commit c9d052a
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 28 deletions.
5 changes: 5 additions & 0 deletions src/avfoundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17190,4 +17190,9 @@ interface AVAudioApplication {
void RequestMicrophoneInjectionPermission (Action<AVAudioApplicationMicrophoneInjectionPermission> response);
}

[TV (17, 0), NoMacCatalyst, NoMac, NoiOS]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface AVContinuityDevice {
}
}
47 changes: 41 additions & 6 deletions src/avkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ interface AVPlayerViewController {

[TV (15, 0), NoWatch, NoMac, NoiOS, NoMacCatalyst]
[Export ("infoViewActions", ArgumentSemantic.Copy)]
[NullAllowed]
UIAction [] InfoViewActions { get; set; }

[TV (15, 0), NoWatch, NoMac, NoiOS, NoMacCatalyst]
Expand Down Expand Up @@ -691,6 +692,10 @@ interface AVPlayerView {
[Mac (13, 0), NoWatch, NoiOS, NoMacCatalyst, NoTV]
[Export ("setMagnification:centeredAtPoint:")]
void SetMagnification (nfloat magnification, CGPoint centeredAtPoint);

[Mac (14, 0)]
[Export ("videoFrameAnalysisTypes")]
AVVideoFrameAnalysisType VideoFrameAnalysisTypes { get; set; }
}

interface IAVPlayerViewPictureInPictureDelegate { }
Expand Down Expand Up @@ -1010,18 +1015,15 @@ interface AVPictureInPictureControllerContentSource {

// interface AVPictureInPictureControllerContentSource_VideoCallSupport
[NoWatch, NoTV, NoMac]
[NoMacCatalyst] // doc as available, intro fails on macOS 12 beta 6
[Export ("initWithActiveVideoCallSourceView:contentViewController:")]
NativeHandle Constructor (UIView sourceView, AVPictureInPictureVideoCallViewController contentViewController);

[NullAllowed]
[NoWatch, NoTV, NoMac]
[NoMacCatalyst] // doc as available, intro fails on macOS 12 beta 6
[Export ("activeVideoCallSourceView", ArgumentSemantic.Weak)]
UIView ActiveVideoCallSourceView { get; }

[NoWatch, NoTV, NoMac]
[NoMacCatalyst] // doc as available, intro fails on macOS 12 beta 6
[Export ("activeVideoCallContentViewController")]
AVPictureInPictureVideoCallViewController ActiveVideoCallContentViewController { get; }

Expand Down Expand Up @@ -1143,23 +1145,23 @@ interface AVPlaybackSpeed {
string LocalizedNumericName { get; }
}

[iOS (17, 2), NoMac, NoMacCatalyst, NoTV, NoWatch]
[iOS (17, 2), NoMac, MacCatalyst (17, 2), NoTV, NoWatch]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface AVCaptureEvent {
[Export ("phase")]
AVCaptureEventPhase Phase { get; }
}

[iOS (17, 2), NoMac, NoMacCatalyst, NoTV, NoWatch]
[iOS (17, 2), NoMac, MacCatalyst (17, 2), NoTV, NoWatch]
[Native]
public enum AVCaptureEventPhase : ulong {
Began,
Ended,
Cancelled,
}

[iOS (17, 2), NoMac, NoMacCatalyst, NoTV, NoWatch]
[iOS (17, 2), NoMac, MacCatalyst (17, 2), NoTV, NoWatch]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface AVCaptureEventInteraction : UIInteraction {
Expand All @@ -1172,4 +1174,37 @@ interface AVCaptureEventInteraction : UIInteraction {
[Export ("enabled")]
bool Enabled { [Bind ("isEnabled")] get; set; }
}

[TV (17, 0), NoMac, NoiOS, NoMacCatalyst]
[BaseType (typeof (UIViewController))]
interface AVContinuityDevicePickerViewController {
[Static]
[Export ("supported")]
bool Supported { [Bind ("isSupported")] get; }

[Wrap ("WeakDelegate")]
[NullAllowed]
IAVContinuityDevicePickerViewControllerDelegate Delegate { get; set; }

[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
NSObject WeakDelegate { get; set; }
}

[TV (17, 0), NoMac, NoiOS, NoMacCatalyst]
[Protocol (BackwardsCompatibleCodeGeneration = false), Model]
[BaseType (typeof (NSObject))]
interface AVContinuityDevicePickerViewControllerDelegate {
[Export ("continuityDevicePickerWillBeginPresenting:")]
void WillBeginPresenting (AVContinuityDevicePickerViewController pickerViewController);

[Export ("continuityDevicePicker:didConnectDevice:")]
void DidConnectDevice (AVContinuityDevicePickerViewController pickerViewController, AVContinuityDevice device);

[Export ("continuityDevicePickerDidCancel:")]
void DidCancel (AVContinuityDevicePickerViewController pickerViewController);

[Export ("continuityDevicePickerDidEndPresenting:")]
void DidEndPresenting (AVContinuityDevicePickerViewController pickerViewController);
}
interface IAVContinuityDevicePickerViewControllerDelegate { }
}
9 changes: 9 additions & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26605,6 +26605,7 @@ M:AVKit.AVCaptureView.#ctor(CoreGraphics.CGRect)
M:AVKit.AVCaptureView.Dispose(System.Boolean)
M:AVKit.AVContentProposalViewController.#ctor(System.String,Foundation.NSBundle)
M:AVKit.AVContentProposalViewController.Dispose(System.Boolean)
M:AVKit.AVContinuityDevicePickerViewController.Dispose(System.Boolean)
M:AVKit.AVCustomRoutingControllerDelegate_Extensions.DidSelectItem(AVKit.IAVCustomRoutingControllerDelegate,AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingActionItem)
M:AVKit.AVCustomRoutingControllerDelegate_Extensions.EventDidTimeOut(AVKit.IAVCustomRoutingControllerDelegate,AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingEvent)
M:AVKit.AVCustomRoutingControllerDelegate.DidSelectItem(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingActionItem)
Expand Down Expand Up @@ -26673,6 +26674,10 @@ M:AVKit.AVRoutePickerView.Dispose(System.Boolean)
M:AVKit.AVRoutePickerViewDelegate_Extensions.DidEndPresentingRoutes(AVKit.IAVRoutePickerViewDelegate,AVKit.AVRoutePickerView)
M:AVKit.AVRoutePickerViewDelegate_Extensions.WillBeginPresentingRoutes(AVKit.IAVRoutePickerViewDelegate,AVKit.AVRoutePickerView)
M:AVKit.IAVCaptureViewDelegate.StartRecording(AVKit.AVCaptureView,AVFoundation.AVCaptureFileOutput)
M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.DidCancel(AVKit.AVContinuityDevicePickerViewController)
M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.DidConnectDevice(AVKit.AVContinuityDevicePickerViewController,AVFoundation.AVContinuityDevice)
M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.DidEndPresenting(AVKit.AVContinuityDevicePickerViewController)
M:AVKit.IAVContinuityDevicePickerViewControllerDelegate.WillBeginPresenting(AVKit.AVContinuityDevicePickerViewController)
M:AVKit.IAVCustomRoutingControllerDelegate.DidSelectItem(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingActionItem)
M:AVKit.IAVCustomRoutingControllerDelegate.EventDidTimeOut(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingEvent)
M:AVKit.IAVCustomRoutingControllerDelegate.HandleEvent(AVRouting.AVCustomRoutingController,AVRouting.AVCustomRoutingEvent,AVKit.AVCustomRoutingControllerDelegateCompletionHandler)
Expand Down Expand Up @@ -52743,6 +52748,8 @@ P:AVFoundation.RenderingModeChangeNotificationEventArgs.NewRenderingMode
P:AVFoundation.SpatialPlaybackCapabilitiesChangedEventArgs.SpatialAudioEnabledKey
P:AVKit.AVCaptureEventInteraction.Enabled
P:AVKit.AVCaptureEventInteraction.View
P:AVKit.AVContinuityDevicePickerViewController.Delegate
P:AVKit.AVContinuityDevicePickerViewController.Supported
P:AVKit.AVDisplayManager.DisplayCriteriaMatchingEnabled
P:AVKit.AVDisplayManager.DisplayModeSwitchInProgress
P:AVKit.AVDisplayManager.ModeSwitchEndNotification
Expand Down Expand Up @@ -71593,6 +71600,7 @@ T:AVKit.AVAudioSessionRouteSelection
T:AVKit.AVCaptureEventPhase
T:AVKit.AVCaptureViewControlsStyle
T:AVKit.AVCaptureViewDelegate
T:AVKit.AVContinuityDevicePickerViewControllerDelegate
T:AVKit.AVCustomRoutingControllerDelegate
T:AVKit.AVCustomRoutingControllerDelegateCompletionHandler
T:AVKit.AVKitError
Expand All @@ -71606,6 +71614,7 @@ T:AVKit.AVRoutePickerViewButtonStyle
T:AVKit.AVRoutePickerViewDelegate
T:AVKit.AVVideoFrameAnalysisType
T:AVKit.IAVCaptureViewDelegate
T:AVKit.IAVContinuityDevicePickerViewControllerDelegate
T:AVKit.IAVCustomRoutingControllerDelegate
T:AVKit.IAVPictureInPictureSampleBufferPlaybackDelegate
T:AVKit.IAVPlayerViewControllerAnimationCoordinator
Expand Down
11 changes: 11 additions & 0 deletions tests/introspection/iOSApiSelectorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ protected override bool CheckResponse (bool value, Type actualType, MethodBase m
var declaredType = method.DeclaringType;

switch (declaredType.Name) {
#if __MACCATALYST__
case "AVPictureInPictureControllerContentSource":
switch (name) {
case "activeVideoCallSourceView":
case "activeVideoCallContentViewController":
case "initWithActiveVideoCallSourceView:contentViewController:":
// Headers and docs say these selectors are available in Mac Catalyst 15+, but introspection can only bind them in Mac Catalyst 16+.
return TestRuntime.CheckXcodeVersion (13, 0);
}
break;
#endif
case "AVUrlAsset":
switch (name) {
// fails because it is in-lined via protocol AVContentKeyRecipient
Expand Down

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion tests/xtro-sharpie/api-annotations-dotnet/iOS-AVKit.ignore

This file was deleted.

2 changes: 0 additions & 2 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-AVKit.todo

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,6 @@
!missing-type! AVCaptureSynchronizedSampleBufferData not bound
!missing-type! AVCaptureSystemPressureState not bound
!missing-type! AVCaptureVideoDataOutput not bound
!missing-type! AVContinuityDevice not bound
!missing-type! AVFrameRateRange not bound
!missing-type! AVMetadataBodyObject not bound
!missing-type! AVMetadataCatBodyObject not bound
Expand Down
6 changes: 0 additions & 6 deletions tests/xtro-sharpie/api-annotations-dotnet/tvOS-AVKit.todo

This file was deleted.

10 comments on commit c9d052a

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.