-
Notifications
You must be signed in to change notification settings - Fork 540
[RGen] Add AVFoundation trampoline tests. #22928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This is the initial implementation of the trampoline emitter. It just focuses on the delegate and the static class. A generic class has been added but more tests will come per framework, we simply want to make the diff manageable for the team, so we have not added all the tests in a single PR.
Co-authored-by: Copilot <[email protected]>
Add tests for all the AVFoundation delegates that we know about.
// Generate trampolines for compilation | ||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAssetImageGenerateAsynchronouslyForTimeCompletionHandler))] | ||
unsafe internal delegate void DAVAssetImageGenerateAsynchronouslyForTimeCompletionHandler (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle imageRef, global::CoreMedia.CMTime actualTime, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated code:
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVAssetImageGenerateAsynchronouslyForTimeCompletionHandler))]
unsafe internal delegate void DAVAssetImageGenerateAsynchronouslyForTimeCompletionHandler (IntPtr block, NativeHandle imageRef, global::CoreMedia.CMTime actualTime, NativeHandle error);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle imageRef, global::CoreMedia.CMTime actualTime, global::ObjCRuntime.NativeHandle error) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAssetImageGenerateAsynchronouslyForTimeCompletionHandler> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::ObjCRuntime.Runtime.GetINativeObject<global::CoreGraphics.CGImage> (imageRef, false)!, actualTime, global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError> (error)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated code:
internal static unsafe void Invoke (IntPtr block, NativeHandle imageRef, global::CoreMedia.CMTime actualTime, NativeHandle error) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVAssetImageGenerateAsynchronouslyForTimeCompletionHandler> (block);
if (del is not null) {
del (imageRef == IntPtr.Zero ? null! : new CoreGraphics.CGImage (imageRef, false), actualTime, Runtime.GetNSObject<NSError> (error)!);
}
}
Notice the diff between the two, rgen is calling the GetINativeObject factory method, which will do the correct thing for a IntPtr.Zero
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAssetImageGeneratorCompletionHandler> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (requestedTime, imageRef, actualTime, (global::AVFoundation.AVAssetImageGeneratorResult) (long) result, global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError> (error)!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated code:
del (requestedTime, imageRef, actualTime, (AVAssetImageGeneratorResult) (long) result, Runtime.GetNSObject<NSError> (error)!);
Only diff is the usage of 'global'.
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAssetImageGeneratorCompletionHandler2))] | ||
unsafe internal delegate void DAVAssetImageGeneratorCompletionHandler2 (global::System.IntPtr block_ptr, global::CoreMedia.CMTime requestedTime, global::ObjCRuntime.NativeHandle imageRef, global::CoreMedia.CMTime actualTime, global::System.IntPtr result, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
unsafe internal delegate void DAVAssetImageGeneratorCompletionHandler2 (IntPtr block, global::CoreMedia.CMTime requestedTime, NativeHandle imageRef, global::CoreMedia.CMTime actualTime, IntPtr result, NativeHandle error);
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAssetImageGeneratorCompletionHandler2> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (requestedTime, global::ObjCRuntime.Runtime.GetINativeObject<global::CoreGraphics.CGImage> (imageRef, false)!, actualTime, (global::AVFoundation.AVAssetImageGeneratorResult) (long) result, global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError> (error)!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
del (requestedTime, imageRef == IntPtr.Zero ? null! : new CoreGraphics.CGImage (imageRef, false), actualTime, (AVAssetImageGeneratorResult) (long) result, Runtime.GetNSObject<NSError> (error)!);
The diff is the usage of the GetINativeObject factory method.
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAssetPlaybackAssistantLoadPlaybackConfigurationOptionsHandler))] | ||
unsafe internal delegate void DAVAssetPlaybackAssistantLoadPlaybackConfigurationOptionsHandler (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle playbackConfigurationOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
unsafe internal delegate void DAVAssetPlaybackAssistantLoadPlaybackConfigurationOptionsHandler (IntPtr block, NativeHandle playbackConfigurationOptions);
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAssetPlaybackAssistantLoadPlaybackConfigurationOptionsHandler> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::CoreFoundation.CFArray.StringArrayFromHandle (playbackConfigurationOptions)!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
del (CFArray.StringArrayFromHandle (playbackConfigurationOptions)!);
The diff is the usage of the 'global' alias.
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAudioConverterInputHandler))] | ||
unsafe internal delegate global::ObjCRuntime.NativeHandle DAVAudioConverterInputHandler (global::System.IntPtr block_ptr, uint inNumberOfPackets, global::System.IntPtr* outStatus); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
unsafe internal delegate NativeHandle DAVAudioConverterInputHandler (IntPtr block, uint inNumberOfPackets, global::AVFoundation.AVAudioConverterInputStatus* outStatus);
@rolfbjarne this is an interesting case. bgen uses a pointer to the enumerator value:
/// <summary>Enumerates the state of the input stream.</summary>
/// <remarks>To be added.</remarks>
[MacCatalyst (13, 1)]
[Native]
public enum AVAudioConverterInputStatus : long {
/// <summary>To be added.</summary>
HaveData = 0,
/// <summary>To be added.</summary>
NoDataNow = 1,
/// <summary>To be added.</summary>
EndOfStream = 2,
}
The enum backing field is a long, which maps to an IntPtr. AFAIK the correct thing is to lower the enum value to its backing type, and since it is a long, we should use a IntPtr. Did I do the lowering wrong or is it not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically lowering an enum value to IntPtr is correct, but since we don't support 32-bit on any platform anymore, it will always be 64-bit values, which means it doesn't really matter.
internal static unsafe global::ObjCRuntime.NativeHandle Invoke (global::System.IntPtr block_ptr, uint inNumberOfPackets, global::System.IntPtr* outStatus) | ||
{ | ||
*outStatus = default; | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAudioConverterInputHandler> (block_ptr); | ||
if (del is not null) | ||
{ | ||
var ret = del (inNumberOfPackets, out global::System.Runtime.CompilerServices.Unsafe.AsRef<global::AVFoundation.AVAudioConverterInputStatus> (outStatus)); | ||
return global::ObjCRuntime.Runtime.RetainAndAutoreleaseNSObject (ret); | ||
} | ||
return default; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
[Preserve (Conditional = true)]
[UnmanagedCallersOnly]
[UserDelegateType (typeof (global::AVFoundation.AVAudioConverterInputHandler))]
internal static unsafe NativeHandle Invoke (IntPtr block, uint inNumberOfPackets, global::AVFoundation.AVAudioConverterInputStatus* outStatus) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVAudioConverterInputHandler> (block);
var retval = del (inNumberOfPackets, out global::System.Runtime.CompilerServices.Unsafe.AsRef<global::AVFoundation.AVAudioConverterInputStatus> (outStatus));
return Runtime.RetainAndAutoreleaseNSObject (retval);
}
There are a few diffs here:
- rgen inits the outStatus to the default.
- rgen checks if the del is null, it it is, it returns the default.
AFAIk we need to always check for del to be null, since BlockLiteral.GetTarget returns a nullable value, which means that we always need to init the out variable to its default and we need to make sure we return the default of NativeHandle which AFAIK is a null ptr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If BlockLiteral.GetTarget
returns null, something went very wrong, so IMHO it's better to throw an exception in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can create a PR with that and rather than return the default we throw the error. Any exception in particular?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this:
throw ErrorHelper.CreateError (8059, Errors.MX8059, "Unable to find a delegate to invoke for the block 0xdeadf000d (delegate type: AVFoundation.AVAudioConverterInputHandler).");
You'll have to add the error message to tools/mtouch/Errors.resx.
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAudioEngineManualRenderingBlock))] | ||
unsafe internal delegate global::System.IntPtr DAVAudioEngineManualRenderingBlock (global::System.IntPtr block_ptr, uint numberOfFrames, global::ObjCRuntime.NativeHandle outBuffer, int* outError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
unsafe internal delegate IntPtr DAVAudioEngineManualRenderingBlock (IntPtr block, uint numberOfFrames, NativeHandle outBuffer, int* outError);
internal static unsafe global::System.IntPtr Invoke (global::System.IntPtr block_ptr, uint numberOfFrames, global::ObjCRuntime.NativeHandle outBuffer, int* outError) | ||
{ | ||
*outError = default; | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAudioEngineManualRenderingBlock> (block_ptr); | ||
if (del is not null) | ||
{ | ||
var ret = del (numberOfFrames, new global::AudioToolbox.AudioBuffers (outBuffer), ref global::System.Runtime.CompilerServices.Unsafe.AsRef<int> (outError)); | ||
return (IntPtr) (long) ret; | ||
} | ||
return default; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen code:
internal static unsafe IntPtr Invoke (IntPtr block, uint numberOfFrames, NativeHandle outBuffer, int* outError) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVAudioEngineManualRenderingBlock> (block);
var retval = del (numberOfFrames, new global::AudioToolbox.AudioBuffers (outBuffer), ref global::System.Runtime.CompilerServices.Unsafe.AsRef<int> (outError));
return (IntPtr) (long) retval;
}
Similar issue:
- We init outError before the call.
- We check for del no to be null.
The rest of the code is the same.
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAudioIONodeInputBlock))] | ||
unsafe internal delegate global::ObjCRuntime.NativeHandle DAVAudioIONodeInputBlock (global::System.IntPtr block_ptr, uint frameCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen:
unsafe internal delegate NativeHandle DAVAudioIONodeInputBlock (IntPtr block, uint frameCount);
This comment has been minimized.
This comment has been minimized.
internal static unsafe global::ObjCRuntime.NativeHandle Invoke (global::System.IntPtr block_ptr, uint frameCount) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAudioIONodeInputBlock> (block_ptr); | ||
if (del is not null) | ||
{ | ||
var ret = del (frameCount); | ||
return global::ObjCRuntime.Runtime.RetainAndAutoreleaseNativeObject (ret); | ||
} | ||
return default; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen:
internal static unsafe NativeHandle Invoke (IntPtr block, uint frameCount) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVAudioIONodeInputBlock> (block);
var retval = del (frameCount);
return Runtime.RetainAndAutoreleaseNativeObject (retval);
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAudioInputNodeMutedSpeechEventListener))] | ||
unsafe internal delegate void DAVAudioInputNodeMutedSpeechEventListener (global::System.IntPtr block_ptr, global::System.IntPtr event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug, should be @event and not event. There seems to be an issue on how we are getting the parameter name from the delegate declaration:
delegate void AVAudioInputNodeMutedSpeechEventListener (AVAudioVoiceProcessingSpeechActivityEvent @event);
For some reason we are losing the '@' which should not happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix in #22930
internal static unsafe global::ObjCRuntime.NativeHandle Invoke (global::System.IntPtr block_ptr, uint inNumberOfPackets, global::System.IntPtr* outStatus) | ||
{ | ||
*outStatus = default; | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVAudioConverterInputHandler> (block_ptr); | ||
if (del is not null) | ||
{ | ||
var ret = del (inNumberOfPackets, out global::System.Runtime.CompilerServices.Unsafe.AsRef<global::AVFoundation.AVAudioConverterInputStatus> (outStatus)); | ||
return global::ObjCRuntime.Runtime.RetainAndAutoreleaseNSObject (ret); | ||
} | ||
return default; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If BlockLiteral.GetTarget
returns null, something went very wrong, so IMHO it's better to throw an exception in that case.
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVAudioConverterInputHandler))] | ||
unsafe internal delegate global::ObjCRuntime.NativeHandle DAVAudioConverterInputHandler (global::System.IntPtr block_ptr, uint inNumberOfPackets, global::System.IntPtr* outStatus); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically lowering an enum value to IntPtr is correct, but since we don't support 32-bit on any platform anymore, it will always be 64-bit values, which means it doesn't really matter.
✅ [CI Build #5a32fc5] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #c144157] Build passed (Build macOS tests) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💻 [CI Build #c144157] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #c144157] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVMutableCompositionInsertHandler))] | ||
unsafe internal delegate void DAVMutableCompositionInsertHandler (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVMutableCompositionInsertHandler))]
unsafe internal delegate void DAVMutableCompositionInsertHandler (IntPtr block, NativeHandle error);
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVMutableCompositionInsertHandler> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError?> (error)!); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, NativeHandle error) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVMutableCompositionInsertHandler> (block);
if (del is not null) {
del ( Runtime.GetNSObject<NSError> (error)!);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want not to do GetNSObject<NSError?>. They should always use the non nullable class, will create a PR with that fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed: #22941
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVMutableVideoCompositionCreateApplier))] | ||
unsafe internal delegate void DAVMutableVideoCompositionCreateApplier (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated code:
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVMutableVideoCompositionCreateApplier))]
unsafe internal delegate void DAVMutableVideoCompositionCreateApplier (IntPtr block, NativeHandle request);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle request) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVMutableVideoCompositionCreateApplier> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::ObjCRuntime.Runtime.GetNSObject<global::AVFoundation.AVAsynchronousCIImageFilteringRequest> (request)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated code:
internal static unsafe void Invoke (IntPtr block, NativeHandle request) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVMutableVideoCompositionCreateApplier> (block);
if (del is not null) {
del ( Runtime.GetNSObject<AVAsynchronousCIImageFilteringRequest> (request)!);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVMutableVideoCompositionCreateCallback))] | ||
unsafe internal delegate void DAVMutableVideoCompositionCreateCallback (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle videoComposition, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVMutableVideoCompositionCreateCallback))]
unsafe internal delegate void DAVMutableVideoCompositionCreateCallback (IntPtr block, NativeHandle videoComposition, NativeHandle error);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle videoComposition, global::ObjCRuntime.NativeHandle error) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVMutableVideoCompositionCreateCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::ObjCRuntime.Runtime.GetNSObject<global::AVFoundation.AVMutableVideoComposition?> (videoComposition)!, global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError?> (error)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, NativeHandle videoComposition, NativeHandle error) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVMutableVideoCompositionCreateCallback> (block);
if (del is not null) {
del ( Runtime.GetNSObject<AVMutableVideoComposition> (videoComposition)!, Runtime.GetNSObject<NSError> (error)!);
}
}
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback))] | ||
unsafe internal delegate void DAVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback (global::System.IntPtr block_ptr, byte success); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback))]
unsafe internal delegate void DAVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback (IntPtr block, byte success);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, byte success) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (success != 0); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, byte success) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback> (block);
if (del is not null) {
del (success != 0);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVPlayerItemIntegratedTimelineAddPeriodicTimeObserverCallback))] | ||
unsafe internal delegate void DAVPlayerItemIntegratedTimelineAddPeriodicTimeObserverCallback (global::System.IntPtr block_ptr, global::CoreMedia.CMTime time); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVPlayerItemIntegratedTimelineAddPeriodicTimeObserverCallback))]
unsafe internal delegate void DAVPlayerItemIntegratedTimelineAddPeriodicTimeObserverCallback (IntPtr block, global::CoreMedia.CMTime time);
[Preserve (Conditional = true)] | ||
[UnmanagedCallersOnly] | ||
[UserDelegateType (typeof (global::AVFoundation.AVPlayerItemIntegratedTimelineAddPeriodicTimeObserverCallback))] | ||
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::CoreMedia.CMTime time) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVPlayerItemIntegratedTimelineAddPeriodicTimeObserverCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (time); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, global::CoreMedia.CMTime time) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVPlayerItemIntegratedTimelineAddPeriodicTimeObserverCallback> (block);
if (del is not null) {
del (time);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVPlayerItemIntegratedTimelineSeekCallback))] | ||
unsafe internal delegate void DAVPlayerItemIntegratedTimelineSeekCallback (global::System.IntPtr block_ptr, byte success); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVPlayerItemIntegratedTimelineSeekCallback (IntPtr block, byte success);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, byte success) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVPlayerItemIntegratedTimelineSeekCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (success != 0); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, byte success) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVPlayerItemIntegratedTimelineSeekCallback> (block);
if (del is not null) {
del (success != 0);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVRequestAccessStatus))] | ||
unsafe internal delegate void DAVRequestAccessStatus (global::System.IntPtr block_ptr, byte accessGranted); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVRequestAccessStatus (IntPtr block, byte accessGranted);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, byte accessGranted) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVRequestAccessStatus> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (accessGranted != 0); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, byte accessGranted) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVRequestAccessStatus> (block);
if (del is not null) {
del (accessGranted != 0);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVSampleBufferGeneratorBatchMakeReadyCallback))] | ||
unsafe internal delegate void DAVSampleBufferGeneratorBatchMakeReadyCallback (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVSampleBufferGeneratorBatchMakeReadyCallback (IntPtr block, NativeHandle error);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle error) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVSampleBufferGeneratorBatchMakeReadyCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError?> (error)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, NativeHandle error) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVSampleBufferGeneratorBatchMakeReadyCallback> (block);
if (del is not null) {
del ( Runtime.GetNSObject<NSError> (error)!);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVSampleBufferVideoRendererLoadVideoPerformanceMetricsCallback))] | ||
unsafe internal delegate void DAVSampleBufferVideoRendererLoadVideoPerformanceMetricsCallback (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle videoPerformanceMetrics); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVSampleBufferVideoRendererLoadVideoPerformanceMetricsCallback (IntPtr block, NativeHandle videoPerformanceMetrics);
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVSpeechSynthesisProviderOutputBlock))] | ||
unsafe internal delegate void DAVSpeechSynthesisProviderOutputBlock (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle markers, global::ObjCRuntime.NativeHandle request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVSpeechSynthesisProviderOutputBlock (IntPtr block, NativeHandle markers, NativeHandle request);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle markers, global::ObjCRuntime.NativeHandle request) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesisProviderOutputBlock> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::CoreFoundation.CFArray.ArrayFromHandle<global::AVFoundation.AVSpeechSynthesisMarker> (markers)!, global::ObjCRuntime.Runtime.GetNSObject<global::AVFoundation.AVSpeechSynthesisProviderRequest> (request)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, NativeHandle markers, NativeHandle request) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesisProviderOutputBlock> (block);
if (del is not null) {
del (CFArray.ArrayFromHandle<global::AVFoundation.AVSpeechSynthesisMarker> (markers)!, Runtime.GetNSObject<AVSpeechSynthesisProviderRequest> (request)!);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVSpeechSynthesizerBufferCallback))] | ||
unsafe internal delegate void DAVSpeechSynthesizerBufferCallback (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle buffer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVSpeechSynthesizerBufferCallback (IntPtr block, NativeHandle buffer);
```
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle buffer) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesizerBufferCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::ObjCRuntime.Runtime.GetNSObject<global::AVFoundation.AVAudioBuffer> (buffer)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, NativeHandle buffer) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesizerBufferCallback> (block);
if (del is not null) {
del ( Runtime.GetNSObject<AVAudioBuffer> (buffer)!);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVSpeechSynthesizerMarkerCallback))] | ||
unsafe internal delegate void DAVSpeechSynthesizerMarkerCallback (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle markers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVSpeechSynthesizerMarkerCallback (IntPtr block, NativeHandle markers);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle markers) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesizerMarkerCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::CoreFoundation.CFArray.ArrayFromHandle<global::AVFoundation.AVSpeechSynthesisMarker> (markers)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, NativeHandle markers) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesizerMarkerCallback> (block);
if (del is not null) {
del (CFArray.ArrayFromHandle<global::AVFoundation.AVSpeechSynthesisMarker> (markers)!);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVSpeechSynthesizerRequestPersonalVoiceAuthorizationCallback))] | ||
unsafe internal delegate void DAVSpeechSynthesizerRequestPersonalVoiceAuthorizationCallback (global::System.IntPtr block_ptr, global::System.UIntPtr status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVSpeechSynthesizerRequestPersonalVoiceAuthorizationCallback (IntPtr block, UIntPtr status);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::System.UIntPtr status) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesizerRequestPersonalVoiceAuthorizationCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del ((global::AVFoundation.AVSpeechSynthesisPersonalVoiceAuthorizationStatus) (ulong) status); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, UIntPtr status) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVSpeechSynthesizerRequestPersonalVoiceAuthorizationCallback> (block);
if (del is not null) {
del ((AVSpeechSynthesisPersonalVoiceAuthorizationStatus) (ulong) status);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVVideoCompositionCreateApplier))] | ||
unsafe internal delegate void DAVVideoCompositionCreateApplier (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle applier); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVVideoCompositionCreateApplier (IntPtr block, NativeHandle applier);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle applier) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVVideoCompositionCreateApplier> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (global::ObjCRuntime.Runtime.GetNSObject<global::AVFoundation.AVAsynchronousCIImageFilteringRequest> (applier)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, NativeHandle applier) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVVideoCompositionCreateApplier> (block);
if (del is not null) {
del ( Runtime.GetNSObject<AVAsynchronousCIImageFilteringRequest> (applier)!);
}
}
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVVideoCompositionCreateCallback))] | ||
unsafe internal delegate void DAVVideoCompositionCreateCallback (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle videoComposition, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVVideoCompositionCreateCallback (IntPtr block, NativeHandle videoComposition, NativeHandle error);
|
||
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)] | ||
[UserDelegateType (typeof (global::AVFoundation.AVVideoCompositionDetermineValidityCallback))] | ||
unsafe internal delegate void DAVVideoCompositionDetermineValidityCallback (global::System.IntPtr block_ptr, byte isValid, global::ObjCRuntime.NativeHandle error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
unsafe internal delegate void DAVVideoCompositionDetermineValidityCallback (IntPtr block, byte isValid, NativeHandle error);
internal static unsafe void Invoke (global::System.IntPtr block_ptr, byte isValid, global::ObjCRuntime.NativeHandle error) | ||
{ | ||
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::AVFoundation.AVVideoCompositionDetermineValidityCallback> (block_ptr); | ||
if (del is not null) | ||
{ | ||
del (isValid != 0, global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError?> (error)!); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bgen generated:
internal static unsafe void Invoke (IntPtr block, byte isValid, NativeHandle error) {
var del = BlockLiteral.GetTarget<global::AVFoundation.AVVideoCompositionDetermineValidityCallback> (block);
if (del is not null) {
del (isValid != 0, Runtime.GetNSObject<NSError> (error)!);
}
}
Add tests for all the AVFoundation delegates that we know about.