gstreamer/gstreamer-sharp/override/ColorBalanceAdapter.cs

225 lines
7.5 KiB
C#
Raw Normal View History

// This file was generated by the Gtk# code generator.
// Changed to handle the BalanceType interface field
namespace Gst.Interfaces {
using System;
using System.Runtime.InteropServices;
using System.Reflection;
#region Autogenerated code
public class ColorBalanceAdapter : GLib.GInterfaceAdapter, Gst.Interfaces.ColorBalance {
[StructLayout (LayoutKind.Sequential)]
struct GstColorBalanceClass {
public Gst.Interfaces.ColorBalanceType BalanceType;
public ListChannelsNativeDelegate ListChannels;
public SetValueNativeDelegate SetValue;
public GetValueNativeDelegate GetValue;
IntPtr ValueChanged;
[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
public IntPtr[] GstReserved;
}
static GstColorBalanceClass iface;
static ColorBalanceAdapter ()
{
GLib.GType.Register (_gtype, typeof(ColorBalanceAdapter));
iface.ListChannels = new ListChannelsNativeDelegate (ListChannels_cb);
iface.SetValue = new SetValueNativeDelegate (SetValue_cb);
iface.GetValue = new GetValueNativeDelegate (GetValue_cb);
}
[GLib.CDeclCallback]
delegate IntPtr ListChannelsNativeDelegate (IntPtr inst);
static IntPtr ListChannels_cb (IntPtr inst)
{
try {
ColorBalanceImplementor __obj = GLib.Object.GetObject (inst, false) as ColorBalanceImplementor;
Gst.Interfaces.ColorBalanceChannel[] __result = __obj.ListChannels ();
return new GLib.List(__result, typeof (Gst.Interfaces.ColorBalanceChannel), false, false) == null ? IntPtr.Zero : new GLib.List(__result, typeof (Gst.Interfaces.ColorBalanceChannel), false, false).Handle;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
[GLib.CDeclCallback]
delegate void SetValueNativeDelegate (IntPtr inst, IntPtr channel, int value);
static void SetValue_cb (IntPtr inst, IntPtr channel, int value)
{
try {
ColorBalanceImplementor __obj = GLib.Object.GetObject (inst, false) as ColorBalanceImplementor;
__obj.SetValue (GLib.Object.GetObject(channel) as Gst.Interfaces.ColorBalanceChannel, value);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[GLib.CDeclCallback]
delegate int GetValueNativeDelegate (IntPtr inst, IntPtr channel);
static int GetValue_cb (IntPtr inst, IntPtr channel)
{
try {
ColorBalanceImplementor __obj = GLib.Object.GetObject (inst, false) as ColorBalanceImplementor;
int __result = __obj.GetValue (GLib.Object.GetObject(channel) as Gst.Interfaces.ColorBalanceChannel);
return __result;
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
static int class_offset = 2 * IntPtr.Size;
static void Initialize (IntPtr ptr, IntPtr data)
{
IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
GstColorBalanceClass native_iface = (GstColorBalanceClass) Marshal.PtrToStructure (ifaceptr, typeof (GstColorBalanceClass));
native_iface.ListChannels = iface.ListChannels;
native_iface.SetValue = iface.SetValue;
native_iface.GetValue = iface.GetValue;
GCHandle gch = (GCHandle) data;
ColorBalanceAdapter adapter = gch.Target as ColorBalanceAdapter;
PropertyInfo pi = adapter.Type.GetProperty ("BalanceType", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
if (pi != null && pi.PropertyType == typeof (Gst.Interfaces.ColorBalanceType))
native_iface.BalanceType = (Gst.Interfaces.ColorBalanceType) pi.GetValue (null, null);
Marshal.StructureToPtr (native_iface, ifaceptr, false);
gch.Free ();
}
public ColorBalanceAdapter ()
{
InitHandler = new GLib.GInterfaceInitHandler (Initialize);
}
ColorBalanceImplementor implementor;
public ColorBalanceAdapter (ColorBalanceImplementor implementor)
{
if (implementor == null)
throw new ArgumentNullException ("implementor");
this.implementor = implementor;
}
public ColorBalanceAdapter (IntPtr handle)
{
if (!_gtype.IsInstance (handle))
throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
this.handle = handle;
}
[DllImport("gstreamer-0.10.dll")]
static extern IntPtr gst_color_balance_get_type();
private static GLib.GType _gtype = new GLib.GType (gst_color_balance_get_type ());
public override GLib.GType GType {
get {
return _gtype;
}
}
IntPtr handle;
public override IntPtr Handle {
get {
if (handle != IntPtr.Zero)
return handle;
return implementor == null ? IntPtr.Zero : implementor.Handle;
}
}
public static ColorBalance GetObject (IntPtr handle, bool owned)
{
GLib.Object obj = GLib.Object.GetObject (handle, owned);
return GetObject (obj);
}
public static ColorBalance GetObject (GLib.Object obj)
{
if (obj == null)
return null;
else if (obj is ColorBalanceImplementor)
return new ColorBalanceAdapter (obj as ColorBalanceImplementor);
else if (obj as ColorBalance == null)
return new ColorBalanceAdapter (obj.Handle);
else
return obj as ColorBalance;
}
public ColorBalanceImplementor Implementor {
get {
return implementor;
}
}
[GLib.Signal("value-changed")]
public event Gst.Interfaces.ValueChangedHandler ValueChanged {
add {
GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "value-changed", typeof (Gst.Interfaces.ValueChangedArgs));
sig.AddDelegate (value);
}
remove {
GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "value-changed", typeof (Gst.Interfaces.ValueChangedArgs));
sig.RemoveDelegate (value);
}
}
[DllImport("gstreamer-0.10.dll")]
static extern void gst_color_balance_set_value(IntPtr raw, IntPtr channel, int value);
public void SetValue(Gst.Interfaces.ColorBalanceChannel channel, int value) {
gst_color_balance_set_value(Handle, channel == null ? IntPtr.Zero : channel.Handle, value);
}
[DllImport("gstreamer-0.10.dll")]
static extern IntPtr gst_color_balance_list_channels(IntPtr raw);
public Gst.Interfaces.ColorBalanceChannel[] ListChannels() {
IntPtr raw_ret = gst_color_balance_list_channels(Handle);
Gst.Interfaces.ColorBalanceChannel[] ret = (Gst.Interfaces.ColorBalanceChannel[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), false, false, typeof(Gst.Interfaces.ColorBalanceChannel));
return ret;
}
[DllImport("gstreamer-0.10.dll")]
static extern int gst_color_balance_get_value(IntPtr raw, IntPtr channel);
public int GetValue(Gst.Interfaces.ColorBalanceChannel channel) {
int raw_ret = gst_color_balance_get_value(Handle, channel == null ? IntPtr.Zero : channel.Handle);
int ret = raw_ret;
return ret;
}
[DllImport("gstreamer-0.10.dll")]
static extern void gst_color_balance_value_changed(IntPtr raw, IntPtr channel, int value);
public void EmitValueChanged(Gst.Interfaces.ColorBalanceChannel channel, int value) {
gst_color_balance_value_changed(Handle, channel == null ? IntPtr.Zero : channel.Handle, value);
}
[DllImport("libgobject-2.0-0.dll")]
static extern IntPtr g_type_interface_peek (IntPtr klass, IntPtr iface_gtype);
public Gst.Interfaces.ColorBalanceType BalanceType {
get {
IntPtr gclass = Marshal.ReadIntPtr (Handle);
IntPtr ifaceptr = g_type_interface_peek (gclass, _gtype.Val);
GstColorBalanceClass native_iface = (GstColorBalanceClass) Marshal.PtrToStructure (ifaceptr, typeof (GstColorBalanceClass));
return native_iface.BalanceType;
}
}
#endregion
}
}