gstreamer/sources/generated/Gst_GstSharp.ElementForeachPadFuncNative.cs
2018-01-29 16:25:26 -03:00

95 lines
2.5 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 ElementForeachPadFuncNative(IntPtr element, IntPtr pad, IntPtr user_data);
internal class ElementForeachPadFuncInvoker {
ElementForeachPadFuncNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~ElementForeachPadFuncInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal ElementForeachPadFuncInvoker (ElementForeachPadFuncNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal ElementForeachPadFuncInvoker (ElementForeachPadFuncNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal ElementForeachPadFuncInvoker (ElementForeachPadFuncNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.ElementForeachPadFunc Handler {
get {
return new Gst.ElementForeachPadFunc(InvokeNative);
}
}
bool InvokeNative (Gst.Element element, Gst.Pad pad)
{
bool __result = native_cb (element == null ? IntPtr.Zero : element.Handle, pad == null ? IntPtr.Zero : pad.Handle, __data);
return __result;
}
}
internal class ElementForeachPadFuncWrapper {
public bool NativeCallback (IntPtr element, IntPtr pad, IntPtr user_data)
{
try {
bool __ret = managed (GLib.Object.GetObject(element) as Gst.Element, GLib.Object.GetObject(pad) as Gst.Pad);
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 ElementForeachPadFuncNative NativeDelegate;
Gst.ElementForeachPadFunc managed;
public ElementForeachPadFuncWrapper (Gst.ElementForeachPadFunc managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new ElementForeachPadFuncNative (NativeCallback);
}
public static Gst.ElementForeachPadFunc GetManagedDelegate (ElementForeachPadFuncNative native)
{
if (native == null)
return null;
ElementForeachPadFuncWrapper wrapper = (ElementForeachPadFuncWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}