Release 1.22.7
[platform/upstream/gstreamer.git] / subprojects / gstreamer-sharp / sources / generated / Gst / GstSharp.PadEventFullFunctionNative.cs
1 // This file was generated by the Gtk# code generator.
2 // Any changes made will be lost if regenerated.
3
4 namespace GstSharp {
5
6         using System;
7         using System.Runtime.InteropServices;
8
9 #region Autogenerated code
10         [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
11         internal delegate int PadEventFullFunctionNative(IntPtr pad, IntPtr parent, IntPtr evnt);
12
13         internal class PadEventFullFunctionInvoker {
14
15                 PadEventFullFunctionNative native_cb;
16                 IntPtr __data;
17                 GLib.DestroyNotify __notify;
18
19                 ~PadEventFullFunctionInvoker ()
20                 {
21                         if (__notify == null)
22                                 return;
23                         __notify (__data);
24                 }
25
26                 internal PadEventFullFunctionInvoker (PadEventFullFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
27
28                 internal PadEventFullFunctionInvoker (PadEventFullFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
29
30                 internal PadEventFullFunctionInvoker (PadEventFullFunctionNative native_cb, IntPtr data, GLib.DestroyNotify notify)
31                 {
32                         this.native_cb = native_cb;
33                         __data = data;
34                         __notify = notify;
35                 }
36
37                 internal Gst.PadEventFullFunction Handler {
38                         get {
39                                 return new Gst.PadEventFullFunction(InvokeNative);
40                         }
41                 }
42
43                 Gst.FlowReturn InvokeNative (Gst.Pad pad, Gst.Object parent, Gst.Event evnt)
44                 {
45                         evnt.Owned = false;
46                         Gst.FlowReturn __result = (Gst.FlowReturn) native_cb (pad == null ? IntPtr.Zero : pad.Handle, parent == null ? IntPtr.Zero : parent.Handle, evnt == null ? IntPtr.Zero : evnt.Handle);
47                         return __result;
48                 }
49         }
50
51         internal class PadEventFullFunctionWrapper {
52
53                 public int NativeCallback (IntPtr pad, IntPtr parent, IntPtr evnt)
54                 {
55                         try {
56                                 Gst.FlowReturn __ret = managed (GLib.Object.GetObject(pad) as Gst.Pad, GLib.Object.GetObject(parent) as Gst.Object, evnt == IntPtr.Zero ? null : (Gst.Event) GLib.Opaque.GetOpaque (evnt, typeof (Gst.Event), true));
57                                 if (release_on_call)
58                                         gch.Free ();
59                                 return (int) __ret;
60                         } catch (Exception e) {
61                                 GLib.ExceptionManager.RaiseUnhandledException (e, true);
62                                 // NOTREACHED: Above call does not return.
63                                 throw e;
64                         }
65                 }
66
67                 bool release_on_call = false;
68                 GCHandle gch;
69
70                 public void PersistUntilCalled ()
71                 {
72                         release_on_call = true;
73                         gch = GCHandle.Alloc (this);
74                 }
75
76                 internal PadEventFullFunctionNative NativeDelegate;
77                 Gst.PadEventFullFunction managed;
78
79                 public PadEventFullFunctionWrapper (Gst.PadEventFullFunction managed)
80                 {
81                         this.managed = managed;
82                         if (managed != null)
83                                 NativeDelegate = new PadEventFullFunctionNative (NativeCallback);
84                 }
85
86                 public static Gst.PadEventFullFunction GetManagedDelegate (PadEventFullFunctionNative native)
87                 {
88                         if (native == null)
89                                 return null;
90                         PadEventFullFunctionWrapper wrapper = (PadEventFullFunctionWrapper) native.Target;
91                         if (wrapper == null)
92                                 return null;
93                         return wrapper.managed;
94                 }
95         }
96 #endregion
97 }