static void OverrideAllocBuffer(GLib.GType gtype, AllocBufferNativeDelegate callback) { unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("alloc_buffer")); *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback); } }
private Gst.FlowReturn InternalAllocBuffer(Gst.Buffer buffer, Gst.BufferPoolAcquireParams parms) { AllocBufferNativeDelegate unmanaged = null; unsafe { IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("alloc_buffer")); unmanaged = (AllocBufferNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(AllocBufferNativeDelegate)); } if (unmanaged == null) { return((Gst.FlowReturn) 0); } IntPtr native_parms = GLib.Marshaller.StructureToPtrAlloc(parms); int __result = unmanaged(this.Handle, buffer == null ? IntPtr.Zero : buffer.Handle, native_parms); Marshal.FreeHGlobal(native_parms); return((Gst.FlowReturn)__result); }