gstreamer/gstreamer-sharp/GstSharp.PadQueryTypeFunctionNative.cs
Sebastian Dröge aa7bb8fa1c Use internal glib-sharp copy everywhere and make it work side-by-side with real glib-sharp
glib-sharp will only get a new release with the new API that we need for
3.0 in a year or something. Instead of waiting a year before we can release
something we now have our own internal copy of glib-sharp trunk that will
be dropped once glib-sharp 3.0 is released.

Everything is now compilable and working without any additional patches.
2009-08-05 16:57:20 +02:00

115 lines
3.3 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace GstSharp {
using System;
using System.Runtime.InteropServices;
using System.Collections;
#region Autogenerated code
[Gst.GLib.CDeclCallback]
internal delegate IntPtr PadQueryTypeFunctionNative (IntPtr pad);
internal class PadQueryTypeFunctionInvoker {
PadQueryTypeFunctionNative native_cb;
IntPtr __data;
Gst.GLib.DestroyNotify __notify;
~PadQueryTypeFunctionInvoker () {
if (__notify == null)
return;
__notify (__data);
}
internal PadQueryTypeFunctionInvoker (PadQueryTypeFunctionNative native_cb) : this (native_cb, IntPtr.Zero, null) {}
internal PadQueryTypeFunctionInvoker (PadQueryTypeFunctionNative native_cb, IntPtr data) : this (native_cb, data, null) {}
internal PadQueryTypeFunctionInvoker (PadQueryTypeFunctionNative native_cb, IntPtr data, Gst.GLib.DestroyNotify notify) {
this.native_cb = native_cb;
__data = data;
__notify = notify;
}
internal Gst.PadQueryTypeFunction Handler {
get {
return new Gst.PadQueryTypeFunction (InvokeNative);
}
}
Gst.QueryType[] InvokeNative (Gst.Pad pad) {
IntPtr raw_ret = native_cb (pad == null ? IntPtr.Zero : pad.Handle);
if (raw_ret == IntPtr.Zero)
return new Gst.QueryType[] {};
ArrayList result = new ArrayList ();
bool term = false;
int ofs = 0;
while (!term) {
Gst.QueryType t = (Gst.QueryType) Marshal.ReadInt32 (raw_ret, ofs);
if (t == Gst.QueryType.None) {
term = true;
} else {
result.Add (t);
ofs += 4;
}
}
return (Gst.QueryType[]) result.ToArray (typeof (Gst.QueryType));
}
}
internal class PadQueryTypeFunctionWrapper {
IntPtr raw_ret = IntPtr.Zero;
public IntPtr NativeCallback (IntPtr pad) {
try {
if (raw_ret != IntPtr.Zero)
return raw_ret;
Gst.QueryType[] __ret = managed (Gst.GLib.Object.GetObject (pad) as Gst.Pad);
if (release_on_call)
gch.Free ();
raw_ret = Marshal.AllocHGlobal (4 * __ret.Length + 4);
for (int i = 0; i < __ret.Length; i++)
Marshal.WriteInt32 (raw_ret, i * 4, (int) __ret[i]);
Marshal.WriteInt32 (raw_ret, __ret.Length * 4, 0);
return raw_ret;
} catch (Exception e) {
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: Above call does not return.
throw e;
}
}
bool release_on_call = false;
GCHandle gch;
public void PersistUntilCalled () {
release_on_call = true;
gch = GCHandle.Alloc (this);
}
internal PadQueryTypeFunctionNative NativeDelegate;
Gst.PadQueryTypeFunction managed;
public PadQueryTypeFunctionWrapper (Gst.PadQueryTypeFunction managed) {
this.managed = managed;
if (managed != null)
NativeDelegate = new PadQueryTypeFunctionNative (NativeCallback);
}
public static Gst.PadQueryTypeFunction GetManagedDelegate (PadQueryTypeFunctionNative native) {
if (native == null)
return null;
PadQueryTypeFunctionWrapper wrapper = (PadQueryTypeFunctionWrapper) native.Target;
if (wrapper == null)
return null;
return wrapper.managed;
}
}
#endregion
}