gstreamer/sources/generated/Gst/GstSharp.MemoryMapFullFunctionNative.cs

99 lines
2.7 KiB
C#
Raw Normal View History

2018-01-29 18:56:49 +00:00
// 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 IntPtr MemoryMapFullFunctionNative(IntPtr mem, IntPtr info, UIntPtr maxsize);
internal class MemoryMapFullFunctionInvoker {
MemoryMapFullFunctionNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~MemoryMapFullFunctionInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal MemoryMapFullFunctionInvoker (MemoryMapFullFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal MemoryMapFullFunctionInvoker (MemoryMapFullFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal MemoryMapFullFunctionInvoker (MemoryMapFullFunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.MemoryMapFullFunction Handler {
get {
return new Gst.MemoryMapFullFunction(InvokeNative);
}
}
IntPtr InvokeNative (Gst.Memory mem, Gst.MapInfo info, ulong maxsize)
{
IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc (info);
IntPtr __result = native_cb (mem == null ? IntPtr.Zero : mem.Handle, native_info, new UIntPtr (maxsize));
Marshal.FreeHGlobal (native_info);
return __result;
}
}
internal class MemoryMapFullFunctionWrapper {
public IntPtr NativeCallback (IntPtr mem, IntPtr info, UIntPtr maxsize)
{
try {
IntPtr __ret = managed (mem == IntPtr.Zero ? null : (Gst.Memory) GLib.Opaque.GetOpaque (mem, typeof (Gst.Memory), false), Gst.MapInfo.New (info), (ulong) maxsize);
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 MemoryMapFullFunctionNative NativeDelegate;
Gst.MemoryMapFullFunction managed;
public MemoryMapFullFunctionWrapper (Gst.MemoryMapFullFunction managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new MemoryMapFullFunctionNative (NativeCallback);
}
public static Gst.MemoryMapFullFunction GetManagedDelegate (MemoryMapFullFunctionNative native)
{
if (native == null)
return null;
MemoryMapFullFunctionWrapper wrapper = (MemoryMapFullFunctionWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}