gstreamer/subprojects/gstreamer-sharp/sources/generated/Gst/GstSharp.MemoryIsSpanFunctionNative.cs

95 lines
2.6 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace GstSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool MemoryIsSpanFunctionNative(IntPtr mem1, IntPtr mem2, UIntPtr offset);
internal class MemoryIsSpanFunctionInvoker {
MemoryIsSpanFunctionNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~MemoryIsSpanFunctionInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal MemoryIsSpanFunctionInvoker (MemoryIsSpanFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal MemoryIsSpanFunctionInvoker (MemoryIsSpanFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal MemoryIsSpanFunctionInvoker (MemoryIsSpanFunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.MemoryIsSpanFunction Handler {
get {
return new Gst.MemoryIsSpanFunction(InvokeNative);
}
}
bool InvokeNative (Gst.Memory mem1, Gst.Memory mem2, ulong offset)
{
bool __result = native_cb (mem1 == null ? IntPtr.Zero : mem1.Handle, mem2 == null ? IntPtr.Zero : mem2.Handle, new UIntPtr (offset));
return __result;
}
}
internal class MemoryIsSpanFunctionWrapper {
public bool NativeCallback (IntPtr mem1, IntPtr mem2, UIntPtr offset)
{
try {
bool __ret = managed (mem1 == IntPtr.Zero ? null : (Gst.Memory) GLib.Opaque.GetOpaque (mem1, typeof (Gst.Memory), false), mem2 == IntPtr.Zero ? null : (Gst.Memory) GLib.Opaque.GetOpaque (mem2, typeof (Gst.Memory), false), (ulong) offset);
if (release_on_call)
gch.Free ();
return __ret;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
return false;
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled ()
{
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal MemoryIsSpanFunctionNative NativeDelegate;
Gst.MemoryIsSpanFunction managed;
public MemoryIsSpanFunctionWrapper (Gst.MemoryIsSpanFunction managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new MemoryIsSpanFunctionNative (NativeCallback);
}
public static Gst.MemoryIsSpanFunction GetManagedDelegate (MemoryIsSpanFunctionNative native)
{
if (native == null)
return null;
MemoryIsSpanFunctionWrapper wrapper = (MemoryIsSpanFunctionWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}