Skip to content

[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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mandel-macaque
Copy link
Member

Add tests for all the AVFoundation delegates that we know about.

mandel-macaque and others added 4 commits May 28, 2025 11:38
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.
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);
Copy link
Member Author

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);

Comment on lines +26 to +33
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)!);
}
}
Copy link
Member Author

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)!);
Copy link
Member Author

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);
Copy link
Member Author

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)!);
Copy link
Member Author

@mandel-macaque mandel-macaque May 28, 2025

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);
Copy link
Member Author

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)!);
Copy link
Member Author

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);
Copy link
Member Author

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?

Copy link
Member

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.

Comment on lines +166 to +176
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;
}
Copy link
Member Author

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:

  1. rgen inits the outStatus to the default.
  2. 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.

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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);
Copy link
Member Author

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);

Comment on lines +204 to +214
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;
}
Copy link
Member Author

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:

  1. We init outError before the call.
  2. 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);
Copy link
Member Author

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);

@vs-mobiletools-engineering-service2

This comment has been minimized.

Comment on lines +242 to +251
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;
}
Copy link
Member Author

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);
Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix in #22930

Comment on lines +166 to +176
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;
}
Copy link
Member

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);
Copy link
Member

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.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #5a32fc5] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 5a32fc59f62ff96e036062bbc2c0ca6049f6fc94 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #c144157] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: c1441578211fd7bb2476877929fb324df2179668 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #c144157] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: c1441578211fd7bb2476877929fb324df2179668 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #c144157] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: c1441578211fd7bb2476877929fb324df2179668 [PR build]

Comment on lines +809 to +811
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVMutableCompositionInsertHandler))]
unsafe internal delegate void DAVMutableCompositionInsertHandler (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle error);
Copy link
Member Author

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);

Comment on lines +821 to +825
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)!);
}
Copy link
Member Author

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)!);
	}
}

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed: #22941

Comment on lines +844 to +846
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVMutableVideoCompositionCreateApplier))]
unsafe internal delegate void DAVMutableVideoCompositionCreateApplier (global::System.IntPtr block_ptr, global::ObjCRuntime.NativeHandle request);
Copy link
Member Author

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);

Comment on lines +854 to +861
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)!);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +889 to +896
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)!);
}
}
Copy link
Member Author

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)!);
	}
}

Comment on lines +914 to +916
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::AVFoundation.AVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback))]
unsafe internal delegate void DAVPlayerItemIntegratedTimelineAddBoundaryTimeObserverCallback (global::System.IntPtr block_ptr, byte success);
Copy link
Member Author

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);

Comment on lines +924 to +931
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);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +956 to +966
[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);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +994 to +1001
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);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +1029 to +1036
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);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +1064 to +1071
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)!);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +1134 to +1141
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)!);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);
```

Comment on lines +1169 to +1176
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)!);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +1204 to +1211
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)!);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +1239 to +1246
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);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +1274 to +1281
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)!);
}
}
Copy link
Member Author

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);
Copy link
Member Author

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);
Copy link
Member Author

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);

Comment on lines +1344 to +1351
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)!);
}
}
Copy link
Member Author

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)!);
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants