// 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 MetaDeserializeFunctionNative(IntPtr info, IntPtr buffer, byte data, UIntPtr size, byte version); internal class MetaDeserializeFunctionInvoker { MetaDeserializeFunctionNative native_cb; IntPtr __data; GLib.DestroyNotify __notify; ~MetaDeserializeFunctionInvoker () { if (__notify == null) return; __notify (__data); } internal MetaDeserializeFunctionInvoker (MetaDeserializeFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {} internal MetaDeserializeFunctionInvoker (MetaDeserializeFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {} internal MetaDeserializeFunctionInvoker (MetaDeserializeFunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify) { this.native_cb = native_cb; __data = data; __notify = notify; } internal Gst.MetaDeserializeFunction Handler { get { return new Gst.MetaDeserializeFunction(InvokeNative); } } Gst.Meta InvokeNative (Gst.MetaInfo info, Gst.Buffer buffer, byte data, ulong size, byte version) { IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc (info); Gst.Meta __result = Gst.Meta.New (native_cb (native_info, buffer == null ? IntPtr.Zero : buffer.Handle, data, new UIntPtr (size), version)); Marshal.FreeHGlobal (native_info); return __result; } } internal class MetaDeserializeFunctionWrapper { public IntPtr NativeCallback (IntPtr info, IntPtr buffer, byte data, UIntPtr size, byte version) { try { Gst.Meta __ret = managed (Gst.MetaInfo.New (info), buffer == IntPtr.Zero ? null : (Gst.Buffer) GLib.Opaque.GetOpaque (buffer, typeof (Gst.Buffer), false), data, (ulong) size, version); if (release_on_call) gch.Free (); return GLib.Marshaller.StructureToPtrAlloc (__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 MetaDeserializeFunctionNative NativeDelegate; Gst.MetaDeserializeFunction managed; public MetaDeserializeFunctionWrapper (Gst.MetaDeserializeFunction managed) { this.managed = managed; if (managed != null) NativeDelegate = new MetaDeserializeFunctionNative (NativeCallback); } public static Gst.MetaDeserializeFunction GetManagedDelegate (MetaDeserializeFunctionNative native) { if (native == null) return null; MetaDeserializeFunctionWrapper wrapper = (MetaDeserializeFunctionWrapper) native.Target; if (wrapper == null) return null; return wrapper.managed; } } #endregion }