1 // This file was generated by the Gtk# code generator.
2 // Any changes made will be lost if regenerated.
4 namespace Gst.AudioSharp {
7 using System.Runtime.InteropServices;
9 #region Autogenerated code
10 [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
11 internal delegate void AudioFormatPackNative(IntPtr info, int flags, byte[] src, byte[] data, int n_length);
13 internal class AudioFormatPackInvoker {
15 AudioFormatPackNative native_cb;
17 GLib.DestroyNotify __notify;
19 ~AudioFormatPackInvoker ()
26 internal AudioFormatPackInvoker (AudioFormatPackNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
28 internal AudioFormatPackInvoker (AudioFormatPackNative native_cb, IntPtr data) : this (native_cb, data, null) {}
30 internal AudioFormatPackInvoker (AudioFormatPackNative native_cb, IntPtr data, GLib.DestroyNotify notify)
32 this.native_cb = native_cb;
37 internal Gst.Audio.AudioFormatPack Handler {
39 return new Gst.Audio.AudioFormatPack(InvokeNative);
43 void InvokeNative (Gst.Audio.AudioFormatInfo info, Gst.Audio.AudioPackFlags flags, byte[] src, byte[] data)
45 IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc (info);
46 native_cb (native_info, (int) flags, src, data, (data == null ? 0 : data.Length));
47 Marshal.FreeHGlobal (native_info);
51 internal class AudioFormatPackWrapper {
53 public void NativeCallback (IntPtr info, int flags, byte[] src, byte[] data, int n_length)
56 managed (Gst.Audio.AudioFormatInfo.New (info), (Gst.Audio.AudioPackFlags) flags, src, data);
59 } catch (Exception e) {
60 GLib.ExceptionManager.RaiseUnhandledException (e, false);
64 bool release_on_call = false;
67 public void PersistUntilCalled ()
69 release_on_call = true;
70 gch = GCHandle.Alloc (this);
73 internal AudioFormatPackNative NativeDelegate;
74 Gst.Audio.AudioFormatPack managed;
76 public AudioFormatPackWrapper (Gst.Audio.AudioFormatPack managed)
78 this.managed = managed;
80 NativeDelegate = new AudioFormatPackNative (NativeCallback);
83 public static Gst.Audio.AudioFormatPack GetManagedDelegate (AudioFormatPackNative native)
87 AudioFormatPackWrapper wrapper = (AudioFormatPackWrapper) native.Target;
90 return wrapper.managed;