gstreamer/sources/generated/Gst/GstSharp.MemoryMapFullFunctionNative.cs
Thibault Saunier 2d00f898fb Move generated files to dedicated folders named by namespace
Making it cleaner and simpler to navigate and removing previous
ugly and now useless hack where we were renaming files ourself
to make meson happy.
2018-03-11 21:47:35 -03:00

98 lines
2.7 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 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
}