Move files from gstreamer-sharp into the "subprojects/gstreamer-sharp/" subdir
[platform/upstream/gstreamer.git] / subprojects / gstreamer-sharp / sources / generated / Gst / GstSharp.MemoryMapFullFunctionNative.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 IntPtr MemoryMapFullFunctionNative(IntPtr mem, IntPtr info, UIntPtr maxsize);
12
13         internal class MemoryMapFullFunctionInvoker {
14
15                 MemoryMapFullFunctionNative native_cb;
16                 IntPtr __data;
17                 GLib.DestroyNotify __notify;
18
19                 ~MemoryMapFullFunctionInvoker ()
20                 {
21                         if (__notify == null)
22                                 return;
23                         __notify (__data);
24                 }
25
26                 internal MemoryMapFullFunctionInvoker (MemoryMapFullFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
27
28                 internal MemoryMapFullFunctionInvoker (MemoryMapFullFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
29
30                 internal MemoryMapFullFunctionInvoker (MemoryMapFullFunctionNative 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.MemoryMapFullFunction Handler {
38                         get {
39                                 return new Gst.MemoryMapFullFunction(InvokeNative);
40                         }
41                 }
42
43                 IntPtr InvokeNative (Gst.Memory mem, Gst.MapInfo info, ulong maxsize)
44                 {
45                         IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc (info);
46                         IntPtr __result = native_cb (mem == null ? IntPtr.Zero : mem.Handle, native_info, new UIntPtr (maxsize));
47                         Marshal.FreeHGlobal (native_info);
48                         return __result;
49                 }
50         }
51
52         internal class MemoryMapFullFunctionWrapper {
53
54                 public IntPtr NativeCallback (IntPtr mem, IntPtr info, UIntPtr maxsize)
55                 {
56                         try {
57                                 IntPtr __ret = managed (mem == IntPtr.Zero ? null : (Gst.Memory) GLib.Opaque.GetOpaque (mem, typeof (Gst.Memory), false), Gst.MapInfo.New (info), (ulong) maxsize);
58                                 if (release_on_call)
59                                         gch.Free ();
60                                 return __ret;
61                         } catch (Exception e) {
62                                 GLib.ExceptionManager.RaiseUnhandledException (e, true);
63                                 // NOTREACHED: Above call does not return.
64                                 throw e;
65                         }
66                 }
67
68                 bool release_on_call = false;
69                 GCHandle gch;
70
71                 public void PersistUntilCalled ()
72                 {
73                         release_on_call = true;
74                         gch = GCHandle.Alloc (this);
75                 }
76
77                 internal MemoryMapFullFunctionNative NativeDelegate;
78                 Gst.MemoryMapFullFunction managed;
79
80                 public MemoryMapFullFunctionWrapper (Gst.MemoryMapFullFunction managed)
81                 {
82                         this.managed = managed;
83                         if (managed != null)
84                                 NativeDelegate = new MemoryMapFullFunctionNative (NativeCallback);
85                 }
86
87                 public static Gst.MemoryMapFullFunction GetManagedDelegate (MemoryMapFullFunctionNative native)
88                 {
89                         if (native == null)
90                                 return null;
91                         MemoryMapFullFunctionWrapper wrapper = (MemoryMapFullFunctionWrapper) native.Target;
92                         if (wrapper == null)
93                                 return null;
94                         return wrapper.managed;
95                 }
96         }
97 #endregion
98 }