From b8b82acb41bcbb07d2c7e46805213da2030d2957 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 11 Sep 2009 10:08:06 +0200 Subject: [PATCH] Update GInterface override hacks --- gstreamer-sharp/Makefile.am | 1 - gstreamer-sharp/override/ColorBalance.cs | 29 --- gstreamer-sharp/override/ColorBalanceAdapter.cs | 105 ++++++----- gstreamer-sharp/override/Mixer.cs | 19 +- gstreamer-sharp/override/MixerAdapter.cs | 226 +++++++++++------------ gstreamer-sharp/override/NavigationAdapter.cs | 71 +++---- gstreamer-sharp/override/ProbeNeededHandler.cs | 2 +- gstreamer-sharp/override/PropertyProbe.cs | 6 +- gstreamer-sharp/override/PropertyProbeAdapter.cs | 103 ++++++----- gstreamer-sharp/override/URIHandlerAdapter.cs | 97 +++++----- 10 files changed, 324 insertions(+), 335 deletions(-) delete mode 100644 gstreamer-sharp/override/ColorBalance.cs diff --git a/gstreamer-sharp/Makefile.am b/gstreamer-sharp/Makefile.am index 3b733a9..c5b3be6 100644 --- a/gstreamer-sharp/Makefile.am +++ b/gstreamer-sharp/Makefile.am @@ -61,7 +61,6 @@ sources = \ overrides = \ $(srcdir)/override/URIHandlerAdapter.cs \ $(srcdir)/override/ColorBalanceAdapter.cs \ - $(srcdir)/override/ColorBalance.cs \ $(srcdir)/override/Mixer.cs \ $(srcdir)/override/MixerAdapter.cs \ $(srcdir)/override/PropertyProbe.cs \ diff --git a/gstreamer-sharp/override/ColorBalance.cs b/gstreamer-sharp/override/ColorBalance.cs deleted file mode 100644 index 7267dd5..0000000 --- a/gstreamer-sharp/override/ColorBalance.cs +++ /dev/null @@ -1,29 +0,0 @@ -// This file was generated by the Gtk# code generator. -// Changed to include the BalanceType property - -namespace Gst.Interfaces { - - using System; - -#region Autogenerated code - public interface ColorBalance : GLib.IWrapper { - Gst.Interfaces.ColorBalanceType BalanceType { - get ; - } - - event Gst.Interfaces.ValueChangedHandler ValueChanged; - void SetValue(Gst.Interfaces.ColorBalanceChannel channel, int value); - Gst.Interfaces.ColorBalanceChannel[] ListChannels(); - int GetValue(Gst.Interfaces.ColorBalanceChannel channel); - void EmitValueChanged(Gst.Interfaces.ColorBalanceChannel channel, int value); - } - - [GLib.GInterface (typeof (ColorBalanceAdapter))] - public interface ColorBalanceImplementor : GLib.IWrapper { - - Gst.Interfaces.ColorBalanceChannel[] ListChannels (); - void SetValue (Gst.Interfaces.ColorBalanceChannel channel, int value); - int GetValue (Gst.Interfaces.ColorBalanceChannel channel); - } -#endregion -} diff --git a/gstreamer-sharp/override/ColorBalanceAdapter.cs b/gstreamer-sharp/override/ColorBalanceAdapter.cs index c634db6..51cea3e 100644 --- a/gstreamer-sharp/override/ColorBalanceAdapter.cs +++ b/gstreamer-sharp/override/ColorBalanceAdapter.cs @@ -1,5 +1,5 @@ // This file was generated by the Gtk# code generator. -// Changed to handle the BalanceType interface field +// Any changes made will be lost if regenerated. namespace Gst.Interfaces { @@ -8,7 +8,7 @@ namespace Gst.Interfaces { using System.Reflection; #region Autogenerated code - public class ColorBalanceAdapter : GLib.GInterfaceAdapter, Gst.Interfaces.ColorBalance { + public partial class ColorBalanceAdapter : Gst.GLib.GInterfaceAdapter, Gst.Interfaces.ColorBalance { [StructLayout (LayoutKind.Sequential)] struct GstColorBalanceClass { @@ -25,52 +25,52 @@ namespace Gst.Interfaces { static ColorBalanceAdapter () { - GLib.GType.Register (_gtype, typeof(ColorBalanceAdapter)); + Gst.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] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr ListChannelsNativeDelegate (IntPtr inst); static IntPtr ListChannels_cb (IntPtr inst) { try { - ColorBalanceImplementor __obj = GLib.Object.GetObject (inst, false) as ColorBalanceImplementor; + ColorBalanceImplementor __obj = Gst.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; + return new Gst.GLib.List(__result, typeof (Gst.Interfaces.ColorBalanceChannel), false, false) == null ? IntPtr.Zero : new Gst.GLib.List(__result, typeof (Gst.Interfaces.ColorBalanceChannel), false, false).Handle; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] 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); + ColorBalanceImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as ColorBalanceImplementor; + __obj.SetValue (Gst.GLib.Object.GetObject(channel) as Gst.Interfaces.ColorBalanceChannel, value); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false); } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] 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); + ColorBalanceImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as ColorBalanceImplementor; + int __result = __obj.GetValue (Gst.GLib.Object.GetObject(channel) as Gst.Interfaces.ColorBalanceChannel); return __result; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } @@ -100,54 +100,59 @@ namespace Gst.Interfaces { gch.Free (); } + Gst.GLib.Object implementor; + public ColorBalanceAdapter () { - InitHandler = new GLib.GInterfaceInitHandler (Initialize); + InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize); } - ColorBalanceImplementor implementor; - public ColorBalanceAdapter (ColorBalanceImplementor implementor) { if (implementor == null) throw new ArgumentNullException ("implementor"); - this.implementor = implementor; + else if (!(implementor is Gst.GLib.Object)) + throw new ArgumentException ("implementor must be a subclass of Gst.GLib.Object"); + this.implementor = implementor as Gst.GLib.Object; } 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; + implementor = Gst.GLib.Object.GetObject (handle); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_color_balance_get_type(); - private static GLib.GType _gtype = new GLib.GType (gst_color_balance_get_type ()); + private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_color_balance_get_type ()); - public override GLib.GType GType { + public override Gst.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; + return implementor.Handle; + } + } + + public IntPtr OwnedHandle { + get { + return implementor.OwnedHandle; } } public static ColorBalance GetObject (IntPtr handle, bool owned) { - GLib.Object obj = GLib.Object.GetObject (handle, owned); + Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned); return GetObject (obj); } - public static ColorBalance GetObject (GLib.Object obj) + public static ColorBalance GetObject (Gst.GLib.Object obj) { if (obj == null) return null; @@ -161,39 +166,39 @@ namespace Gst.Interfaces { public ColorBalanceImplementor Implementor { get { - return implementor; + return implementor as ColorBalanceImplementor; } } - [GLib.Signal("value-changed")] + [Gst.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)); + Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.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)); + Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "value-changed", typeof (Gst.Interfaces.ValueChangedArgs)); sig.RemoveDelegate (value); } } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] 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("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] 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)); + Gst.Interfaces.ColorBalanceChannel[] ret = (Gst.Interfaces.ColorBalanceChannel[]) Gst.GLib.Marshaller.ListPtrToArray (raw_ret, typeof(Gst.GLib.List), false, false, typeof(Gst.Interfaces.ColorBalanceChannel)); return ret; } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern int gst_color_balance_get_value(IntPtr raw, IntPtr channel); public int GetValue(Gst.Interfaces.ColorBalanceChannel channel) { @@ -202,24 +207,22 @@ namespace Gst.Interfaces { return ret; } - [DllImport("libgstinterfaces-0.10.dll")] - static extern void gst_color_balance_value_changed(IntPtr raw, IntPtr channel, int value); + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] + static extern int gst_color_balance_get_balance_type(IntPtr raw); - public void EmitValueChanged(Gst.Interfaces.ColorBalanceChannel channel, int value) { - gst_color_balance_value_changed(Handle, channel == null ? IntPtr.Zero : channel.Handle, value); + public Gst.Interfaces.ColorBalanceType BalanceType { + get { + int raw_ret = gst_color_balance_get_balance_type(Handle); + Gst.Interfaces.ColorBalanceType ret = (Gst.Interfaces.ColorBalanceType) raw_ret; + return ret; + } } + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gst_color_balance_value_changed(IntPtr raw, IntPtr channel, int 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; - } + public void EmitValueChanged(Gst.Interfaces.ColorBalanceChannel channel, int value) { + gst_color_balance_value_changed(Handle, channel == null ? IntPtr.Zero : channel.Handle, value); } #endregion diff --git a/gstreamer-sharp/override/Mixer.cs b/gstreamer-sharp/override/Mixer.cs index b807043..6975fad 100644 --- a/gstreamer-sharp/override/Mixer.cs +++ b/gstreamer-sharp/override/Mixer.cs @@ -1,25 +1,26 @@ // This file was generated by the Gtk# code generator. -// Changed to include the MixerType property +// Any changes made will be lost if regenerated. namespace Gst.Interfaces { using System; #region Autogenerated code - public interface Mixer : GLib.IWrapper { - Gst.Interfaces.MixerType MixerType { - get; - } + public partial interface Mixer : Gst.GLib.IWrapper { + void VolumeChanged(Gst.Interfaces.MixerTrack track, int[] volumes); Gst.Interfaces.MixerTrack[] ListTracks(); void SetOption(Gst.Interfaces.MixerOptions opts, string value); void SetVolume(Gst.Interfaces.MixerTrack track, int[] volumes); - void MuteToggled(Gst.Interfaces.MixerTrack track, bool mute); + Gst.Interfaces.MixerType MixerType { + get; + } void OptionChanged(Gst.Interfaces.MixerOptions opts, string value); - void OptionsListChanged(Gst.Interfaces.MixerOptions opts); string GetOption(Gst.Interfaces.MixerOptions opts); void SetRecord(Gst.Interfaces.MixerTrack track, bool record); + void ListChanged(Gst.Interfaces.MixerOptions opts); void RecordToggled(Gst.Interfaces.MixerTrack track, bool record); + void MuteToggled(Gst.Interfaces.MixerTrack track, bool mute); int[] GetVolume(Gst.Interfaces.MixerTrack track); Gst.Interfaces.MixerFlags MixerFlags { get; @@ -28,8 +29,8 @@ namespace Gst.Interfaces { void SetMute(Gst.Interfaces.MixerTrack track, bool mute); } - [GLib.GInterface (typeof (MixerAdapter))] - public interface MixerImplementor : GLib.IWrapper { + [Gst.GLib.GInterface (typeof (MixerAdapter))] + public partial interface MixerImplementor : Gst.GLib.IWrapper { Gst.Interfaces.MixerTrack[] ListTracks (); void SetVolume (Gst.Interfaces.MixerTrack track, int[] volumes); diff --git a/gstreamer-sharp/override/MixerAdapter.cs b/gstreamer-sharp/override/MixerAdapter.cs index ed40f19..f92ad55 100644 --- a/gstreamer-sharp/override/MixerAdapter.cs +++ b/gstreamer-sharp/override/MixerAdapter.cs @@ -8,7 +8,7 @@ namespace Gst.Interfaces { using System.Reflection; #region Autogenerated code - public class MixerAdapter : GLib.GInterfaceAdapter, Gst.Interfaces.Mixer { + public partial class MixerAdapter : Gst.GLib.GInterfaceAdapter, Gst.Interfaces.Mixer { [StructLayout (LayoutKind.Sequential)] struct GstMixerClass { @@ -18,12 +18,11 @@ namespace Gst.Interfaces { public GetVolumeNativeDelegate GetVolume; public SetMuteNativeDelegate SetMute; public SetRecordNativeDelegate SetRecord; - IntPtr MuteToggled; - IntPtr RecordToggled; - IntPtr VolumeChanged; + [MarshalAs (UnmanagedType.ByValArray, SizeConst=3)] + private IntPtr[] Padding1; public SetOptionNativeDelegate SetOption; public GetOptionNativeDelegate GetOption; - IntPtr OptionChanged; + private IntPtr _padding2; public GetMixerFlagsNativeDelegate GetMixerFlags; [MarshalAs (UnmanagedType.ByValArray, SizeConst=3)] public IntPtr[] GstReserved; @@ -33,7 +32,7 @@ namespace Gst.Interfaces { static MixerAdapter () { - GLib.GType.Register (_gtype, typeof(MixerAdapter)); + Gst.GLib.GType.Register (_gtype, typeof(MixerAdapter)); iface.ListTracks = new ListTracksNativeDelegate (ListTracks_cb); iface.SetVolume = new SetVolumeNativeDelegate (SetVolume_cb); iface.GetVolume = new GetVolumeNativeDelegate (GetVolume_cb); @@ -44,129 +43,127 @@ namespace Gst.Interfaces { iface.GetMixerFlags = new GetMixerFlagsNativeDelegate (GetMixerFlags_cb); } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr ListTracksNativeDelegate (IntPtr inst); static IntPtr ListTracks_cb (IntPtr inst) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; Gst.Interfaces.MixerTrack[] __result = __obj.ListTracks (); - GLib.List ret = new GLib.List(__result, typeof (Gst.Interfaces.MixerTrack), false, false); - if (ret == null) - return IntPtr.Zero; - return ret.Handle; + return new Gst.GLib.List(__result, typeof (Gst.Interfaces.MixerTrack), false, false) == null ? IntPtr.Zero : new Gst.GLib.List(__result, typeof (Gst.Interfaces.MixerTrack), false, false).Handle; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void SetVolumeNativeDelegate (IntPtr inst, IntPtr track, IntPtr volumes); static void SetVolume_cb (IntPtr inst, IntPtr track, IntPtr volumes) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; - MixerTrack managed_track = GLib.Object.GetObject (track) as MixerTrack; + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; + MixerTrack managed_track = Gst.GLib.Object.GetObject (track) as MixerTrack; int[] managed_volumes = new int[managed_track.NumChannels]; Marshal.Copy (volumes, managed_volumes, 0, managed_track.NumChannels); __obj.SetVolume (managed_track, managed_volumes); + } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] - delegate void GetVolumeNativeDelegate (IntPtr inst, IntPtr track, out IntPtr volumes); + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] + delegate void GetVolumeNativeDelegate (IntPtr inst, IntPtr track, IntPtr volumes); - static void GetVolume_cb (IntPtr inst, IntPtr track, out IntPtr volumes) + static void GetVolume_cb (IntPtr inst, IntPtr track, IntPtr volumes) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; - MixerTrack managed_track = GLib.Object.GetObject (track) as MixerTrack; + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; + MixerTrack managed_track = Gst.GLib.Object.GetObject (track) as MixerTrack; int[] managed_volumes = __obj.GetVolume (managed_track); - volumes = GLib.Marshaller.Malloc ((ulong) (4 * managed_track.NumChannels)); + volumes = Gst.GLib.Marshaller.Malloc ((ulong) (4 * managed_track.NumChannels)); Marshal.Copy (managed_volumes, 0, volumes, managed_track.NumChannels); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void SetMuteNativeDelegate (IntPtr inst, IntPtr track, bool mute); static void SetMute_cb (IntPtr inst, IntPtr track, bool mute) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; - __obj.SetMute (GLib.Object.GetObject(track) as Gst.Interfaces.MixerTrack, mute); + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; + __obj.SetMute (Gst.GLib.Object.GetObject(track) as Gst.Interfaces.MixerTrack, mute); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false); } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void SetRecordNativeDelegate (IntPtr inst, IntPtr track, bool record); static void SetRecord_cb (IntPtr inst, IntPtr track, bool record) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; - __obj.SetRecord (GLib.Object.GetObject(track) as Gst.Interfaces.MixerTrack, record); + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; + __obj.SetRecord (Gst.GLib.Object.GetObject(track) as Gst.Interfaces.MixerTrack, record); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false); } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void SetOptionNativeDelegate (IntPtr inst, IntPtr opts, IntPtr value); static void SetOption_cb (IntPtr inst, IntPtr opts, IntPtr value) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; - __obj.SetOption (GLib.Object.GetObject(opts) as Gst.Interfaces.MixerOptions, GLib.Marshaller.PtrToStringGFree(value)); + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; + __obj.SetOption (Gst.GLib.Object.GetObject(opts) as Gst.Interfaces.MixerOptions, Gst.GLib.Marshaller.PtrToStringGFree(value)); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false); } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr GetOptionNativeDelegate (IntPtr inst, IntPtr opts); static IntPtr GetOption_cb (IntPtr inst, IntPtr opts) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; - string __result = __obj.GetOption (GLib.Object.GetObject(opts) as Gst.Interfaces.MixerOptions); - return GLib.Marshaller.StringToPtrGStrdup(__result); + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; + string __result = __obj.GetOption (Gst.GLib.Object.GetObject(opts) as Gst.Interfaces.MixerOptions); + return Gst.GLib.Marshaller.StringToPtrGStrdup(__result); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int GetMixerFlagsNativeDelegate (IntPtr inst); static int GetMixerFlags_cb (IntPtr inst) { try { - MixerImplementor __obj = GLib.Object.GetObject (inst, false) as MixerImplementor; + MixerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as MixerImplementor; Gst.Interfaces.MixerFlags __result = __obj.MixerFlags; return (int) __result; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } @@ -188,67 +185,73 @@ namespace Gst.Interfaces { native_iface.GetMixerFlags = iface.GetMixerFlags; GCHandle gch = (GCHandle) data; - MixerAdapter adapter = gch.Target as MixerAdapter; - MixerImplementor implementor = adapter.Implementor; + MixerAdapter adapter = gch.Target as MixerAdapter; + MixerImplementor implementor = adapter.Implementor; + if (implementor != null) { - PropertyInfo pi = implementor.GetType().GetProperty ("MixerType", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy); - if (pi != null && pi.PropertyType == typeof (Gst.Interfaces.MixerType)) - native_iface.MixerType = (Gst.Interfaces.MixerType) pi.GetValue (null, null); + PropertyInfo pi = implementor.GetType().GetProperty ("MixerType", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy); + if (pi != null && pi.PropertyType == typeof (Gst.Interfaces.MixerType)) + native_iface.MixerType = (Gst.Interfaces.MixerType) pi.GetValue (null, null); } Marshal.StructureToPtr (native_iface, ifaceptr, false); gch.Free (); } + Gst.GLib.Object implementor; + public MixerAdapter () { - InitHandler = new GLib.GInterfaceInitHandler (Initialize); + InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize); } - MixerImplementor implementor; - public MixerAdapter (MixerImplementor implementor) { if (implementor == null) throw new ArgumentNullException ("implementor"); - this.implementor = implementor; + else if (!(implementor is Gst.GLib.Object)) + throw new ArgumentException ("implementor must be a subclass of Gst.GLib.Object"); + this.implementor = implementor as Gst.GLib.Object; } public MixerAdapter (IntPtr handle) { if (!_gtype.IsInstance (handle)) throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle"); - this.handle = handle; + implementor = Gst.GLib.Object.GetObject (handle); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_mixer_get_type(); - private static GLib.GType _gtype = new GLib.GType (gst_mixer_get_type ()); + private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_mixer_get_type ()); - public override GLib.GType GType { + public override Gst.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; + return implementor.Handle; + } + } + + public IntPtr OwnedHandle { + get { + return implementor.OwnedHandle; } } public static Mixer GetObject (IntPtr handle, bool owned) { - GLib.Object obj = GLib.Object.GetObject (handle, owned); + Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned); return GetObject (obj); } - public static Mixer GetObject (GLib.Object obj) + public static Mixer GetObject (Gst.GLib.Object obj) { if (obj == null) return null; @@ -262,13 +265,13 @@ namespace Gst.Interfaces { public MixerImplementor Implementor { get { - return implementor; + return implementor as MixerImplementor; } } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_volume_changed(IntPtr raw, IntPtr track, IntPtr volumes); - + public void VolumeChanged(Gst.Interfaces.MixerTrack track, int[] volumes) { if (track == null) return; @@ -276,29 +279,29 @@ namespace Gst.Interfaces { if (volumes.Length != track.NumChannels) throw new ArgumentOutOfRangeException (); - IntPtr native_volumes = GLib.Marshaller.Malloc ((ulong) (4 * track.NumChannels)); + IntPtr native_volumes = Gst.GLib.Marshaller.Malloc ((ulong) (4 * track.NumChannels)); Marshal.Copy (volumes, 0, native_volumes, track.NumChannels); gst_mixer_volume_changed(Handle, track.Handle, native_volumes); - GLib.Marshaller.Free (native_volumes); - } + Gst.GLib.Marshaller.Free (native_volumes); + } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_mixer_list_tracks(IntPtr raw); public Gst.Interfaces.MixerTrack[] ListTracks() { IntPtr raw_ret = gst_mixer_list_tracks(Handle); - Gst.Interfaces.MixerTrack[] ret = (Gst.Interfaces.MixerTrack[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), false, false, typeof(Gst.Interfaces.MixerTrack)); + Gst.Interfaces.MixerTrack[] ret = (Gst.Interfaces.MixerTrack[]) Gst.GLib.Marshaller.ListPtrToArray (raw_ret, typeof(Gst.GLib.List), false, false, typeof(Gst.Interfaces.MixerTrack)); return ret; } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_set_option(IntPtr raw, IntPtr opts, IntPtr value); public void SetOption(Gst.Interfaces.MixerOptions opts, string value) { - gst_mixer_set_option(Handle, opts == null ? IntPtr.Zero : opts.Handle, GLib.Marshaller.StringToPtrGStrdup(value)); + gst_mixer_set_option(Handle, opts == null ? IntPtr.Zero : opts.Handle, Gst.GLib.Marshaller.StringToPtrGStrdup(value)); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_set_volume(IntPtr raw, IntPtr track, IntPtr volumes); public void SetVolume(Gst.Interfaces.MixerTrack track, int[] volumes) { @@ -307,75 +310,84 @@ namespace Gst.Interfaces { if (volumes.Length != track.NumChannels) throw new ArgumentOutOfRangeException (); - - IntPtr volumes_native = GLib.Marshaller.Malloc ((ulong) (4 * track.NumChannels)); + IntPtr volumes_native = Gst.GLib.Marshaller.Malloc ((ulong) (4 * track.NumChannels)); Marshal.Copy (volumes, 0, volumes_native, track.NumChannels); - gst_mixer_set_volume(Handle, track.Handle, volumes_native); - GLib.Marshaller.Free (volumes_native); + Gst.GLib.Marshaller.Free (volumes_native); } - [DllImport("libgstinterfaces-0.10.dll")] - static extern void gst_mixer_mute_toggled(IntPtr raw, IntPtr track, bool mute); + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] + static extern int gst_mixer_get_mixer_type(IntPtr raw); - public void MuteToggled(Gst.Interfaces.MixerTrack track, bool mute) { - gst_mixer_mute_toggled(Handle, track == null ? IntPtr.Zero : track.Handle, mute); + public Gst.Interfaces.MixerType MixerType { + get { + int raw_ret = gst_mixer_get_mixer_type(Handle); + Gst.Interfaces.MixerType ret = (Gst.Interfaces.MixerType) raw_ret; + return ret; + } } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_option_changed(IntPtr raw, IntPtr opts, IntPtr value); public void OptionChanged(Gst.Interfaces.MixerOptions opts, string value) { - gst_mixer_option_changed(Handle, opts == null ? IntPtr.Zero : opts.Handle, GLib.Marshaller.StringToPtrGStrdup(value)); + gst_mixer_option_changed(Handle, opts == null ? IntPtr.Zero : opts.Handle, Gst.GLib.Marshaller.StringToPtrGStrdup(value)); } - [DllImport("libgstinterfaces-0.10.dll")] - static extern void gst_mixer_options_list_changed(IntPtr raw, IntPtr opts); - - public void OptionsListChanged(Gst.Interfaces.MixerOptions opts) { - gst_mixer_options_list_changed(Handle, opts == null ? IntPtr.Zero : opts.Handle); - } - - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_mixer_get_option(IntPtr raw, IntPtr opts); public string GetOption(Gst.Interfaces.MixerOptions opts) { IntPtr raw_ret = gst_mixer_get_option(Handle, opts == null ? IntPtr.Zero : opts.Handle); - string ret = GLib.Marshaller.Utf8PtrToString (raw_ret); + string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret); return ret; } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_set_record(IntPtr raw, IntPtr track, bool record); public void SetRecord(Gst.Interfaces.MixerTrack track, bool record) { gst_mixer_set_record(Handle, track == null ? IntPtr.Zero : track.Handle, record); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gst_mixer_options_list_changed(IntPtr raw, IntPtr opts); + + public void ListChanged(Gst.Interfaces.MixerOptions opts) { + gst_mixer_options_list_changed(Handle, opts == null ? IntPtr.Zero : opts.Handle); + } + + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_record_toggled(IntPtr raw, IntPtr track, bool record); public void RecordToggled(Gst.Interfaces.MixerTrack track, bool record) { gst_mixer_record_toggled(Handle, track == null ? IntPtr.Zero : track.Handle, record); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void gst_mixer_mute_toggled(IntPtr raw, IntPtr track, bool mute); + + public void MuteToggled(Gst.Interfaces.MixerTrack track, bool mute) { + gst_mixer_mute_toggled(Handle, track == null ? IntPtr.Zero : track.Handle, mute); + } + + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_get_volume(IntPtr raw, IntPtr track, ref IntPtr volumes); public int[] GetVolume(Gst.Interfaces.MixerTrack track) { if (track == null) return null; - IntPtr native_volumes = GLib.Marshaller.Malloc ((ulong) (4 * track.NumChannels)); + IntPtr native_volumes = Gst.GLib.Marshaller.Malloc ((ulong) (4 * track.NumChannels)); gst_mixer_get_volume(Handle, track.Handle, ref native_volumes); int[] volumes = new int[track.NumChannels]; Marshal.Copy (native_volumes, volumes, 0, track.NumChannels); - GLib.Marshaller.Free (native_volumes); + Gst.GLib.Marshaller.Free (native_volumes); return volumes; } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern int gst_mixer_get_mixer_flags(IntPtr raw); public Gst.Interfaces.MixerFlags MixerFlags { @@ -386,32 +398,20 @@ namespace Gst.Interfaces { } } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_mixer_changed(IntPtr raw); public void MixerChanged() { gst_mixer_mixer_changed(Handle); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_mixer_set_mute(IntPtr raw, IntPtr track, bool mute); public void SetMute(Gst.Interfaces.MixerTrack track, bool mute) { gst_mixer_set_mute(Handle, track == null ? IntPtr.Zero : track.Handle, mute); } - [DllImport("libgobject-2.0-0.dll")] - static extern IntPtr g_type_interface_peek (IntPtr klass, IntPtr iface_gtype); - public Gst.Interfaces.MixerType MixerType { - get { - IntPtr gclass = Marshal.ReadIntPtr (Handle); - IntPtr ifaceptr = g_type_interface_peek (gclass, _gtype.Val); - GstMixerClass native_iface = (GstMixerClass) Marshal.PtrToStructure (ifaceptr, typeof (GstMixerClass)); - - return native_iface.MixerType; - } - } - #endregion } } diff --git a/gstreamer-sharp/override/NavigationAdapter.cs b/gstreamer-sharp/override/NavigationAdapter.cs index 05eb23f..44cb477 100644 --- a/gstreamer-sharp/override/NavigationAdapter.cs +++ b/gstreamer-sharp/override/NavigationAdapter.cs @@ -1,5 +1,5 @@ // This file was generated by the Gtk# code generator. -// Changed to copy the structure in SendEvent (). +// Any changes made will be lost if regenerated. namespace Gst.Interfaces { @@ -7,7 +7,7 @@ namespace Gst.Interfaces { using System.Runtime.InteropServices; #region Autogenerated code - public class NavigationAdapter : GLib.GInterfaceAdapter, Gst.Interfaces.Navigation { + public partial class NavigationAdapter : Gst.GLib.GInterfaceAdapter, Gst.Interfaces.Navigation { [StructLayout (LayoutKind.Sequential)] struct GstNavigationInterface { @@ -20,20 +20,20 @@ namespace Gst.Interfaces { static NavigationAdapter () { - GLib.GType.Register (_gtype, typeof(NavigationAdapter)); + Gst.GLib.GType.Register (_gtype, typeof(NavigationAdapter)); iface.SendEvent = new SendEventNativeDelegate (SendEvent_cb); } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void SendEventNativeDelegate (IntPtr inst, IntPtr structure); static void SendEvent_cb (IntPtr inst, IntPtr structure) { try { - NavigationImplementor __obj = GLib.Object.GetObject (inst, false) as NavigationImplementor; - __obj.SendEvent (structure == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (structure, typeof (Gst.Structure), true)); + NavigationImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as NavigationImplementor; + __obj.SendEvent (structure == IntPtr.Zero ? null : (Gst.Structure) Gst.GLib.Opaque.GetOpaque (structure, typeof (Gst.Structure), true)); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false); } } @@ -49,54 +49,59 @@ namespace Gst.Interfaces { gch.Free (); } + Gst.GLib.Object implementor; + public NavigationAdapter () { - InitHandler = new GLib.GInterfaceInitHandler (Initialize); + InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize); } - NavigationImplementor implementor; - public NavigationAdapter (NavigationImplementor implementor) { if (implementor == null) throw new ArgumentNullException ("implementor"); - this.implementor = implementor; + else if (!(implementor is Gst.GLib.Object)) + throw new ArgumentException ("implementor must be a subclass of Gst.GLib.Object"); + this.implementor = implementor as Gst.GLib.Object; } public NavigationAdapter (IntPtr handle) { if (!_gtype.IsInstance (handle)) throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle"); - this.handle = handle; + implementor = Gst.GLib.Object.GetObject (handle); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_navigation_get_type(); - private static GLib.GType _gtype = new GLib.GType (gst_navigation_get_type ()); + private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_navigation_get_type ()); - public override GLib.GType GType { + public override Gst.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; + return implementor.Handle; + } + } + + public IntPtr OwnedHandle { + get { + return implementor.OwnedHandle; } } public static Navigation GetObject (IntPtr handle, bool owned) { - GLib.Object obj = GLib.Object.GetObject (handle, owned); + Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned); return GetObject (obj); } - public static Navigation GetObject (GLib.Object obj) + public static Navigation GetObject (Gst.GLib.Object obj) { if (obj == null) return null; @@ -110,41 +115,41 @@ namespace Gst.Interfaces { public NavigationImplementor Implementor { get { - return implementor; + return implementor as NavigationImplementor; } } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_navigation_send_event(IntPtr raw, IntPtr structure); - [DllImport("libgstreamer-0.10.dll")] + [DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_structure_copy (IntPtr raw); public void SendEvent(Gst.Structure structure) { gst_navigation_send_event(Handle, structure == null ? IntPtr.Zero : gst_structure_copy (structure.Handle)); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_navigation_send_mouse_event(IntPtr raw, IntPtr evnt, int button, double x, double y); public void SendMouseEvent(string evnt, int button, double x, double y) { - IntPtr native_evnt = GLib.Marshaller.StringToPtrGStrdup (evnt); + IntPtr native_evnt = Gst.GLib.Marshaller.StringToPtrGStrdup (evnt); gst_navigation_send_mouse_event(Handle, native_evnt, button, x, y); - GLib.Marshaller.Free (native_evnt); + Gst.GLib.Marshaller.Free (native_evnt); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_navigation_send_key_event(IntPtr raw, IntPtr evnt, IntPtr key); public void SendKeyEvent(string evnt, string key) { - IntPtr native_evnt = GLib.Marshaller.StringToPtrGStrdup (evnt); - IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key); + IntPtr native_evnt = Gst.GLib.Marshaller.StringToPtrGStrdup (evnt); + IntPtr native_key = Gst.GLib.Marshaller.StringToPtrGStrdup (key); gst_navigation_send_key_event(Handle, native_evnt, native_key); - GLib.Marshaller.Free (native_evnt); - GLib.Marshaller.Free (native_key); + Gst.GLib.Marshaller.Free (native_evnt); + Gst.GLib.Marshaller.Free (native_key); } - [DllImport("libgstinterfaces-0.10.dll")] + [DllImport("libgstinterfaces-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern void gst_navigation_send_command(IntPtr raw, int command); public void SendCommand(Gst.Interfaces.NavigationCommand command) { diff --git a/gstreamer-sharp/override/ProbeNeededHandler.cs b/gstreamer-sharp/override/ProbeNeededHandler.cs index a40b9bd..e0c7df9 100644 --- a/gstreamer-sharp/override/ProbeNeededHandler.cs +++ b/gstreamer-sharp/override/ProbeNeededHandler.cs @@ -7,7 +7,7 @@ namespace Gst.Interfaces { public delegate void ProbeNeededHandler(object o, ProbeNeededArgs args); - public class ProbeNeededArgs : GLib.SignalArgs { + public class ProbeNeededArgs : Gst.GLib.SignalArgs { public string Property { get { IntPtr pspec = (IntPtr) Args[0]; diff --git a/gstreamer-sharp/override/PropertyProbe.cs b/gstreamer-sharp/override/PropertyProbe.cs index 14e655d..f74da3d 100644 --- a/gstreamer-sharp/override/PropertyProbe.cs +++ b/gstreamer-sharp/override/PropertyProbe.cs @@ -5,7 +5,7 @@ namespace Gst.Interfaces { using System; - public interface PropertyProbe : GLib.IWrapper { + public partial interface PropertyProbe : Gst.GLib.IWrapper { event Gst.Interfaces.ProbeNeededHandler ProbeNeeded; string[] Properties { get; } @@ -16,8 +16,8 @@ namespace Gst.Interfaces { object[] ProbeAndGetValues (string property); } - [GLib.GInterface (typeof (PropertyProbeAdapter))] - public interface PropertyProbeImplementor : GLib.IWrapper { + [Gst.GLib.GInterface (typeof (PropertyProbeAdapter))] + public partial interface PropertyProbeImplementor : Gst.GLib.IWrapper { string[] Properties { get; } bool NeedsProbe (string property); void ProbeProperty (string property); diff --git a/gstreamer-sharp/override/PropertyProbeAdapter.cs b/gstreamer-sharp/override/PropertyProbeAdapter.cs index e3139bf..6de8699 100644 --- a/gstreamer-sharp/override/PropertyProbeAdapter.cs +++ b/gstreamer-sharp/override/PropertyProbeAdapter.cs @@ -7,7 +7,7 @@ namespace Gst.Interfaces { using System.Runtime.InteropServices; using System.Collections; - public class PropertyProbeAdapter : GLib.GInterfaceAdapter, Gst.Interfaces.PropertyProbe { + public partial class PropertyProbeAdapter : Gst.GLib.GInterfaceAdapter, Gst.Interfaces.PropertyProbe { [StructLayout (LayoutKind.Sequential)] struct GstPropertyProbeInterface { @@ -24,14 +24,14 @@ namespace Gst.Interfaces { static PropertyProbeAdapter () { - GLib.GType.Register (_gtype, typeof(PropertyProbeAdapter)); + Gst.GLib.GType.Register (_gtype, typeof(PropertyProbeAdapter)); iface.GetProperties = new GetPropertiesNativeDelegate (GetProperties_cb); iface.NeedsProbe = new NeedsProbeNativeDelegate (NeedsProbe_cb); iface.ProbeProperty = new ProbePropertyNativeDelegate (ProbeProperty_cb); iface.GetValues = new GetValuesNativeDelegate (GetValues_cb); } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr GetPropertiesNativeDelegate (IntPtr inst); [DllImport("libglib-2.0-0.dll")] @@ -40,15 +40,15 @@ namespace Gst.Interfaces { static IntPtr GetProperties_cb (IntPtr inst) { try { - PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; + PropertyProbeImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; string[] properties = __obj.Properties; - GLib.List properties_list = new GLib.List (typeof (IntPtr)); + Gst.GLib.List properties_list = new Gst.GLib.List (typeof (IntPtr)); IntPtr gclass = Marshal.ReadIntPtr (inst); foreach (string prop in properties) { - IntPtr name = GLib.Marshaller.StringToPtrGStrdup (prop); + IntPtr name = Gst.GLib.Marshaller.StringToPtrGStrdup (prop); IntPtr pspec = g_object_class_find_property (gclass, name); - GLib.Marshaller.Free (name); + Gst.GLib.Marshaller.Free (name); if (pspec != IntPtr.Zero) properties_list.Prepend (pspec); } @@ -56,59 +56,59 @@ namespace Gst.Interfaces { /* FIXME: We leak the list! */ return properties_list.Handle; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate bool NeedsProbeNativeDelegate (IntPtr inst, uint prop_id, IntPtr pspec); static bool NeedsProbe_cb (IntPtr inst, uint prop_id, IntPtr pspec) { try { - PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; + PropertyProbeImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; Gst.PropertyInfo pi = new Gst.PropertyInfo (pspec); bool __result = __obj.NeedsProbe (pi.Name); return __result; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate void ProbePropertyNativeDelegate (IntPtr inst, uint prop_id, IntPtr pspec); static void ProbeProperty_cb (IntPtr inst, uint prop_id, IntPtr pspec) { try { - PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; + PropertyProbeImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; Gst.PropertyInfo pi = new Gst.PropertyInfo (pspec); __obj.ProbeProperty (pi.Name); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false); } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr GetValuesNativeDelegate (IntPtr inst, uint prop_id, IntPtr pspec); static IntPtr GetValues_cb (IntPtr inst, uint prop_id, IntPtr pspec) { try { - PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; + PropertyProbeImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as PropertyProbeImplementor; Gst.PropertyInfo pi = new Gst.PropertyInfo (pspec); object[] values = __obj.GetValues (pi.Name); - GLib.ValueArray va = new GLib.ValueArray ((uint) values.Length); + Gst.GLib.ValueArray va = new Gst.GLib.ValueArray ((uint) values.Length); foreach (object v in values) - va.Append (new GLib.Value (v)); + va.Append (new Gst.GLib.Value (v)); return va.Handle; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, false); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, false); // NOTREACHED: above call does not return. throw e; } @@ -129,54 +129,59 @@ namespace Gst.Interfaces { gch.Free (); } + Gst.GLib.Object implementor; + public PropertyProbeAdapter () { - InitHandler = new GLib.GInterfaceInitHandler (Initialize); + InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize); } - PropertyProbeImplementor implementor; - public PropertyProbeAdapter (PropertyProbeImplementor implementor) { if (implementor == null) throw new ArgumentNullException ("implementor"); - this.implementor = implementor; + else if (!(implementor is Gst.GLib.Object)) + throw new ArgumentException ("implementor must be a subclass of Gst.GLib.Object"); + this.implementor = implementor as Gst.GLib.Object; } public PropertyProbeAdapter (IntPtr handle) { if (!_gtype.IsInstance (handle)) throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle"); - this.handle = handle; + implementor = Gst.GLib.Object.GetObject (handle); } [DllImport("libgstinterfaces-0.10.dll")] static extern IntPtr gst_property_probe_get_type(); - private static GLib.GType _gtype = new GLib.GType (gst_property_probe_get_type ()); + private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_property_probe_get_type ()); - public override GLib.GType GType { + public override Gst.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; + return implementor.Handle; + } + } + + public IntPtr OwnedHandle { + get { + return implementor.OwnedHandle; } } public static PropertyProbe GetObject (IntPtr handle, bool owned) { - GLib.Object obj = GLib.Object.GetObject (handle, owned); + Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned); return GetObject (obj); } - public static PropertyProbe GetObject (GLib.Object obj) + public static PropertyProbe GetObject (Gst.GLib.Object obj) { if (obj == null) return null; @@ -190,19 +195,19 @@ namespace Gst.Interfaces { public PropertyProbeImplementor Implementor { get { - return implementor; + return implementor as PropertyProbeImplementor; } } - [GLib.Signal("probe-needed")] + [Gst.GLib.Signal("probe-needed")] public event Gst.Interfaces.ProbeNeededHandler ProbeNeeded { add { - GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "probe-needed", typeof (Gst.Interfaces.ProbeNeededArgs)); + Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "probe-needed", typeof (Gst.Interfaces.ProbeNeededArgs)); sig.AddDelegate (value); } remove { - GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "probe-needed", typeof (Gst.Interfaces.ProbeNeededArgs)); + Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "probe-needed", typeof (Gst.Interfaces.ProbeNeededArgs)); sig.RemoveDelegate (value); } } @@ -211,10 +216,10 @@ namespace Gst.Interfaces { static extern bool gst_property_probe_needs_probe_name(IntPtr raw, IntPtr name); public bool NeedsProbe(string name) { - IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); + IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name); bool raw_ret = gst_property_probe_needs_probe_name(Handle, native_name); bool ret = raw_ret; - GLib.Marshaller.Free (native_name); + Gst.GLib.Marshaller.Free (native_name); return ret; } @@ -222,9 +227,9 @@ namespace Gst.Interfaces { static extern void gst_property_probe_probe_property_name(IntPtr raw, IntPtr name); public void Probe(string name) { - IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); + IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name); gst_property_probe_probe_property_name(Handle, native_name); - GLib.Marshaller.Free (native_name); + Gst.GLib.Marshaller.Free (native_name); } [DllImport("libgstinterfaces-0.10.dll")] @@ -236,7 +241,7 @@ namespace Gst.Interfaces { if (raw_ret == IntPtr.Zero) return new string[] {}; - GLib.List raw_ret_list = new GLib.List(raw_ret, typeof (IntPtr)); + Gst.GLib.List raw_ret_list = new Gst.GLib.List(raw_ret, typeof (IntPtr)); ArrayList ret = new ArrayList (); foreach (IntPtr pspec in raw_ret_list) { @@ -252,15 +257,15 @@ namespace Gst.Interfaces { static extern IntPtr gst_property_probe_get_values_name (IntPtr raw, IntPtr name); public object[] GetValues (string name) { - IntPtr raw_name = GLib.Marshaller.StringToPtrGStrdup (name); + IntPtr raw_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name); IntPtr raw_ret = gst_property_probe_get_values_name (Handle, raw_name); - GLib.Marshaller.Free (raw_name); + Gst.GLib.Marshaller.Free (raw_name); if (raw_ret == IntPtr.Zero) return new object[] {}; - GLib.ValueArray va = new GLib.ValueArray (raw_ret); + Gst.GLib.ValueArray va = new Gst.GLib.ValueArray (raw_ret); ArrayList ret = new ArrayList (); - foreach (GLib.Value v in va) + foreach (Gst.GLib.Value v in va) ret.Add ((object) v.Val); va.Dispose (); @@ -272,15 +277,15 @@ namespace Gst.Interfaces { static extern IntPtr gst_property_probe_probe_and_get_values_name (IntPtr raw, IntPtr name); public object[] ProbeAndGetValues (string name) { - IntPtr raw_name = GLib.Marshaller.StringToPtrGStrdup (name); + IntPtr raw_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name); IntPtr raw_ret = gst_property_probe_probe_and_get_values_name (Handle, raw_name); - GLib.Marshaller.Free (raw_name); + Gst.GLib.Marshaller.Free (raw_name); if (raw_ret == IntPtr.Zero) return new object[] {}; - GLib.ValueArray va = new GLib.ValueArray (raw_ret); + Gst.GLib.ValueArray va = new Gst.GLib.ValueArray (raw_ret); ArrayList ret = new ArrayList (); - foreach (GLib.Value v in va) + foreach (Gst.GLib.Value v in va) ret.Add ((object) v.Val); va.Dispose (); diff --git a/gstreamer-sharp/override/URIHandlerAdapter.cs b/gstreamer-sharp/override/URIHandlerAdapter.cs index 30265b6..9226a89 100644 --- a/gstreamer-sharp/override/URIHandlerAdapter.cs +++ b/gstreamer-sharp/override/URIHandlerAdapter.cs @@ -1,15 +1,15 @@ // This file was generated by the Gtk# code generator. -// Modified to correctly handle the Get{Type,Protocols}Full vmethods +// Any changes made will be lost if regenerated. namespace Gst { using System; using System.Runtime.InteropServices; - using System.Reflection; using System.Collections; + using System.Reflection; #region Autogenerated code - public class URIHandlerAdapter : GLib.GInterfaceAdapter, Gst.URIHandler { + public partial class URIHandlerAdapter : Gst.GLib.GInterfaceAdapter, Gst.URIHandler { [StructLayout (LayoutKind.Sequential)] struct GstURIHandlerInterface { @@ -28,20 +28,20 @@ namespace Gst { static URIHandlerAdapter () { - GLib.GType.Register (_gtype, typeof(URIHandlerAdapter)); + Gst.GLib.GType.Register (_gtype, typeof(URIHandlerAdapter)); iface.GetTypeFull = new GetTypeFullNativeDelegate (GetTypeFull_cb); iface.GetProtocolsFull = new GetProtocolsFullNativeDelegate (GetProtocolsFull_cb); iface.GetUri = new GetUriNativeDelegate (GetUri_cb); iface.SetUri = new SetUriNativeDelegate (SetUri_cb); } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate int GetTypeFullNativeDelegate (IntPtr gtype); static int GetTypeFull_cb (IntPtr gtype) { try { - GLib.GType gt = new GLib.GType (gtype); + Gst.GLib.GType gt = new Gst.GLib.GType (gtype); System.Type t = (System.Type) gt; System.Reflection.PropertyInfo pi = t.GetProperty ("Type", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy); @@ -51,13 +51,13 @@ namespace Gst { return (int) __result; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr GetProtocolsFullNativeDelegate (IntPtr gtype); static Hashtable protocols_cache = new Hashtable (); @@ -65,7 +65,7 @@ namespace Gst { static IntPtr GetProtocolsFull_cb (IntPtr gtype) { try { - GLib.GType gt = new GLib.GType (gtype); + Gst.GLib.GType gt = new Gst.GLib.GType (gtype); System.Type t = (System.Type) gt; if (protocols_cache.Contains (gtype)) { @@ -83,39 +83,39 @@ namespace Gst { return ret; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate IntPtr GetUriNativeDelegate (IntPtr inst); static IntPtr GetUri_cb (IntPtr inst) { try { - URIHandlerImplementor __obj = GLib.Object.GetObject (inst, false) as URIHandlerImplementor; + URIHandlerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as URIHandlerImplementor; string __result = __obj.Uri; - return GLib.Marshaller.StringToPtrGStrdup (__result); + return Gst.GLib.Marshaller.StringToPtrGStrdup (__result); } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } } - [GLib.CDeclCallback] + [UnmanagedFunctionPointer (CallingConvention.Cdecl)] delegate bool SetUriNativeDelegate (IntPtr inst, IntPtr uri); static bool SetUri_cb (IntPtr inst, IntPtr uri) { try { - URIHandlerImplementor __obj = GLib.Object.GetObject (inst, false) as URIHandlerImplementor; - bool __result = __obj.SetUri (GLib.Marshaller.Utf8PtrToString (uri)); + URIHandlerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as URIHandlerImplementor; + bool __result = __obj.SetUri (Gst.GLib.Marshaller.Utf8PtrToString (uri)); return __result; } catch (Exception e) { - GLib.ExceptionManager.RaiseUnhandledException (e, true); + Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true); // NOTREACHED: above call does not return. throw e; } @@ -136,54 +136,59 @@ namespace Gst { gch.Free (); } + Gst.GLib.Object implementor; + public URIHandlerAdapter () { - InitHandler = new GLib.GInterfaceInitHandler (Initialize); + InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize); } - URIHandlerImplementor implementor; - public URIHandlerAdapter (URIHandlerImplementor implementor) { if (implementor == null) throw new ArgumentNullException ("implementor"); - this.implementor = implementor; + else if (!(implementor is Gst.GLib.Object)) + throw new ArgumentException ("implementor must be a subclass of Gst.GLib.Object"); + this.implementor = implementor as Gst.GLib.Object; } public URIHandlerAdapter (IntPtr handle) { if (!_gtype.IsInstance (handle)) throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle"); - this.handle = handle; + implementor = Gst.GLib.Object.GetObject (handle); } - [DllImport("libgstreamer-0.10.dll")] + [DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_uri_handler_get_type(); - private static GLib.GType _gtype = new GLib.GType (gst_uri_handler_get_type ()); + private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_uri_handler_get_type ()); - public override GLib.GType GType { + public override Gst.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; + return implementor.Handle; + } + } + + public IntPtr OwnedHandle { + get { + return implementor.OwnedHandle; } } public static URIHandler GetObject (IntPtr handle, bool owned) { - GLib.Object obj = GLib.Object.GetObject (handle, owned); + Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned); return GetObject (obj); } - public static URIHandler GetObject (GLib.Object obj) + public static URIHandler GetObject (Gst.GLib.Object obj) { if (obj == null) return null; @@ -197,62 +202,62 @@ namespace Gst { public URIHandlerImplementor Implementor { get { - return implementor; + return implementor as URIHandlerImplementor; } } - [GLib.Signal("new-uri")] + [Gst.GLib.Signal("new-uri")] public event Gst.NewUriHandler NewUri { add { - GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs)); + Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs)); sig.AddDelegate (value); } remove { - GLib.Signal sig = GLib.Signal.Lookup (GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs)); + Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs)); sig.RemoveDelegate (value); } } - [DllImport("libgstreamer-0.10.dll")] - static extern uint gst_uri_handler_get_uri_type(IntPtr raw); + [DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)] + static extern int gst_uri_handler_get_uri_type(IntPtr raw); public Gst.URIType UriType { get { - uint raw_ret = gst_uri_handler_get_uri_type(Handle); + int raw_ret = gst_uri_handler_get_uri_type(Handle); Gst.URIType ret = (Gst.URIType) raw_ret; return ret; } } - [DllImport("libgstreamer-0.10.dll")] + [DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern bool gst_uri_handler_set_uri(IntPtr raw, IntPtr uri); public bool SetUri(string uri) { - IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri); + IntPtr native_uri = Gst.GLib.Marshaller.StringToPtrGStrdup (uri); bool raw_ret = gst_uri_handler_set_uri(Handle, native_uri); bool ret = raw_ret; - GLib.Marshaller.Free (native_uri); + Gst.GLib.Marshaller.Free (native_uri); return ret; } - [DllImport("libgstreamer-0.10.dll")] + [DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_uri_handler_get_protocols(IntPtr raw); public string[] Protocols { get { IntPtr raw_ret = gst_uri_handler_get_protocols(Handle); - string[] ret = GLib.Marshaller.NullTermPtrToStringArray(raw_ret, false); + string[] ret = Gst.Marshaller.NullTermPtrToStringArray (raw_ret, false); return ret; } } - [DllImport("libgstreamer-0.10.dll")] + [DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gst_uri_handler_get_uri(IntPtr raw); public string Uri { get { IntPtr raw_ret = gst_uri_handler_get_uri(Handle); - string ret = GLib.Marshaller.Utf8PtrToString (raw_ret); + string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret); return ret; } } -- 2.7.4