gstreamer/subprojects/gstreamer-sharp/sources/generated/Gst.Audio/Gst.AudioSharp.AudioClockGetTimeFuncNative.cs

96 lines
2.5 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst.AudioSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate ulong AudioClockGetTimeFuncNative(IntPtr clock, IntPtr user_data);
internal class AudioClockGetTimeFuncInvoker {
AudioClockGetTimeFuncNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~AudioClockGetTimeFuncInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal AudioClockGetTimeFuncInvoker (AudioClockGetTimeFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal AudioClockGetTimeFuncInvoker (AudioClockGetTimeFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal AudioClockGetTimeFuncInvoker (AudioClockGetTimeFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.Audio.AudioClockGetTimeFunc Handler {
get {
return new Gst.Audio.AudioClockGetTimeFunc(InvokeNative);
}
}
ulong InvokeNative (Gst.Clock clock)
{
ulong __result = native_cb (clock == null ? IntPtr.Zero : clock.Handle, __data);
return __result;
}
}
internal class AudioClockGetTimeFuncWrapper {
public ulong NativeCallback (IntPtr clock, IntPtr user_data)
{
try {
ulong __ret = managed (GLib.Object.GetObject(clock) as Gst.Clock);
if (release_on_call)
gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: Above call does not return.
throw e;
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled ()
{
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal AudioClockGetTimeFuncNative NativeDelegate;
Gst.Audio.AudioClockGetTimeFunc managed;
public AudioClockGetTimeFuncWrapper (Gst.Audio.AudioClockGetTimeFunc managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new AudioClockGetTimeFuncNative (NativeCallback);
}
public static Gst.Audio.AudioClockGetTimeFunc GetManagedDelegate (AudioClockGetTimeFuncNative native)
{
if (native == null)
return null;
AudioClockGetTimeFuncWrapper wrapper = (AudioClockGetTimeFuncWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}