gstreamer/sources/generated/Gst.Audio/Gst.AudioSharp.AudioFormatUnpackNative.cs
Thibault Saunier 2d00f898fb Move generated files to dedicated folders named by namespace
Making it cleaner and simpler to navigate and removing previous
ugly and now useless hack where we were renaming files ourself
to make meson happy.
2018-03-11 21:47:35 -03:00

94 lines
2.6 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst.AudioSharp {
using System;
using System.Runtime.InteropServices;
#region Autogenerated code
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void AudioFormatUnpackNative(IntPtr info, int flags, byte[] dest, byte[] data, int n_length);
internal class AudioFormatUnpackInvoker {
AudioFormatUnpackNative native_cb;
IntPtr __data;
GLib.DestroyNotify __notify;
~AudioFormatUnpackInvoker ()
{
if (__notify == null)
return;
__notify (__data);
}
internal AudioFormatUnpackInvoker (AudioFormatUnpackNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal AudioFormatUnpackInvoker (AudioFormatUnpackNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal AudioFormatUnpackInvoker (AudioFormatUnpackNative native_cb, IntPtr data, GLib.DestroyNotify notify)
{
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.Audio.AudioFormatUnpack Handler {
get {
return new Gst.Audio.AudioFormatUnpack(InvokeNative);
}
}
void InvokeNative (Gst.Audio.AudioFormatInfo info, Gst.Audio.AudioPackFlags flags, byte[] dest, byte[] data)
{
IntPtr native_info = GLib.Marshaller.StructureToPtrAlloc (info);
native_cb (native_info, (int) flags, dest, data, (data == null ? 0 : data.Length));
Marshal.FreeHGlobal (native_info);
}
}
internal class AudioFormatUnpackWrapper {
public void NativeCallback (IntPtr info, int flags, byte[] dest, byte[] data, int n_length)
{
try {
managed (Gst.Audio.AudioFormatInfo.New (info), (Gst.Audio.AudioPackFlags) flags, dest, data);
if (release_on_call)
gch.Free ();
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled ()
{
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal AudioFormatUnpackNative NativeDelegate;
Gst.Audio.AudioFormatUnpack managed;
public AudioFormatUnpackWrapper (Gst.Audio.AudioFormatUnpack managed)
{
this.managed = managed;
if (managed != null)
NativeDelegate = new AudioFormatUnpackNative (NativeCallback);
}
public static Gst.Audio.AudioFormatUnpack GetManagedDelegate (AudioFormatUnpackNative native)
{
if (native == null)
return null;
AudioFormatUnpackWrapper wrapper = (AudioFormatUnpackWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}