Update glib-sharp to SVN trunk

Also fix some previous errors with managed types.
This commit is contained in:
Sebastian Dröge 2009-09-16 08:38:59 +02:00
parent 1689d6a031
commit f0f8e19694
38 changed files with 1806 additions and 808 deletions

View File

@ -1,4 +1,4 @@
// GLib.Argv.cs : Argv marshaling class // Gst.GLib.Argv.cs : Argv marshaling class
// //
// Author: Mike Kestner <mkestner@novell.com> // Author: Mike Kestner <mkestner@novell.com>
// //

View File

@ -56,8 +56,8 @@ namespace Gst.GLib {
// currently only GObjects store // currently only GObjects store
// callbacks over the long-term // callbacks over the long-term
if (o is GLib.Object) { if (o is Gst.GLib.Object) {
AddDestroyNotify ((GLib.Object) o); AddDestroyNotify ((Gst.GLib.Object) o);
} }
} else { } else {
// If o is null, we cannot ask for a destroy // If o is null, we cannot ask for a destroy
@ -75,7 +75,7 @@ namespace Gst.GLib {
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void g_object_set_data_full (IntPtr obj, IntPtr name, IntPtr data, DestroyNotify destroy); private static extern void g_object_set_data_full (IntPtr obj, IntPtr name, IntPtr data, DestroyNotify destroy);
private void AddDestroyNotify (GLib.Object o) { private void AddDestroyNotify (Gst.GLib.Object o) {
// This is a bit of an ugly hack. There is no // This is a bit of an ugly hack. There is no
// way of getting a destroy notification // way of getting a destroy notification
// explicitly, so we set some data and ask // explicitly, so we set some data and ask
@ -92,7 +92,7 @@ namespace Gst.GLib {
} }
} }
// This callback is invoked by GLib to indicate that the // This callback is invoked by Gst.GLib to indicate that the
// object that owned the native delegate wrapper no longer // object that owned the native delegate wrapper no longer
// exists and the instance of the delegate itself is removed from the hash table. // exists and the instance of the delegate itself is removed from the hash table.
private void OnDestroy (IntPtr data) { private void OnDestroy (IntPtr data) {

View File

@ -1,4 +1,4 @@
// GLib.DestroyNotify.cs - internal DestroyNotify helper // Gst.GLib.DestroyNotify.cs - internal DestroyNotify helper
// //
// Author: Mike Kestner <mkestner@novell.com> // Author: Mike Kestner <mkestner@novell.com>
// //

View File

@ -24,7 +24,7 @@ namespace Gst.GLib {
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
[Obsolete ("Replaced by direct enum type casts to/from GLib.Value")] [Obsolete ("Replaced by direct enum type casts to/from Gst.GLib.Value")]
public class EnumWrapper { public class EnumWrapper {
int val; int val;
public bool flags; public bool flags;

View File

@ -1,4 +1,4 @@
// GLib.Application.cs - static Application class // Gst.GLib.Application.cs - static Application class
// //
// Authors: Mike Kestner <mkestner@novell.com> // Authors: Mike Kestner <mkestner@novell.com>
// //
@ -53,7 +53,7 @@ namespace Gst.GLib {
{ {
if (UnhandledException == null) { if (UnhandledException == null) {
Console.Error.WriteLine ("Exception in Gtk# callback delegate"); Console.Error.WriteLine ("Exception in Gtk# callback delegate");
Console.Error.WriteLine (" Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception."); Console.Error.WriteLine (" Note: Applications can use Gst.GLib.ExceptionManager.UnhandledException to handle the exception.");
Console.Error.WriteLine (e); Console.Error.WriteLine (e);
Console.Error.WriteLine (new System.Diagnostics.StackTrace (true)); Console.Error.WriteLine (new System.Diagnostics.StackTrace (true));
Environment.Exit (1); Environment.Exit (1);

View File

@ -1,4 +1,4 @@
// GLib.FileUtils.cs - GFileUtils class implementation // Gst.GLib.FileUtils.cs - GFileUtils class implementation
// //
// Author: Martin Baulig <martin@gnome.org> // Author: Martin Baulig <martin@gnome.org>
// //

View File

@ -1,4 +1,4 @@
// GLib.GString.cs : Marshaler for GStrings // Gst.GLib.GString.cs : Marshaler for GStrings
// //
// Author: Mike Kestner <mkestner@ximian.com> // Author: Mike Kestner <mkestner@ximian.com>
// //
@ -23,7 +23,7 @@ namespace Gst.GLib {
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public class GString : GLib.IWrapper { public class GString : Gst.GLib.IWrapper {
IntPtr handle; IntPtr handle;

View File

@ -1,4 +1,4 @@
// GLib.Type.cs - GLib GType class implementation // Gst.GLib.Type.cs - Gst.GLib GType class implementation
// //
// Author: Mike Kestner <mkestner@speakeasy.net> // Author: Mike Kestner <mkestner@speakeasy.net>
// //
@ -29,7 +29,7 @@ namespace Gst.GLib {
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
public delegate System.Type TypeResolutionHandler (GLib.GType gtype, string gtype_name); public delegate System.Type TypeResolutionHandler (Gst.GLib.GType gtype, string gtype_name);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct GType { public struct GType {
@ -103,8 +103,8 @@ namespace Gst.GLib {
static GType () static GType ()
{ {
if (!GLib.Thread.Supported) if (!Gst.GLib.Thread.Supported)
GLib.Thread.Init (); Gst.GLib.Thread.Init ();
g_type_init (); g_type_init ();
@ -119,7 +119,7 @@ namespace Gst.GLib {
Register (GType.Double, typeof (double)); Register (GType.Double, typeof (double));
Register (GType.String, typeof (string)); Register (GType.String, typeof (string));
Register (GType.Pointer, typeof (IntPtr)); Register (GType.Pointer, typeof (IntPtr));
Register (GType.Object, typeof (GLib.Object)); Register (GType.Object, typeof (Gst.GLib.Object));
Register (GType.Pointer, typeof (IntPtr)); Register (GType.Pointer, typeof (IntPtr));
// One-way mapping // One-way mapping
@ -135,8 +135,8 @@ namespace Gst.GLib {
return (GType)gtypes[type]; return (GType)gtypes[type];
} }
if (type.IsSubclassOf (typeof (GLib.Object))) { if (type.IsSubclassOf (typeof (Gst.GLib.Object))) {
gtype = GLib.Object.LookupGType (type); gtype = Gst.GLib.Object.LookupGType (type);
Register (gtype, type); Register (gtype, type);
return gtype; return gtype;
} }
@ -148,7 +148,7 @@ namespace Gst.GLib {
GTypeAttribute gattr = (GTypeAttribute)Attribute.GetCustomAttribute (type, typeof (GTypeAttribute), false); GTypeAttribute gattr = (GTypeAttribute)Attribute.GetCustomAttribute (type, typeof (GTypeAttribute), false);
pi = gattr.WrapperType.GetProperty ("GType", BindingFlags.Public | BindingFlags.Static); pi = gattr.WrapperType.GetProperty ("GType", BindingFlags.Public | BindingFlags.Static);
gtype = (GType) pi.GetValue (null, null); gtype = (GType) pi.GetValue (null, null);
} else if (type.IsSubclassOf (typeof (GLib.Opaque))) } else if (type.IsSubclassOf (typeof (Gst.GLib.Opaque)))
gtype = GType.Pointer; gtype = GType.Pointer;
else else
gtype = ManagedValue.GType; gtype = ManagedValue.GType;
@ -162,7 +162,7 @@ namespace Gst.GLib {
for (int i = 1; i < cname.Length; i++) { for (int i = 1; i < cname.Length; i++) {
if (System.Char.IsUpper (cname[i])) { if (System.Char.IsUpper (cname[i])) {
if (i == 1 && cname [0] == 'G') if (i == 1 && cname [0] == 'G')
return "GLib." + cname.Substring (1); return "Gst.GLib." + cname.Substring (1);
else else
return cname.Substring (0, i) + "." + cname.Substring (i); return cname.Substring (0, i) + "." + cname.Substring (i);
} }
@ -193,7 +193,7 @@ namespace Gst.GLib {
string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid)); string native_name = Marshaller.Utf8PtrToString (g_type_name (typeid));
if (ResolveType != null) { if (ResolveType != null) {
GLib.GType gt = new GLib.GType (typeid); Gst.GLib.GType gt = new Gst.GLib.GType (typeid);
Delegate[] invocation_list = ResolveType.GetInvocationList (); Delegate[] invocation_list = ResolveType.GetInvocationList ();
foreach (Delegate d in invocation_list) { foreach (Delegate d in invocation_list) {
@ -302,7 +302,7 @@ namespace Gst.GLib {
public GType GetThresholdType () public GType GetThresholdType ()
{ {
GType curr_type = this; GType curr_type = this;
while (curr_type.ToString ().StartsWith ("__gtksharp_")) while (curr_type.ToString ().StartsWith ("__gst_gtksharp_"))
curr_type = curr_type.GetBaseType (); curr_type = curr_type.GetBaseType ();
return curr_type; return curr_type;
} }
@ -326,7 +326,7 @@ namespace Gst.GLib {
string qn = t.FullName; string qn = t.FullName;
// Just a random guess // Just a random guess
StringBuilder sb = new StringBuilder (20 + qn.Length); StringBuilder sb = new StringBuilder (20 + qn.Length);
sb.Append ("__gtksharp_"); sb.Append ("__gst_gtksharp_");
sb.Append (type_uid++); sb.Append (type_uid++);
sb.Append ("_"); sb.Append ("_");
foreach (char c in qn) { foreach (char c in qn) {
@ -349,14 +349,14 @@ namespace Gst.GLib {
{ {
GType parent_gtype = LookupGObjectType (t.BaseType); GType parent_gtype = LookupGObjectType (t.BaseType);
string name = BuildEscapedName (t); string name = BuildEscapedName (t);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
GTypeQuery query; GTypeQuery query;
g_type_query (parent_gtype.Val, out query); g_type_query (parent_gtype.Val, out query);
GTypeInfo info = new GTypeInfo (); GTypeInfo info = new GTypeInfo ();
info.class_size = (ushort) query.class_size; info.class_size = (ushort) query.class_size;
info.instance_size = (ushort) query.instance_size; info.instance_size = (ushort) query.instance_size;
GType gtype = new GType (g_type_register_static (parent_gtype.Val, native_name, ref info, 0)); GType gtype = new GType (g_type_register_static (parent_gtype.Val, native_name, ref info, 0));
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
Register (gtype, t); Register (gtype, t);
return gtype; return gtype;
} }
@ -372,7 +372,7 @@ namespace Gst.GLib {
if (pi != null) if (pi != null)
return (GType) pi.GetValue (null, null); return (GType) pi.GetValue (null, null);
return GLib.Object.RegisterGType (t); return Gst.GLib.Object.RegisterGType (t);
} }
internal static IntPtr ValFromInstancePtr (IntPtr handle) internal static IntPtr ValFromInstancePtr (IntPtr handle)

View File

@ -1,4 +1,4 @@
// GLib.Global.cs - Global glib properties and methods. // Gst.GLib.Global.cs - Global glib properties and methods.
// //
// Author: Andres G. Aragoneses <aaragoneses@novell.com> // Author: Andres G. Aragoneses <aaragoneses@novell.com>
// //
@ -33,12 +33,12 @@ namespace Gst.GLib {
public static string ProgramName { public static string ProgramName {
get { get {
return GLib.Marshaller.PtrToStringGFree(g_get_prgname()); return Gst.GLib.Marshaller.PtrToStringGFree(g_get_prgname());
} }
set { set {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (value); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (value);
g_set_prgname (native_name); g_set_prgname (native_name);
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
} }
} }
@ -50,12 +50,12 @@ namespace Gst.GLib {
public static string ApplicationName { public static string ApplicationName {
get { get {
return GLib.Marshaller.PtrToStringGFree(g_get_application_name()); return Gst.GLib.Marshaller.PtrToStringGFree(g_get_application_name());
} }
set { set {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (value); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (value);
g_set_application_name (native_name); g_set_application_name (native_name);
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
} }
} }

View File

@ -23,7 +23,7 @@ namespace Gst.GLibSharp {
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using GLib; using Gst.GLib;
[UnmanagedFunctionPointer (CallingConvention.Cdecl)] [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate bool IOFuncNative(IntPtr source, int condition, IntPtr data); internal delegate bool IOFuncNative(IntPtr source, int condition, IntPtr data);
@ -55,7 +55,7 @@ namespace Gst.GLib {
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using GLibSharp; using Gst.GLibSharp;
public class IOChannel : IDisposable, IWrapper { public class IOChannel : IDisposable, IWrapper {

View File

@ -1,4 +1,4 @@
// GLib.Idle.cs - Idle class implementation // Gst.GLib.Idle.cs - Idle class implementation
// //
// Author(s): // Author(s):
// Mike Kestner <mkestner@speakeasy.net> // Mike Kestner <mkestner@speakeasy.net>

View File

@ -31,7 +31,7 @@ namespace Gst.GLib {
protected InitiallyUnowned (IntPtr raw) : base (raw) {} protected InitiallyUnowned (IntPtr raw) : base (raw) {}
public new static GLib.GType GType { public new static Gst.GLib.GType GType {
get { get {
return GType.Object; return GType.Object;
} }

View File

@ -26,7 +26,7 @@ namespace Gst.GLib {
using System.Collections; using System.Collections;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
public abstract class ListBase : IDisposable, ICollection, GLib.IWrapper, ICloneable { public abstract class ListBase : IDisposable, ICollection, Gst.GLib.IWrapper, ICloneable {
private IntPtr list_ptr = IntPtr.Zero; private IntPtr list_ptr = IntPtr.Zero;
private int length = -1; private int length = -1;
@ -159,10 +159,10 @@ namespace Gst.GLib {
ret = Marshaller.FilenamePtrToString (data); ret = Marshaller.FilenamePtrToString (data);
else if (element_type == typeof (IntPtr)) else if (element_type == typeof (IntPtr))
ret = data; ret = data;
else if (element_type.IsSubclassOf (typeof (GLib.Object))) else if (element_type.IsSubclassOf (typeof (Gst.GLib.Object)))
ret = GLib.Object.GetObject (data, false); ret = Gst.GLib.Object.GetObject (data, false);
else if (element_type.IsSubclassOf (typeof (GLib.Opaque))) else if (element_type.IsSubclassOf (typeof (Gst.GLib.Opaque)))
ret = GLib.Opaque.GetOpaque (data, element_type, elements_owned); ret = Gst.GLib.Opaque.GetOpaque (data, element_type, elements_owned);
else if (element_type == typeof (int)) else if (element_type == typeof (int))
ret = (int) data; ret = (int) data;
else if (element_type.IsValueType) else if (element_type.IsValueType)
@ -175,7 +175,7 @@ namespace Gst.GLib {
ret = Activator.CreateInstance (element_type, new object[] {data}); ret = Activator.CreateInstance (element_type, new object[] {data});
} else if (Object.IsObject (data)) } else if (Object.IsObject (data))
ret = GLib.Object.GetObject (data, false); ret = Gst.GLib.Object.GetObject (data, false);
return ret; return ret;
} }
@ -190,10 +190,10 @@ namespace Gst.GLib {
{ {
if (elements_owned) if (elements_owned)
for (uint i = 0; i < Count; i++) for (uint i = 0; i < Count; i++)
if (typeof (GLib.Object).IsAssignableFrom (element_type)) if (typeof (Gst.GLib.Object).IsAssignableFrom (element_type))
g_object_unref (NthData (i)); g_object_unref (NthData (i));
else if (typeof (GLib.Opaque).IsAssignableFrom (element_type)) else if (typeof (Gst.GLib.Opaque).IsAssignableFrom (element_type))
GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose (); Gst.GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
else else
g_free (NthData (i)); g_free (NthData (i));

View File

@ -39,7 +39,7 @@ namespace Gst.GLib {
FlagRecursion = 1 << 0, FlagRecursion = 1 << 0,
FlagFatal = 1 << 1, FlagFatal = 1 << 1,
/* GLib log levels */ /* Gst.GLib log levels */
Error = 1 << 2, /* always fatal */ Error = 1 << 2, /* always fatal */
Critical = 1 << 3, Critical = 1 << 3,
Warning = 1 << 4, Warning = 1 << 4,

View File

@ -1,4 +1,4 @@
// GLib.MainContext.cs - mainContext class implementation // Gst.GLib.MainContext.cs - mainContext class implementation
// //
// Author: Radek Doulik <rodo@matfyz.cz> // Author: Radek Doulik <rodo@matfyz.cz>
// //

View File

@ -1,4 +1,4 @@
// GLib.MainLoop.cs - g_main_loop class implementation // Gst.GLib.MainLoop.cs - g_main_loop class implementation
// //
// Author: Jeroen Zwartepoorte <jeroen@xs4all.nl> // Author: Jeroen Zwartepoorte <jeroen@xs4all.nl>
// //

View File

@ -1,4 +1,4 @@
// GLib.ManagedValue.cs : Managed types boxer // Gst.GLib.ManagedValue.cs : Managed types boxer
// //
// Author: Rachel Hestilow <hestilow@ximian.com> // Author: Rachel Hestilow <hestilow@ximian.com>
// //
@ -23,7 +23,7 @@ namespace Gst.GLib {
using System; using System;
using System.Collections; using System.Collections;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using GLib; using Gst.GLib;
internal class ManagedValue { internal class ManagedValue {
@ -77,7 +77,7 @@ namespace Gst.GLib {
free = new FreeFunc (Free); free = new FreeFunc (Free);
IntPtr name = Marshaller.StringToPtrGStrdup ("GstGLibSharpValue"); IntPtr name = Marshaller.StringToPtrGStrdup ("GstGLibSharpValue");
boxed_type = new GLib.GType (g_boxed_type_register_static (name, copy, free)); boxed_type = new Gst.GLib.GType (g_boxed_type_register_static (name, copy, free));
Marshaller.Free (name); Marshaller.Free (name);
} }

View File

@ -1,4 +1,4 @@
// GLibSharp.Marshaller.cs : Marshalling utils // Gst.GLibSharp.Marshaller.cs : Marshalling utils
// //
// Author: Rachel Hestilow <rachel@nullenvoid.com> // Author: Rachel Hestilow <rachel@nullenvoid.com>
// Mike Kestner <mkestner@ximian.com> // Mike Kestner <mkestner@ximian.com>
@ -56,7 +56,7 @@ namespace Gst.GLib {
IntPtr dummy, error; IntPtr dummy, error;
IntPtr utf8 = g_filename_to_utf8 (ptr, -1, IntPtr.Zero, out dummy, out error); IntPtr utf8 = g_filename_to_utf8 (ptr, -1, IntPtr.Zero, out dummy, out error);
if (error != IntPtr.Zero) if (error != IntPtr.Zero)
throw new GLib.GException (error); throw new Gst.GLib.GException (error);
return Utf8PtrToString (utf8); return Utf8PtrToString (utf8);
} }
@ -200,9 +200,9 @@ namespace Gst.GLib {
string[] members = new string[count]; string[] members = new string[count];
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
IntPtr s = Marshal.ReadIntPtr (string_array, i * IntPtr.Size); IntPtr s = Marshal.ReadIntPtr (string_array, i * IntPtr.Size);
members[i] = GLib.Marshaller.PtrToStringGFree (s); members[i] = Gst.GLib.Marshaller.PtrToStringGFree (s);
} }
GLib.Marshaller.Free (string_array); Gst.GLib.Marshaller.Free (string_array);
return members; return members;
} }
@ -262,7 +262,7 @@ namespace Gst.GLib {
return buf; return buf;
} }
[Obsolete ("Use GLib.Argv instead to avoid leaks.")] [Obsolete ("Use Gst.GLib.Argv instead to avoid leaks.")]
public static IntPtr ArgvToArrayPtr (string[] args) public static IntPtr ArgvToArrayPtr (string[] args)
{ {
if (args.Length == 0) if (args.Length == 0)
@ -303,7 +303,7 @@ namespace Gst.GLib {
return args; return args;
} }
[Obsolete ("Use GLib.Argv instead to avoid leaks.")] [Obsolete ("Use Gst.GLib.Argv instead to avoid leaks.")]
public static string[] ArrayPtrToArgv (IntPtr array, int argc) public static string[] ArrayPtrToArgv (IntPtr array, int argc)
{ {
if (argc == 0) if (argc == 0)
@ -379,10 +379,10 @@ namespace Gst.GLib {
{ {
Type array_type = elem_type == typeof (ListBase.FilenameString) ? typeof (string) : elem_type; Type array_type = elem_type == typeof (ListBase.FilenameString) ? typeof (string) : elem_type;
ListBase list; ListBase list;
if (list_type == typeof(GLib.List)) if (list_type == typeof(Gst.GLib.List))
list = new GLib.List (list_ptr, elem_type, owned, elements_owned); list = new Gst.GLib.List (list_ptr, elem_type, owned, elements_owned);
else else
list = new GLib.SList (list_ptr, elem_type, owned, elements_owned); list = new Gst.GLib.SList (list_ptr, elem_type, owned, elements_owned);
using (list) using (list)
return ListToArray (list, array_type); return ListToArray (list, array_type);
@ -390,7 +390,7 @@ namespace Gst.GLib {
public static Array PtrArrayToArray (IntPtr list_ptr, bool owned, bool elements_owned, Type elem_type) public static Array PtrArrayToArray (IntPtr list_ptr, bool owned, bool elements_owned, Type elem_type)
{ {
GLib.PtrArray array = new GLib.PtrArray (list_ptr, elem_type, owned, elements_owned); Gst.GLib.PtrArray array = new Gst.GLib.PtrArray (list_ptr, elem_type, owned, elements_owned);
Array ret = Array.CreateInstance (elem_type, array.Count); Array ret = Array.CreateInstance (elem_type, array.Count);
array.CopyTo (ret, 0); array.CopyTo (ret, 0);
array.Dispose (); array.Dispose ();
@ -403,7 +403,7 @@ namespace Gst.GLib {
if (list.Count > 0) if (list.Count > 0)
list.CopyTo (result, 0); list.CopyTo (result, 0);
if (type.IsSubclassOf (typeof (GLib.Opaque))) if (type.IsSubclassOf (typeof (Gst.GLib.Opaque)))
list.elements_owned = false; list.elements_owned = false;
return result; return result;

View File

@ -21,7 +21,7 @@ namespace Gst.GLib {
public delegate void NotifyHandler (object o, NotifyArgs args); public delegate void NotifyHandler (object o, NotifyArgs args);
public class NotifyArgs : GLib.SignalArgs { public class NotifyArgs : Gst.GLib.SignalArgs {
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_param_spec_get_name (IntPtr pspec); static extern IntPtr g_param_spec_get_name (IntPtr pspec);

View File

@ -118,7 +118,7 @@ namespace Gst.GLib {
if (!owned_ref) if (!owned_ref)
g_object_ref (o); g_object_ref (o);
obj = GLib.ObjectManager.CreateObject(o); obj = Gst.GLib.ObjectManager.CreateObject(o);
if (obj == null) { if (obj == null) {
g_object_unref (o); g_object_unref (o);
return null; return null;
@ -163,7 +163,7 @@ namespace Gst.GLib {
m.Invoke (null, parms); m.Invoke (null, parms);
} }
for (Type curr = t; curr != typeof(GLib.Object); curr = curr.BaseType) { for (Type curr = t; curr != typeof(Gst.GLib.Object); curr = curr.BaseType) {
if (curr.Assembly.IsDefined (typeof (IgnoreClassInitializersAttribute), false)) if (curr.Assembly.IsDefined (typeof (IgnoreClassInitializersAttribute), false))
continue; continue;
@ -185,12 +185,10 @@ namespace Gst.GLib {
} }
} }
[StructLayout(LayoutKind.Sequential)]
struct GTypeClass { struct GTypeClass {
public IntPtr gtype; public IntPtr gtype;
} }
[StructLayout(LayoutKind.Sequential)]
struct GObjectClass { struct GObjectClass {
GTypeClass type_class; GTypeClass type_class;
IntPtr construct_props; IntPtr construct_props;
@ -201,7 +199,7 @@ namespace Gst.GLib {
IntPtr finalize; IntPtr finalize;
IntPtr dispatch_properties_changed; IntPtr dispatch_properties_changed;
IntPtr notify; IntPtr notify;
public ConstructedDelegate constructed_cb; IntPtr constructed;
IntPtr dummy1; IntPtr dummy1;
IntPtr dummy2; IntPtr dummy2;
IntPtr dummy3; IntPtr dummy3;
@ -211,37 +209,49 @@ namespace Gst.GLib {
IntPtr dummy7; IntPtr dummy7;
} }
static Hashtable class_structs; [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr ConstructorDelegate (IntPtr gtype, uint n_construct_properties, IntPtr construct_properties);
static GObjectClass GetClassStruct (GLib.GType gtype, bool use_cache) static ConstructorDelegate constructor_handler;
{
if (class_structs == null)
class_structs = new Hashtable ();
if (use_cache && class_structs.Contains (gtype)) static ConstructorDelegate ConstructorHandler {
return (GObjectClass) class_structs [gtype]; get {
else { if (constructor_handler == null)
IntPtr class_ptr = gtype.GetClassPtr (); constructor_handler = new ConstructorDelegate (ConstructorCallback);
GObjectClass class_struct = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass)); return constructor_handler;
if (use_cache)
class_structs.Add (gtype, class_struct);
return class_struct;
} }
} }
static void OverrideClassStruct (GLib.GType gtype, GObjectClass class_struct) [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_param_spec_get_name (IntPtr pspec);
static IntPtr ConstructorCallback (IntPtr gtypeval, uint n_construct_properties, IntPtr construct_properties)
{ {
IntPtr class_ptr = gtype.GetClassPtr (); GType gtype = new Gst.GLib.GType (gtypeval);
Marshal.StructureToPtr (class_struct, class_ptr, false); GObjectClass threshold_class = (GObjectClass) Marshal.PtrToStructure (gtype.GetThresholdType ().GetClassPtr (), typeof (GObjectClass));
IntPtr raw = threshold_class.constructor_cb (gtypeval, n_construct_properties, construct_properties);
bool construct_needed = true;
for (int i = 0; i < n_construct_properties; i++) {
IntPtr p = new IntPtr (construct_properties.ToInt64 () + i * 2 * IntPtr.Size);
string prop_name = Marshaller.Utf8PtrToString (g_param_spec_get_name (Marshal.ReadIntPtr (p)));
if (prop_name != "gtk-sharp-managed-instance")
continue;
Value val = (Value) Marshal.PtrToStructure (Marshal.ReadIntPtr (p, IntPtr.Size), typeof (Value));
if ((IntPtr) val.Val != IntPtr.Zero) {
GCHandle gch = (GCHandle) (IntPtr) val.Val;
Object o = (Gst.GLib.Object) gch.Target;
o.Raw = raw;
construct_needed = false;
break;
}
} }
if (construct_needed)
GetObject (raw, false);
static void OverridePropertyHandlers (GType gtype, GetPropertyDelegate get_cb, SetPropertyDelegate set_cb) return raw;
{
GObjectClass klass = GetClassStruct (gtype, false);
klass.get_prop_cb = get_cb;
klass.set_prop_cb = set_cb;
OverrideClassStruct (gtype, klass);
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@ -256,101 +266,52 @@ namespace Gst.GLib {
return pspec.Handle; return pspec.Handle;
} }
static ConstructorDelegate Constructor_cb = new ConstructorDelegate (constructor_cb); static void AddProperties (GType gtype, System.Type t, bool register_instance_prop)
delegate IntPtr ConstructorDelegate (IntPtr gtype, uint n_construct_properties, IntPtr construct_properties);
[StructLayout(LayoutKind.Sequential)]
struct GObjectConstructParam {
public IntPtr pspec;
public IntPtr value;
}
static IntPtr constructor_cb (IntPtr gtype, uint n_construct_properties, IntPtr construct_properties)
{
GType type = new GLib.GType (gtype);
IntPtr instance = GetClassStruct (type.GetThresholdType (), false).constructor_cb (gtype, n_construct_properties, construct_properties);
for (int i = 0; i < n_construct_properties; i++) {
IntPtr p = new IntPtr ((long) construct_properties + i * Marshal.SizeOf (typeof (GObjectConstructParam)));
GObjectConstructParam cparam = (GObjectConstructParam) Marshal.PtrToStructure (p, typeof (GObjectConstructParam));
ParamSpec pspec = new ParamSpec (cparam.pspec);
GLib.Value val = (Value) Marshal.PtrToStructure (cparam.value, typeof (Value));
if (pspec.Name == "gtk-sharp-managed-instance" && (IntPtr) val.Val != IntPtr.Zero) {
GCHandle gch = (GCHandle) (IntPtr) val.Val;
Object o = (GLib.Object) gch.Target;
o.Raw = instance;
}
}
return instance;
}
static ConstructedDelegate Constructed_cb = new ConstructedDelegate (constructed_cb);
[GLib.CDeclCallback]
delegate void ConstructedDelegate (IntPtr o);
static void constructed_cb (IntPtr o)
{
GLib.Object __obj = GLib.Object.GetObject (o, false) as GLib.Object;
ConstructedDelegate unmanaged = GetClassStruct (__obj.LookupGType ().GetThresholdType (), true).constructed_cb;
if (unmanaged != null)
unmanaged (__obj.Handle);
}
static SetPropertyDelegate Set_prop_dummy_cb = new SetPropertyDelegate (set_prop_dummy_cb);
static void set_prop_dummy_cb (IntPtr GObject, uint property_id, ref GLib.Value value, IntPtr pspec) {}
static void AddProperties (GType gtype, System.Type t)
{ {
uint idx = 1; uint idx = 1;
if (gtype.GetBaseType () == gtype.GetThresholdType ()) { if (register_instance_prop) {
GObjectClass gobject_class = GetClassStruct (gtype, false);
gobject_class.constructor_cb = Constructor_cb;
gobject_class.constructed_cb = Constructed_cb;
gobject_class.set_prop_cb = Set_prop_dummy_cb;
OverrideClassStruct (gtype, gobject_class);
IntPtr declaring_class = gtype.GetClassPtr (); IntPtr declaring_class = gtype.GetClassPtr ();
ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly); ParamSpec pspec = new ParamSpec ("gtk-sharp-managed-instance", "", "", GType.Pointer, ParamFlags.Writable | ParamFlags.ConstructOnly);
g_object_class_install_property (declaring_class, idx, pspec.Handle); g_object_class_install_property (declaring_class, idx, pspec.Handle);
idx++; idx++;
} }
bool handlers_overridden = false; bool handlers_overridden = register_instance_prop;
foreach (PropertyInfo pinfo in t.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) { foreach (PropertyInfo pinfo in t.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly)) {
foreach (object attr in pinfo.GetCustomAttributes (typeof (PropertyAttribute), false)) { foreach (object attr in pinfo.GetCustomAttributes (typeof (PropertyAttribute), false)) {
if(pinfo.GetIndexParameters().Length > 0) if(pinfo.GetIndexParameters().Length > 0)
throw(new InvalidOperationException(String.Format("GLib.RegisterPropertyAttribute cannot be applied to property {0} of type {1} because the property expects one or more indexed parameters", pinfo.Name, t.FullName))); throw(new InvalidOperationException(String.Format("Gst.GLib.RegisterPropertyAttribute cannot be applied to property {0} of type {1} because the property expects one or more indexed parameters", pinfo.Name, t.FullName)));
PropertyAttribute property_attr = attr as PropertyAttribute;
if (!handlers_overridden) { if (!handlers_overridden) {
OverridePropertyHandlers (gtype, GetPropertyHandler, SetPropertyHandler); IntPtr class_ptr = gtype.GetClassPtr ();
GObjectClass gobject_class = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass));
gobject_class.get_prop_cb = GetPropertyHandler;
gobject_class.set_prop_cb = SetPropertyHandler;
Marshal.StructureToPtr (gobject_class, class_ptr, false);
handlers_overridden = true; handlers_overridden = true;
} }
PropertyAttribute property_attr = attr as PropertyAttribute;
try { try {
IntPtr param_spec = RegisterProperty (gtype, property_attr.Name, property_attr.Nickname, property_attr.Blurb, idx, (GType) pinfo.PropertyType, pinfo.CanRead, pinfo.CanWrite); IntPtr param_spec = RegisterProperty (gtype, property_attr.Name, property_attr.Nickname, property_attr.Blurb, idx, (GType) pinfo.PropertyType, pinfo.CanRead, pinfo.CanWrite);
Properties.Add (param_spec, pinfo); Properties.Add (param_spec, pinfo);
idx++; idx++;
} catch (ArgumentException) { } catch (ArgumentException) {
throw new InvalidOperationException (String.Format ("GLib.PropertyAttribute cannot be applied to property {0} of type {1} because the return type of the property is not supported", pinfo.Name, t.FullName)); throw new InvalidOperationException (String.Format ("Gst.GLib.PropertyAttribute cannot be applied to property {0} of type {1} because the return type of the property is not supported", pinfo.Name, t.FullName));
} }
} }
} }
} }
[UnmanagedFunctionPointer (CallingConvention.Cdecl)] [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void GetPropertyDelegate (IntPtr GObject, uint property_id, ref GLib.Value value, IntPtr pspec); delegate void GetPropertyDelegate (IntPtr GObject, uint property_id, ref Gst.GLib.Value value, IntPtr pspec);
static void GetPropertyCallback (IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec) static void GetPropertyCallback (IntPtr handle, uint property_id, ref Gst.GLib.Value value, IntPtr param_spec)
{ {
if (!Properties.Contains (param_spec)) if (!Properties.Contains (param_spec))
return; return;
GLib.Object obj = GLib.Object.GetObject (handle, false); Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, false);
value.Val = (Properties [param_spec] as PropertyInfo).GetValue (obj, new object [0]); value.Val = (Properties [param_spec] as PropertyInfo).GetValue (obj, new object [0]);
} }
@ -364,14 +325,14 @@ namespace Gst.GLib {
} }
[UnmanagedFunctionPointer (CallingConvention.Cdecl)] [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void SetPropertyDelegate (IntPtr GObject, uint property_id, ref GLib.Value value, IntPtr pspec); delegate void SetPropertyDelegate (IntPtr GObject, uint property_id, ref Gst.GLib.Value value, IntPtr pspec);
static void SetPropertyCallback(IntPtr handle, uint property_id, ref GLib.Value value, IntPtr param_spec) static void SetPropertyCallback(IntPtr handle, uint property_id, ref Gst.GLib.Value value, IntPtr param_spec)
{ {
if (!Properties.Contains (param_spec)) if (!Properties.Contains (param_spec))
return; return;
GLib.Object obj = GLib.Object.GetObject (handle, false); Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, false);
(Properties [param_spec] as PropertyInfo).SetValue (obj, value.Val, new object [0]); (Properties [param_spec] as PropertyInfo).SetValue (obj, value.Val, new object [0]);
} }
@ -404,20 +365,28 @@ namespace Gst.GLib {
protected internal static GType RegisterGType (System.Type t) protected internal static GType RegisterGType (System.Type t)
{ {
GType gtype = GType.RegisterGObjectType (t); GType gtype = GType.RegisterGObjectType (t);
AddProperties (gtype, t); bool is_first_subclass = gtype.GetBaseType () == gtype.GetThresholdType ();
if (is_first_subclass) {
IntPtr class_ptr = gtype.GetClassPtr ();
GObjectClass gobject_class = (GObjectClass) Marshal.PtrToStructure (class_ptr, typeof (GObjectClass));
gobject_class.constructor_cb = ConstructorHandler;
gobject_class.get_prop_cb = GetPropertyHandler;
gobject_class.set_prop_cb = SetPropertyHandler;
Marshal.StructureToPtr (gobject_class, class_ptr, false);
}
AddProperties (gtype, t, is_first_subclass);
ConnectDefaultHandlers (gtype, t); ConnectDefaultHandlers (gtype, t);
InvokeClassInitializers (gtype, t); InvokeClassInitializers (gtype, t);
AddInterfaces (gtype, t); AddInterfaces (gtype, t);
return gtype; return gtype;
} }
protected GType LookupGType () protected GType LookupGType ()
{ {
if (Handle != IntPtr.Zero) { if (Handle != IntPtr.Zero) {
GTypeInstance obj = (GTypeInstance) Marshal.PtrToStructure (Handle, typeof (GTypeInstance)); GTypeInstance obj = (GTypeInstance) Marshal.PtrToStructure (Handle, typeof (GTypeInstance));
GTypeClass klass = (GTypeClass) Marshal.PtrToStructure (obj.g_class, typeof (GTypeClass)); GTypeClass klass = (GTypeClass) Marshal.PtrToStructure (obj.g_class, typeof (GTypeClass));
return new GLib.GType (klass.gtype); return new Gst.GLib.GType (klass.gtype);
} else { } else {
return LookupGType (GetType ()); return LookupGType (GetType ());
} }
@ -435,7 +404,7 @@ namespace Gst.GLib {
protected Object () protected Object ()
{ {
CreateNativeObject (new string [0], new GLib.Value [0]); CreateNativeObject (new string [0], new Gst.GLib.Value [0]);
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@ -443,38 +412,34 @@ namespace Gst.GLib {
struct GParameter { struct GParameter {
public IntPtr name; public IntPtr name;
public GLib.Value val; public Gst.GLib.Value val;
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_object_newv (IntPtr gtype, int n_params, GParameter[] parms); static extern IntPtr g_object_newv (IntPtr gtype, int n_params, GParameter[] parms);
protected virtual void CreateNativeObject (string[] names, GLib.Value[] vals) protected virtual void CreateNativeObject (string[] names, Gst.GLib.Value[] vals)
{ {
GLib.GType gtype = LookupGType (); GType gtype = LookupGType ();
bool managed_type = gtype.ToString().StartsWith ("__gtksharp_"); bool is_managed_subclass = gtype.ToString ().StartsWith ("__gst_gtksharp");
GParameter[] parms = new GParameter [is_managed_subclass ? names.Length + 1 : names.Length];
GParameter[] parms = new GParameter [names.Length + ((managed_type) ? 1 : 0)];
for (int i = 0; i < names.Length; i++) { for (int i = 0; i < names.Length; i++) {
parms [i].name = GLib.Marshaller.StringToPtrGStrdup (names [i]); parms [i].name = Gst.GLib.Marshaller.StringToPtrGStrdup (names [i]);
parms [i].val = vals [i]; parms [i].val = vals [i];
} }
if (managed_type) { if (is_managed_subclass) {
GCHandle gch = GCHandle.Alloc (this); GCHandle gch = GCHandle.Alloc (this);
parms[names.Length].name = GLib.Marshaller.StringToPtrGStrdup ("gtk-sharp-managed-instance"); parms[names.Length].name = Gst.GLib.Marshaller.StringToPtrGStrdup ("gtk-sharp-managed-instance");
parms[names.Length].val = new GLib.Value ((IntPtr) gch); parms[names.Length].val = new Gst.GLib.Value ((IntPtr) gch);
Raw = g_object_newv (gtype.Val, parms.Length, parms); Raw = g_object_newv (gtype.Val, parms.Length, parms);
gch.Free (); gch.Free ();
} else { } else {
Raw = g_object_newv (gtype.Val, parms.Length, parms); Raw = g_object_newv (gtype.Val, parms.Length, parms);
} }
foreach (GParameter p in parms) foreach (GParameter p in parms)
GLib.Marshaller.Free (p.name); Gst.GLib.Marshaller.Free (p.name);
} }
protected virtual IntPtr Raw { protected virtual IntPtr Raw {
@ -500,7 +465,7 @@ namespace Gst.GLib {
} }
} }
public static GLib.GType GType { public static Gst.GLib.GType GType {
get { get {
return GType.Object; return GType.Object;
} }
@ -512,7 +477,7 @@ namespace Gst.GLib {
} }
} }
internal GLib.GType NativeType { internal Gst.GLib.GType NativeType {
get { get {
return LookupGType (); return LookupGType ();
} }
@ -537,7 +502,7 @@ namespace Gst.GLib {
} }
Hashtable before_signals; Hashtable before_signals;
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")] [Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
protected internal Hashtable BeforeSignals { protected internal Hashtable BeforeSignals {
get { get {
if (before_signals == null) if (before_signals == null)
@ -547,7 +512,7 @@ namespace Gst.GLib {
} }
Hashtable after_signals; Hashtable after_signals;
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")] [Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
protected internal Hashtable AfterSignals { protected internal Hashtable AfterSignals {
get { get {
if (after_signals == null) if (after_signals == null)
@ -557,7 +522,7 @@ namespace Gst.GLib {
} }
EventHandlerList before_handlers; EventHandlerList before_handlers;
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")] [Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
protected EventHandlerList BeforeHandlers { protected EventHandlerList BeforeHandlers {
get { get {
if (before_handlers == null) if (before_handlers == null)
@ -567,7 +532,7 @@ namespace Gst.GLib {
} }
EventHandlerList after_handlers; EventHandlerList after_handlers;
[Obsolete ("Replaced by GLib.Signal marshaling mechanism.")] [Obsolete ("Replaced by Gst.GLib.Signal marshaling mechanism.")]
protected EventHandlerList AfterHandlers { protected EventHandlerList AfterHandlers {
get { get {
if (after_handlers == null) if (after_handlers == null)
@ -582,7 +547,7 @@ namespace Gst.GLib {
void NotifyCallback (IntPtr handle, IntPtr pspec, IntPtr gch) void NotifyCallback (IntPtr handle, IntPtr pspec, IntPtr gch)
{ {
try { try {
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal; Gst.GLib.Signal sig = ((GCHandle) gch).Target as Gst.GLib.Signal;
if (sig == null) if (sig == null)
throw new Exception("Unknown signal GC handle received " + gch); throw new Exception("Unknown signal GC handle received " + gch);
@ -590,7 +555,7 @@ namespace Gst.GLib {
args.Args = new object[1]; args.Args = new object[1];
args.Args[0] = pspec; args.Args[0] = pspec;
NotifyHandler handler = (NotifyHandler) sig.Handler; NotifyHandler handler = (NotifyHandler) sig.Handler;
handler (GLib.Object.GetObject (handle), args); handler (Gst.GLib.Object.GetObject (handle), args);
} catch (Exception e) { } catch (Exception e) {
ExceptionManager.RaiseUnhandledException (e, false); ExceptionManager.RaiseUnhandledException (e, false);
} }
@ -653,25 +618,25 @@ namespace Gst.GLib {
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_object_get_property (IntPtr obj, IntPtr name, ref GLib.Value val); static extern void g_object_get_property (IntPtr obj, IntPtr name, ref Gst.GLib.Value val);
protected GLib.Value GetProperty (string name) protected Gst.GLib.Value GetProperty (string name)
{ {
Value val = new Value (this, name); Value val = new Value (this, name);
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
g_object_get_property (Raw, native_name, ref val); g_object_get_property (Raw, native_name, ref val);
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
return val; return val;
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_object_set_property (IntPtr obj, IntPtr name, ref GLib.Value val); static extern void g_object_set_property (IntPtr obj, IntPtr name, ref Gst.GLib.Value val);
protected void SetProperty (string name, GLib.Value val) protected void SetProperty (string name, Gst.GLib.Value val)
{ {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
g_object_set_property (Raw, native_name, ref val); g_object_set_property (Raw, native_name, ref val);
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
@ -679,9 +644,9 @@ namespace Gst.GLib {
protected void Notify (string property_name) protected void Notify (string property_name)
{ {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (property_name); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (property_name);
g_object_notify (Handle, native_name); g_object_notify (Handle, native_name);
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
} }
protected static void OverrideVirtualMethod (GType gtype, string name, Delegate cb) protected static void OverrideVirtualMethod (GType gtype, string name, Delegate cb)
@ -690,7 +655,7 @@ namespace Gst.GLib {
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
protected static extern void g_signal_chain_from_overridden (IntPtr args, ref GLib.Value retval); protected static extern void g_signal_chain_from_overridden (IntPtr args, ref Gst.GLib.Value retval);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool g_type_check_instance_is_a (IntPtr obj, IntPtr gtype); static extern bool g_type_check_instance_is_a (IntPtr obj, IntPtr gtype);
@ -700,12 +665,10 @@ namespace Gst.GLib {
return g_type_check_instance_is_a (obj, GType.Object.Val); return g_type_check_instance_is_a (obj, GType.Object.Val);
} }
[StructLayout(LayoutKind.Sequential)]
struct GTypeInstance { struct GTypeInstance {
public IntPtr g_class; public IntPtr g_class;
} }
[StructLayout(LayoutKind.Sequential)]
struct GObject { struct GObject {
public GTypeInstance type_instance; public GTypeInstance type_instance;
public uint ref_count; public uint ref_count;
@ -727,7 +690,7 @@ namespace Gst.GLib {
static Object () static Object ()
{ {
if (Environment.GetEnvironmentVariable ("GTK_SHARP_DEBUG") != null) if (Environment.GetEnvironmentVariable ("GTK_SHARP_DEBUG") != null)
GLib.Log.SetLogHandler ("GLib-GObject", GLib.LogLevelFlags.All, new GLib.LogFunc (GLib.Log.PrintTraceLogFunction)); Gst.GLib.Log.SetLogHandler ("Gst.GLib-GObject", Gst.GLib.LogLevelFlags.All, new Gst.GLib.LogFunc (Gst.GLib.Log.PrintTraceLogFunction));
} }
} }
} }

View File

@ -1,4 +1,4 @@
// GLib.ObjectManager.cs - GLib ObjectManager class implementation // Gst.GLib.ObjectManager.cs - Gst.GLib ObjectManager class implementation
// //
// Author: Mike Kestner <mkestner@speakeasy.net> // Author: Mike Kestner <mkestner@speakeasy.net>
// //
@ -30,7 +30,7 @@ namespace Gst.GLib {
static BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance; static BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance;
public static GLib.Object CreateObject (IntPtr raw) public static Gst.GLib.Object CreateObject (IntPtr raw)
{ {
if (raw == IntPtr.Zero) if (raw == IntPtr.Zero)
return null; return null;
@ -40,11 +40,11 @@ namespace Gst.GLib {
if (type == null) if (type == null)
return null; return null;
GLib.Object obj; Gst.GLib.Object obj;
try { try {
obj = Activator.CreateInstance (type, flags, null, new object[] {raw}, null) as GLib.Object; obj = Activator.CreateInstance (type, flags, null, new object[] {raw}, null) as Gst.GLib.Object;
} catch (MissingMethodException) { } catch (MissingMethodException) {
throw new GLib.MissingIntPtrCtorException ("GLib.Object subclass " + type + " must provide a protected or public IntPtr ctor to support wrapping of native object handles."); throw new Gst.GLib.MissingIntPtrCtorException ("Gst.GLib.Object subclass " + type + " must provide a protected or public IntPtr ctor to support wrapping of native object handles.");
} }
return obj; return obj;
} }

View File

@ -36,32 +36,34 @@ namespace Gst.GLib {
IntPtr handle; IntPtr handle;
private static IntPtr CreateParamSpec (string name, string nick, string blurb, GType type, ParamFlags pflags) { public ParamSpec (string name, string nick, string blurb, GType type, bool readable, bool writable) : this (name, nick, blurb, type, (readable ? ParamFlags.Readable : ParamFlags.None) | (writable ? ParamFlags.Writable : ParamFlags.None)) {}
int flags = (int) pflags;
IntPtr ret;
IntPtr p_name = GLib.Marshaller.StringToPtrGStrdup (name); internal ParamSpec (string name, string nick, string blurb, GType type, ParamFlags pflags)
IntPtr p_nick = GLib.Marshaller.StringToPtrGStrdup (nick); {
IntPtr p_blurb = GLib.Marshaller.StringToPtrGStrdup (blurb); int flags = (int) pflags;
IntPtr p_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr p_nick = Gst.GLib.Marshaller.StringToPtrGStrdup (nick);
IntPtr p_blurb = Gst.GLib.Marshaller.StringToPtrGStrdup (blurb);
if (type == GType.Char) if (type == GType.Char)
ret = g_param_spec_char (p_name, p_nick, p_blurb, SByte.MinValue, SByte.MaxValue, 0, flags); handle = g_param_spec_char (p_name, p_nick, p_blurb, SByte.MinValue, SByte.MaxValue, 0, flags);
else if (type == GType.UChar) else if (type == GType.UChar)
ret = g_param_spec_uchar (p_name, p_nick, p_blurb, Byte.MinValue, Byte.MaxValue, 0, flags); handle = g_param_spec_uchar (p_name, p_nick, p_blurb, Byte.MinValue, Byte.MaxValue, 0, flags);
else if (type == GType.Boolean) else if (type == GType.Boolean)
ret = g_param_spec_boolean (p_name, p_nick, p_blurb, false, flags); handle = g_param_spec_boolean (p_name, p_nick, p_blurb, false, flags);
else if (type == GType.Int) else if (type == GType.Int)
ret = g_param_spec_int (p_name, p_nick, p_blurb, Int32.MinValue, Int32.MaxValue, 0, flags); handle = g_param_spec_int (p_name, p_nick, p_blurb, Int32.MinValue, Int32.MaxValue, 0, flags);
else if (type == GType.UInt) else if (type == GType.UInt)
ret = g_param_spec_uint (p_name, p_nick, p_blurb, 0, UInt32.MaxValue, 0, flags); handle = g_param_spec_uint (p_name, p_nick, p_blurb, 0, UInt32.MaxValue, 0, flags);
else if (type == GType.Long) else if (type == GType.Long)
ret = g_param_spec_long (p_name, p_nick, p_blurb, IntPtr.Zero, IntPtr.Size == 4 ? new IntPtr (Int32.MaxValue) : new IntPtr (Int64.MaxValue), IntPtr.Zero, flags); handle = g_param_spec_long (p_name, p_nick, p_blurb, IntPtr.Zero, IntPtr.Size == 4 ? new IntPtr (Int32.MaxValue) : new IntPtr (Int64.MaxValue), IntPtr.Zero, flags);
else if (type == GType.ULong) else if (type == GType.ULong)
ret = g_param_spec_ulong (p_name, p_nick, p_blurb, UIntPtr.Zero, UIntPtr.Size == 4 ? new UIntPtr (UInt32.MaxValue) : new UIntPtr (UInt64.MaxValue), UIntPtr.Zero, flags); handle = g_param_spec_ulong (p_name, p_nick, p_blurb, UIntPtr.Zero, UIntPtr.Size == 4 ? new UIntPtr (UInt32.MaxValue) : new UIntPtr (UInt64.MaxValue), UIntPtr.Zero, flags);
else if (type == GType.Int64) else if (type == GType.Int64)
ret = g_param_spec_int64 (p_name, p_nick, p_blurb, Int64.MinValue, Int64.MaxValue, 0, flags); handle = g_param_spec_int64 (p_name, p_nick, p_blurb, Int64.MinValue, Int64.MaxValue, 0, flags);
else if (type == GType.UInt64) else if (type == GType.UInt64)
ret = g_param_spec_uint64 (p_name, p_nick, p_blurb, 0, UInt64.MaxValue, 0, flags); handle = g_param_spec_uint64 (p_name, p_nick, p_blurb, 0, UInt64.MaxValue, 0, flags);
/* /*
else if (type == GType.Enum) else if (type == GType.Enum)
else if (type == GType.Flags) else if (type == GType.Flags)
@ -69,40 +71,25 @@ namespace Gst.GLib {
* Both g_param_spec_enum and g_param_spec_flags expect default property values and the members of the enum seemingly cannot be enumerated * Both g_param_spec_enum and g_param_spec_flags expect default property values and the members of the enum seemingly cannot be enumerated
*/ */
else if (type == GType.Float) else if (type == GType.Float)
ret = g_param_spec_float (p_name, p_nick, p_blurb, Single.MinValue, Single.MaxValue, 0.0f, flags); handle = g_param_spec_float (p_name, p_nick, p_blurb, Single.MinValue, Single.MaxValue, 0.0f, flags);
else if (type == GType.Double) else if (type == GType.Double)
ret = g_param_spec_double (p_name, p_nick, p_blurb, Double.MinValue, Double.MaxValue, 0.0, flags); handle = g_param_spec_double (p_name, p_nick, p_blurb, Double.MinValue, Double.MaxValue, 0.0, flags);
else if (type == GType.String) else if (type == GType.String)
ret = g_param_spec_string (p_name, p_nick, p_blurb, IntPtr.Zero, flags); handle = g_param_spec_string (p_name, p_nick, p_blurb, IntPtr.Zero, flags);
else if (type == GType.Pointer) else if (type == GType.Pointer)
ret = g_param_spec_pointer (p_name, p_nick, p_blurb, flags); handle = g_param_spec_pointer (p_name, p_nick, p_blurb, flags);
else if (type.Val == g_gtype_get_type ()) else if (type.Val == g_gtype_get_type ())
ret = g_param_spec_gtype (p_name, p_nick, p_blurb, GType.None.Val, flags); handle = g_param_spec_gtype (p_name, p_nick, p_blurb, GType.None.Val, flags);
else if (g_type_is_a (type.Val, GType.Boxed.Val)) else if (g_type_is_a (type.Val, GType.Boxed.Val))
ret = g_param_spec_boxed (p_name, p_nick, p_blurb, type.Val, flags); handle = g_param_spec_boxed (p_name, p_nick, p_blurb, type.Val, flags);
else if (g_type_is_a (type.Val, GType.Object.Val)) else if (g_type_is_a (type.Val, GType.Object.Val))
ret = g_param_spec_object (p_name, p_nick, p_blurb, type.Val, flags); handle = g_param_spec_object (p_name, p_nick, p_blurb, type.Val, flags);
else else
throw new ArgumentException ("type"); throw new ArgumentException ("type");
GLib.Marshaller.Free (p_name); Gst.GLib.Marshaller.Free (p_name);
GLib.Marshaller.Free (p_nick); Gst.GLib.Marshaller.Free (p_nick);
GLib.Marshaller.Free (p_blurb); Gst.GLib.Marshaller.Free (p_blurb);
return ret;
}
internal ParamSpec (string name, string nick, string blurb, GType type, ParamFlags pflags) {
handle = CreateParamSpec (name, nick, blurb, type, pflags);
}
public ParamSpec (string name, string nick, string blurb, GType type, bool readable, bool writable)
{
ParamFlags pflags = ParamFlags.None;
if (readable) pflags |= ParamFlags.Readable;
if (writable) pflags |= ParamFlags.Writable;
handle = CreateParamSpec (name, nick, blurb, type, pflags);
} }
public ParamSpec (IntPtr native) public ParamSpec (IntPtr native)
@ -121,13 +108,6 @@ namespace Gst.GLib {
} }
} }
public string Name {
get {
GParamSpec spec = (GParamSpec) Marshal.PtrToStructure (Handle, typeof (GParamSpec));
return GLib.Marshaller.Utf8PtrToString (spec.name);
}
}
struct GTypeInstance { struct GTypeInstance {
IntPtr g_class; IntPtr g_class;
} }
@ -135,7 +115,7 @@ namespace Gst.GLib {
struct GParamSpec { struct GParamSpec {
GTypeInstance g_type_instance; GTypeInstance g_type_instance;
public IntPtr name; IntPtr name;
ParamFlags flags; ParamFlags flags;
public IntPtr value_type; public IntPtr value_type;
IntPtr owner_type; IntPtr owner_type;

View File

@ -1,4 +1,4 @@
// GLib.Priority.cs // Gst.GLib.Priority.cs
// //
// Author(s): // Author(s):
// Stephane Delcroix <stephane@delcroix.org> // Stephane Delcroix <stephane@delcroix.org>

View File

@ -94,10 +94,10 @@ namespace Gst.GLib {
if (elements_owned) { if (elements_owned) {
int count = Count; int count = Count;
for (uint i = 0; i < count; i++) for (uint i = 0; i < count; i++)
if (typeof (GLib.Object).IsAssignableFrom (element_type)) if (typeof (Gst.GLib.Object).IsAssignableFrom (element_type))
g_object_unref (NthData (i)); g_object_unref (NthData (i));
else if (typeof (GLib.Opaque).IsAssignableFrom (element_type)) else if (typeof (Gst.GLib.Opaque).IsAssignableFrom (element_type))
GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose (); Gst.GLib.Opaque.GetOpaque (NthData (i), element_type, true).Dispose ();
else else
g_free (NthData (i)); g_free (NthData (i));
} }
@ -174,10 +174,10 @@ namespace Gst.GLib {
ret = Marshaller.Utf8PtrToString (data); ret = Marshaller.Utf8PtrToString (data);
else if (element_type == typeof (IntPtr)) else if (element_type == typeof (IntPtr))
ret = data; ret = data;
else if (element_type.IsSubclassOf (typeof (GLib.Object))) else if (element_type.IsSubclassOf (typeof (Gst.GLib.Object)))
ret = GLib.Object.GetObject (data, false); ret = Gst.GLib.Object.GetObject (data, false);
else if (element_type.IsSubclassOf (typeof (GLib.Opaque))) else if (element_type.IsSubclassOf (typeof (Gst.GLib.Opaque)))
ret = GLib.Opaque.GetOpaque (data, element_type, elements_owned); ret = Gst.GLib.Opaque.GetOpaque (data, element_type, elements_owned);
else if (element_type == typeof (int)) else if (element_type == typeof (int))
ret = (int) data; ret = (int) data;
else if (element_type.IsValueType) else if (element_type.IsValueType)
@ -186,7 +186,7 @@ namespace Gst.GLib {
ret = Activator.CreateInstance (element_type, new object[] {data}); ret = Activator.CreateInstance (element_type, new object[] {data});
} else if (Object.IsObject (data)) } else if (Object.IsObject (data))
ret = GLib.Object.GetObject (data, false); ret = Gst.GLib.Object.GetObject (data, false);
return ret; return ret;
} }

View File

@ -1,4 +1,4 @@
// GLib.Signal.cs - signal marshaling class // Gst.GLib.Signal.cs - signal marshaling class
// //
// Authors: Mike Kestner <mkestner@novell.com> // Authors: Mike Kestner <mkestner@novell.com>
// Andrés G. Aragoneses <aaragoneses@novell.com> // Andrés G. Aragoneses <aaragoneses@novell.com>
@ -140,7 +140,7 @@ namespace Gst.GLib {
SignalClosure after_closure; SignalClosure after_closure;
Delegate marshaler; Delegate marshaler;
private Signal (GLib.Object obj, string signal_name, Delegate marshaler) private Signal (Gst.GLib.Object obj, string signal_name, Delegate marshaler)
{ {
tref = obj.ToggleRef; tref = obj.ToggleRef;
name = signal_name; name = signal_name;
@ -148,7 +148,7 @@ namespace Gst.GLib {
this.marshaler = marshaler; this.marshaler = marshaler;
} }
private Signal (GLib.Object obj, string signal_name, Type args_type) private Signal (Gst.GLib.Object obj, string signal_name, Type args_type)
{ {
tref = obj.ToggleRef; tref = obj.ToggleRef;
name = signal_name; name = signal_name;
@ -215,12 +215,12 @@ namespace Gst.GLib {
} }
} }
public static Signal Lookup (GLib.Object obj, string name) public static Signal Lookup (Gst.GLib.Object obj, string name)
{ {
return Lookup (obj, name, typeof (EventArgs)); return Lookup (obj, name, typeof (EventArgs));
} }
public static Signal Lookup (GLib.Object obj, string name, Delegate marshaler) public static Signal Lookup (Gst.GLib.Object obj, string name, Delegate marshaler)
{ {
Signal result = obj.ToggleRef.Signals [name] as Signal; Signal result = obj.ToggleRef.Signals [name] as Signal;
if (result == null) if (result == null)
@ -228,7 +228,7 @@ namespace Gst.GLib {
return result; return result;
} }
public static Signal Lookup (GLib.Object obj, string name, Type args_type) public static Signal Lookup (Gst.GLib.Object obj, string name, Type args_type)
{ {
Signal result = obj.ToggleRef.Signals [name] as Signal; Signal result = obj.ToggleRef.Signals [name] as Signal;
if (result == null) if (result == null)
@ -313,7 +313,7 @@ namespace Gst.GLib {
} }
} }
public static object Emit (GLib.Object instance, string detailed_signal, params object[] args) public static object Emit (Gst.GLib.Object instance, string detailed_signal, params object[] args)
{ {
uint gquark, signal_id; uint gquark, signal_id;
string signal_name; string signal_name;
@ -321,13 +321,13 @@ namespace Gst.GLib {
signal_id = GetSignalId (signal_name, instance); signal_id = GetSignalId (signal_name, instance);
if (signal_id <= 0) if (signal_id <= 0)
throw new ArgumentException ("Invalid signal name: " + signal_name); throw new ArgumentException ("Invalid signal name: " + signal_name);
GLib.Value[] vals = new GLib.Value [args.Length + 1]; Gst.GLib.Value[] vals = new Gst.GLib.Value [args.Length + 1];
GLib.ValueArray inst_and_params = new GLib.ValueArray ((uint) args.Length + 1); Gst.GLib.ValueArray inst_and_params = new Gst.GLib.ValueArray ((uint) args.Length + 1);
vals [0] = new GLib.Value (instance); vals [0] = new Gst.GLib.Value (instance);
inst_and_params.Append (vals [0]); inst_and_params.Append (vals [0]);
for (int i = 1; i < vals.Length; i++) { for (int i = 1; i < vals.Length; i++) {
vals [i] = new GLib.Value (args [i - 1]); vals [i] = new Gst.GLib.Value (args [i - 1]);
inst_and_params.Append (vals [i]); inst_and_params.Append (vals [i]);
} }
@ -335,27 +335,27 @@ namespace Gst.GLib {
Query query; Query query;
g_signal_query (signal_id, out query); g_signal_query (signal_id, out query);
if (query.return_type != GType.None.Val) { if (query.return_type != GType.None.Val) {
GLib.Value ret = GLib.Value.Empty; Gst.GLib.Value ret = Gst.GLib.Value.Empty;
g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, ref ret); g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, ref ret);
ret_obj = ret.Val; ret_obj = ret.Val;
ret.Dispose (); ret.Dispose ();
} else } else
g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, IntPtr.Zero); g_signal_emitv (inst_and_params.ArrayPtr, signal_id, gquark, IntPtr.Zero);
foreach (GLib.Value val in vals) foreach (Gst.GLib.Value val in vals)
val.Dispose (); val.Dispose ();
return ret_obj; return ret_obj;
} }
private static uint GetGQuarkFromString (string str) { private static uint GetGQuarkFromString (string str) {
IntPtr native_string = GLib.Marshaller.StringToPtrGStrdup (str); IntPtr native_string = Gst.GLib.Marshaller.StringToPtrGStrdup (str);
uint ret = g_quark_from_string (native_string); uint ret = g_quark_from_string (native_string);
GLib.Marshaller.Free (native_string); Gst.GLib.Marshaller.Free (native_string);
return ret; return ret;
} }
private static uint GetSignalId (string signal_name, GLib.Object obj) private static uint GetSignalId (string signal_name, Gst.GLib.Object obj)
{ {
IntPtr typeid = GType.ValFromInstancePtr (obj.Handle); IntPtr typeid = GType.ValFromInstancePtr (obj.Handle);
return GetSignalId (signal_name, typeid); return GetSignalId (signal_name, typeid);
@ -363,13 +363,13 @@ namespace Gst.GLib {
private static uint GetSignalId (string signal_name, IntPtr typeid) private static uint GetSignalId (string signal_name, IntPtr typeid)
{ {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (signal_name); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (signal_name);
uint signal_id = g_signal_lookup (native_name, typeid); uint signal_id = g_signal_lookup (native_name, typeid);
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
return signal_id; return signal_id;
} }
public static ulong AddEmissionHook (string detailed_signal, GLib.GType type, EmissionHook handler_func) public static ulong AddEmissionHook (string detailed_signal, Gst.GLib.GType type, EmissionHook handler_func)
{ {
uint gquark; uint gquark;
string signal_name; string signal_name;
@ -395,7 +395,7 @@ namespace Gst.GLib {
static extern IntPtr g_signal_get_invocation_hint (IntPtr instance); static extern IntPtr g_signal_get_invocation_hint (IntPtr instance);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, ref GLib.Value return_value); static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, ref Gst.GLib.Value return_value);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, IntPtr return_value); static extern void g_signal_emitv (IntPtr instance_and_params, uint signal_id, uint gquark_detail, IntPtr return_value);

View File

@ -1,4 +1,4 @@
// GLib.SignalArgs.cs - Signal argument class implementation // Gst.GLib.SignalArgs.cs - Signal argument class implementation
// //
// Author: Mike Kestner <mkestner@speakeasy.net> // Author: Mike Kestner <mkestner@speakeasy.net>
// //

View File

@ -1,4 +1,4 @@
// GLib.SignalCallback.cs - Signal callback base class implementation // Gst.GLib.SignalCallback.cs - Signal callback base class implementation
// //
// Authors: Mike Kestner <mkestner@ximian.com> // Authors: Mike Kestner <mkestner@ximian.com>
// //
@ -25,7 +25,7 @@ namespace Gst.GLib {
using System.Collections; using System.Collections;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
[Obsolete ("Replaced by GLib.Signal.")] [Obsolete ("Replaced by Gst.GLib.Signal.")]
public abstract class SignalCallback : IDisposable { public abstract class SignalCallback : IDisposable {
// A counter used to produce unique keys for instances. // A counter used to produce unique keys for instances.
@ -35,13 +35,13 @@ namespace Gst.GLib {
protected static Hashtable _Instances = new Hashtable (); protected static Hashtable _Instances = new Hashtable ();
// protected instance members // protected instance members
protected GLib.Object _obj; protected Gst.GLib.Object _obj;
protected Delegate _handler; protected Delegate _handler;
protected int _key; protected int _key;
protected System.Type _argstype; protected System.Type _argstype;
protected uint _HandlerID; protected uint _HandlerID;
protected SignalCallback (GLib.Object obj, Delegate eh, System.Type argstype) protected SignalCallback (Gst.GLib.Object obj, Delegate eh, System.Type argstype)
{ {
_key = _NextKey++; _key = _NextKey++;
_obj = obj; _obj = obj;

View File

@ -28,10 +28,10 @@ namespace Gst.GLib {
internal class ClosureInvokedArgs : EventArgs { internal class ClosureInvokedArgs : EventArgs {
EventArgs args; EventArgs args;
GLib.Object obj; Gst.GLib.Object obj;
object result; object result;
public ClosureInvokedArgs (GLib.Object obj, EventArgs args) public ClosureInvokedArgs (Gst.GLib.Object obj, EventArgs args)
{ {
this.obj = obj; this.obj = obj;
this.args = args; this.args = args;
@ -43,7 +43,7 @@ namespace Gst.GLib {
} }
} }
public GLib.Object Target { public Gst.GLib.Object Target {
get { get {
return obj; return obj;
} }
@ -97,9 +97,9 @@ namespace Gst.GLib {
public void Connect (bool is_after) public void Connect (bool is_after)
{ {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name); IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
id = g_signal_connect_closure (handle, native_name, raw_closure, is_after); id = g_signal_connect_closure (handle, native_name, raw_closure, is_after);
GLib.Marshaller.Free (native_name); Gst.GLib.Marshaller.Free (native_name);
} }
public void Disconnect () public void Disconnect ()
@ -147,7 +147,7 @@ namespace Gst.GLib {
SignalClosure closure = closures [raw_closure] as SignalClosure; SignalClosure closure = closures [raw_closure] as SignalClosure;
message = "Marshaling " + closure.name + " signal"; message = "Marshaling " + closure.name + " signal";
Value objval = (Value) Marshal.PtrToStructure (param_values, typeof (Value)); Value objval = (Value) Marshal.PtrToStructure (param_values, typeof (Value));
GLib.Object __obj = objval.Val as GLib.Object; Gst.GLib.Object __obj = objval.Val as Gst.GLib.Object;
if (__obj == null) if (__obj == null)
return; return;
@ -158,7 +158,7 @@ namespace Gst.GLib {
SignalArgs args = Activator.CreateInstance (closure.args_type, new object [0]) as SignalArgs; SignalArgs args = Activator.CreateInstance (closure.args_type, new object [0]) as SignalArgs;
args.Args = new object [n_param_vals - 1]; args.Args = new object [n_param_vals - 1];
GLib.Value[] vals = new GLib.Value [n_param_vals - 1]; Gst.GLib.Value[] vals = new Gst.GLib.Value [n_param_vals - 1];
for (int i = 1; i < n_param_vals; i++) { for (int i = 1; i < n_param_vals; i++) {
IntPtr ptr = new IntPtr (param_values.ToInt64 () + i * Marshal.SizeOf (typeof (Value))); IntPtr ptr = new IntPtr (param_values.ToInt64 () + i * Marshal.SizeOf (typeof (Value)));
vals [i - 1] = (Value) Marshal.PtrToStructure (ptr, typeof (Value)); vals [i - 1] = (Value) Marshal.PtrToStructure (ptr, typeof (Value));

View File

@ -1,4 +1,4 @@
// GLib.Source.cs - Source class implementation // Gst.GLib.Source.cs - Source class implementation
// //
// Author: Duncan Mak <duncan@ximian.com> // Author: Duncan Mak <duncan@ximian.com>
// //

View File

@ -126,7 +126,7 @@ namespace Gst.GLib {
Marshaller.Free (native_dir); Marshaller.Free (native_dir);
Marshaller.Free (native_argv); Marshaller.Free (native_argv);
Marshaller.Free (native_envp); Marshaller.Free (native_envp);
if (error != IntPtr.Zero) throw new GLib.GException (error); if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
return result; return result;
} }
@ -161,7 +161,7 @@ namespace Gst.GLib {
Marshaller.Free (native_dir); Marshaller.Free (native_dir);
Marshaller.Free (native_argv); Marshaller.Free (native_argv);
Marshaller.Free (native_envp); Marshaller.Free (native_envp);
if (error != IntPtr.Zero) throw new GLib.GException (error); if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
return result; return result;
} }
@ -181,7 +181,7 @@ namespace Gst.GLib {
Marshaller.Free (native_envp); Marshaller.Free (native_envp);
stdout = Marshaller.PtrToStringGFree (native_stdout); stdout = Marshaller.PtrToStringGFree (native_stdout);
stderr = Marshaller.PtrToStringGFree (native_stderr); stderr = Marshaller.PtrToStringGFree (native_stderr);
if (error != IntPtr.Zero) throw new GLib.GException (error); if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
return result; return result;
} }
@ -194,7 +194,7 @@ namespace Gst.GLib {
IntPtr native_cmd = Marshaller.StringToPtrGStrdup (command_line); IntPtr native_cmd = Marshaller.StringToPtrGStrdup (command_line);
bool result = g_spawn_command_line_async (native_cmd, out error); bool result = g_spawn_command_line_async (native_cmd, out error);
Marshaller.Free (native_cmd); Marshaller.Free (native_cmd);
if (error != IntPtr.Zero) throw new GLib.GException (error); if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
return result; return result;
} }
@ -209,7 +209,7 @@ namespace Gst.GLib {
Marshaller.Free (native_cmd); Marshaller.Free (native_cmd);
stdout = Marshaller.PtrToStringGFree (native_stdout); stdout = Marshaller.PtrToStringGFree (native_stdout);
stderr = Marshaller.PtrToStringGFree (native_stderr); stderr = Marshaller.PtrToStringGFree (native_stderr);
if (error != IntPtr.Zero) throw new GLib.GException (error); if (error != IntPtr.Zero) throw new Gst.GLib.GException (error);
return result; return result;
} }
} }

View File

@ -1,4 +1,4 @@
// GLib.Timeout.cs - Timeout class implementation // Gst.GLib.Timeout.cs - Timeout class implementation
// //
// Author(s): // Author(s):
// Mike Kestner <mkestner@speakeasy.net> // Mike Kestner <mkestner@speakeasy.net>

View File

@ -1,4 +1,4 @@
// GLib.ToggleRef.cs - GLib ToggleRef class implementation // Gst.GLib.ToggleRef.cs - Gst.GLib ToggleRef class implementation
// //
// Author: Mike Kestner <mkestner@novell.com> // Author: Mike Kestner <mkestner@novell.com>
// //
@ -33,7 +33,7 @@ namespace Gst.GLib {
GCHandle gch; GCHandle gch;
Hashtable signals; Hashtable signals;
public ToggleRef (GLib.Object target) public ToggleRef (Gst.GLib.Object target)
{ {
handle = target.Handle; handle = target.Handle;
gch = GCHandle.Alloc (this); gch = GCHandle.Alloc (this);
@ -67,15 +67,15 @@ namespace Gst.GLib {
} }
} }
public GLib.Object Target { public Gst.GLib.Object Target {
get { get {
if (reference == null) if (reference == null)
return null; return null;
else if (reference is GLib.Object) else if (reference is Gst.GLib.Object)
return reference as GLib.Object; return reference as Gst.GLib.Object;
WeakReference weak = reference as WeakReference; WeakReference weak = reference as WeakReference;
return weak.Target as GLib.Object; return weak.Target as Gst.GLib.Object;
} }
} }
@ -111,7 +111,7 @@ namespace Gst.GLib {
void Toggle (bool is_last_ref) void Toggle (bool is_last_ref)
{ {
if (is_last_ref && reference is GLib.Object) if (is_last_ref && reference is Gst.GLib.Object)
reference = new WeakReference (reference); reference = new WeakReference (reference);
else if (!is_last_ref && reference is WeakReference) { else if (!is_last_ref && reference is WeakReference) {
WeakReference weak = reference as WeakReference; WeakReference weak = reference as WeakReference;

View File

@ -1,4 +1,4 @@
// GLib.TypeConverter.cs : Convert between fundamental and .NET types // Gst.GLib.TypeConverter.cs : Convert between fundamental and .NET types
// //
// Author: Rachel Hestilow <hestilow@ximian.com> // Author: Rachel Hestilow <hestilow@ximian.com>
// //

View File

@ -1,4 +1,4 @@
// GLib.TypeFundamentals.cs : Standard Types enumeration // Gst.GLib.TypeFundamentals.cs : Standard Types enumeration
// //
// Author: Mike Kestner <mkestner@speakeasy.net> // Author: Mike Kestner <mkestner@speakeasy.net>
// //

View File

@ -24,7 +24,7 @@ namespace Gst.GLib {
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
[Obsolete ("Replaced by direct object-type casts to/from GLib.Value")] [Obsolete ("Replaced by direct object-type casts to/from Gst.GLib.Value")]
public class UnwrappedObject { public class UnwrappedObject {
IntPtr obj; IntPtr obj;

View File

@ -1,4 +1,4 @@
// GLib.Value.cs - GLib Value class implementation // Gst.GLib.Value.cs - Gst.GLib Value class implementation
// //
// Author: Mike Kestner <mkestner@speakeasy.net> // Author: Mike Kestner <mkestner@speakeasy.net>
// //
@ -49,7 +49,7 @@ namespace Gst.GLib {
public static Value Empty; public static Value Empty;
public Value (GLib.GType gtype) public Value (Gst.GLib.GType gtype)
{ {
type = IntPtr.Zero; type = IntPtr.Zero;
pad1 = new Padding (); pad1 = new Padding ();
@ -133,9 +133,9 @@ namespace Gst.GLib {
public Value (string val) : this (GType.String) public Value (string val) : this (GType.String)
{ {
IntPtr native_val = GLib.Marshaller.StringToPtrGStrdup (val); IntPtr native_val = Gst.GLib.Marshaller.StringToPtrGStrdup (val);
g_value_set_string (ref this, native_val); g_value_set_string (ref this, native_val);
GLib.Marshaller.Free (native_val); Gst.GLib.Marshaller.Free (native_val);
} }
public Value (ValueArray val) : this (ValueArray.GType) public Value (ValueArray val) : this (ValueArray.GType)
@ -157,17 +157,17 @@ namespace Gst.GLib {
g_value_set_boxed (ref this, val.Handle); g_value_set_boxed (ref this, val.Handle);
} }
public Value (GLib.Object val) : this (val == null ? GType.Object : val.NativeType) public Value (Gst.GLib.Object val) : this (val == null ? GType.Object : val.NativeType)
{ {
g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle); g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle);
} }
public Value (GLib.GInterfaceAdapter val) : this (val == null ? GType.Object : val.GType) public Value (Gst.GLib.GInterfaceAdapter val) : this (val == null ? GType.Object : val.GType)
{ {
g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle); g_value_set_object (ref this, val == null ? IntPtr.Zero : val.Handle);
} }
public Value (GLib.Object obj, string prop_name) public Value (Gst.GLib.Object obj, string prop_name)
{ {
type = IntPtr.Zero; type = IntPtr.Zero;
pad1 = new Padding (); pad1 = new Padding ();
@ -176,7 +176,7 @@ namespace Gst.GLib {
} }
[Obsolete] [Obsolete]
public Value (GLib.Object obj, string prop_name, EnumWrapper wrap) public Value (Gst.GLib.Object obj, string prop_name, EnumWrapper wrap)
{ {
type = IntPtr.Zero; type = IntPtr.Zero;
pad1 = new Padding (); pad1 = new Padding ();
@ -194,11 +194,11 @@ namespace Gst.GLib {
type = IntPtr.Zero; type = IntPtr.Zero;
pad1 = new Padding (); pad1 = new Padding ();
pad2 = new Padding (); pad2 = new Padding ();
InitForProperty (GLib.Object.GetObject (obj), prop_name); InitForProperty (Gst.GLib.Object.GetObject (obj), prop_name);
g_value_set_boxed (ref this, val.Handle); g_value_set_boxed (ref this, val.Handle);
} }
public Value (string[] val) : this (new GLib.GType (g_strv_get_type ())) public Value (string[] val) : this (new Gst.GLib.GType (g_strv_get_type ()))
{ {
if (val == null) { if (val == null) {
g_value_set_boxed (ref this, IntPtr.Zero); g_value_set_boxed (ref this, IntPtr.Zero);
@ -207,13 +207,13 @@ namespace Gst.GLib {
IntPtr native_array = Marshal.AllocHGlobal ((val.Length + 1) * IntPtr.Size); IntPtr native_array = Marshal.AllocHGlobal ((val.Length + 1) * IntPtr.Size);
for (int i = 0; i < val.Length; i++) for (int i = 0; i < val.Length; i++)
Marshal.WriteIntPtr (native_array, i * IntPtr.Size, GLib.Marshaller.StringToPtrGStrdup (val[i])); Marshal.WriteIntPtr (native_array, i * IntPtr.Size, Gst.GLib.Marshaller.StringToPtrGStrdup (val[i]));
Marshal.WriteIntPtr (native_array, val.Length * IntPtr.Size, IntPtr.Zero); Marshal.WriteIntPtr (native_array, val.Length * IntPtr.Size, IntPtr.Zero);
g_value_set_boxed (ref this, native_array); g_value_set_boxed (ref this, native_array);
for (int i = 0; i < val.Length; i++) for (int i = 0; i < val.Length; i++)
GLib.Marshaller.Free (Marshal.ReadIntPtr (native_array, i * IntPtr.Size)); Gst.GLib.Marshaller.Free (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
Marshal.FreeHGlobal (native_array); Marshal.FreeHGlobal (native_array);
} }
@ -223,7 +223,7 @@ namespace Gst.GLib {
g_value_unset (ref this); g_value_unset (ref this);
} }
public void Init (GLib.GType gtype) public void Init (Gst.GLib.GType gtype)
{ {
g_value_init (ref this, gtype.Val); g_value_init (ref this, gtype.Val);
} }
@ -299,7 +299,7 @@ namespace Gst.GLib {
public static explicit operator string (Value val) public static explicit operator string (Value val)
{ {
IntPtr str = g_value_get_string (ref val); IntPtr str = g_value_get_string (ref val);
return str == IntPtr.Zero ? null : GLib.Marshaller.Utf8PtrToString (str); return str == IntPtr.Zero ? null : Gst.GLib.Marshaller.Utf8PtrToString (str);
} }
public static explicit operator ValueArray (Value val) public static explicit operator ValueArray (Value val)
@ -312,23 +312,23 @@ namespace Gst.GLib {
return g_value_get_pointer (ref val); return g_value_get_pointer (ref val);
} }
public static explicit operator GLib.Opaque (Value val) public static explicit operator Gst.GLib.Opaque (Value val)
{ {
return GLib.Opaque.GetOpaque (g_value_get_boxed (ref val), (Type) new GType (val.type), false); return Gst.GLib.Opaque.GetOpaque (g_value_get_boxed (ref val), (Type) new GType (val.type), false);
} }
public static explicit operator GLib.Boxed (Value val) public static explicit operator Gst.GLib.Boxed (Value val)
{ {
return new GLib.Boxed (g_value_get_boxed (ref val)); return new Gst.GLib.Boxed (g_value_get_boxed (ref val));
} }
public static explicit operator GLib.Object (Value val) public static explicit operator Gst.GLib.Object (Value val)
{ {
return GLib.Object.GetObject (g_value_get_object (ref val), false); return Gst.GLib.Object.GetObject (g_value_get_object (ref val), false);
} }
[Obsolete ("Replaced by GLib.Object cast")] [Obsolete ("Replaced by Gst.GLib.Object cast")]
public static explicit operator GLib.UnwrappedObject (Value val) public static explicit operator Gst.GLib.UnwrappedObject (Value val)
{ {
return new UnwrappedObject (g_value_get_object (ref val)); return new UnwrappedObject (g_value_get_object (ref val));
} }
@ -344,18 +344,18 @@ namespace Gst.GLib {
count++; count++;
string[] strings = new string[count]; string[] strings = new string[count];
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
strings[i] = GLib.Marshaller.Utf8PtrToString (Marshal.ReadIntPtr (native_array, i * IntPtr.Size)); strings[i] = Gst.GLib.Marshaller.Utf8PtrToString (Marshal.ReadIntPtr (native_array, i * IntPtr.Size));
return strings; return strings;
} }
object ToRegisteredType () { object ToRegisteredType () {
Type t = GLib.GType.LookupType (type); Type t = Gst.GLib.GType.LookupType (type);
ConstructorInfo ci = null; ConstructorInfo ci = null;
try { try {
while (ci == null && t != null) { while (ci == null && t != null) {
if (!t.IsAbstract) if (!t.IsAbstract)
ci = t.GetConstructor (new Type[] { typeof (GLib.Value) }); ci = t.GetConstructor (new Type[] { typeof (Gst.GLib.Value) });
if (ci == null) if (ci == null)
t = t.BaseType; t = t.BaseType;
} }
@ -370,12 +370,12 @@ namespace Gst.GLib {
} }
void FromRegisteredType (object val) { void FromRegisteredType (object val) {
Type t = GLib.GType.LookupType (type); Type t = Gst.GLib.GType.LookupType (type);
MethodInfo mi = null; MethodInfo mi = null;
try { try {
while (mi == null && t != null) { while (mi == null && t != null) {
mi = t.GetMethod ("SetGValue", new Type[] { Type.GetType ("GLib.Value&") }); mi = t.GetMethod ("SetGValue", new Type[] { Type.GetType ("Gst.GLib.Value&") });
if (mi != null && (mi.IsAbstract || mi.ReturnType != typeof (void))) if (mi != null && (mi.IsAbstract || mi.ReturnType != typeof (void)))
mi = null; mi = null;
if (mi == null) if (mi == null)
@ -390,7 +390,7 @@ namespace Gst.GLib {
object[] parameters = new object[] { this }; object[] parameters = new object[] { this };
mi.Invoke (val, parameters); mi.Invoke (val, parameters);
this = (GLib.Value) parameters[0]; this = (Gst.GLib.Value) parameters[0];
} }
object ToEnum () object ToEnum ()
@ -413,8 +413,8 @@ namespace Gst.GLib {
Type t = GType.LookupType (type); Type t = GType.LookupType (type);
if (t == null) if (t == null)
throw new Exception ("Unknown type " + new GType (type).ToString ()); throw new Exception ("Unknown type " + new GType (type).ToString ());
else if (t.IsSubclassOf (typeof (GLib.Opaque))) else if (t.IsSubclassOf (typeof (Gst.GLib.Opaque)))
return (GLib.Opaque) this; return (Gst.GLib.Opaque) this;
MethodInfo mi = t.GetMethod ("New", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); MethodInfo mi = t.GetMethod ("New", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
if (mi == null) if (mi == null)
@ -458,7 +458,7 @@ namespace Gst.GLib {
else if (type == ManagedValue.GType.Val) else if (type == ManagedValue.GType.Val)
return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this)); return ManagedValue.ObjectForWrapper (g_value_get_boxed (ref this));
else if (GType.Is (type, GType.Object)) else if (GType.Is (type, GType.Object))
return (GLib.Object) this; return (Gst.GLib.Object) this;
else if (GType.Is (type, GType.Boxed)) else if (GType.Is (type, GType.Boxed))
return ToBoxed (); return ToBoxed ();
else if (GType.LookupType (type) != null) else if (GType.LookupType (type) != null)
@ -492,9 +492,9 @@ namespace Gst.GLib {
else if (type == GType.Double.Val) else if (type == GType.Double.Val)
g_value_set_double (ref this, (double) value); g_value_set_double (ref this, (double) value);
else if (type == GType.String.Val) { else if (type == GType.String.Val) {
IntPtr native = GLib.Marshaller.StringToPtrGStrdup ((string)value); IntPtr native = Gst.GLib.Marshaller.StringToPtrGStrdup ((string)value);
g_value_set_string (ref this, native); g_value_set_string (ref this, native);
GLib.Marshaller.Free (native); Gst.GLib.Marshaller.Free (native);
} else if (type == GType.Pointer.Val) { } else if (type == GType.Pointer.Val) {
if (value.GetType () == typeof (IntPtr)) { if (value.GetType () == typeof (IntPtr)) {
g_value_set_pointer (ref this, (IntPtr) value); g_value_set_pointer (ref this, (IntPtr) value);
@ -515,10 +515,10 @@ namespace Gst.GLib {
g_value_set_boxed (ref this, wrapper); g_value_set_boxed (ref this, wrapper);
ManagedValue.ReleaseWrapper (wrapper); ManagedValue.ReleaseWrapper (wrapper);
} else if (GType.Is (type, GType.Object)) } else if (GType.Is (type, GType.Object))
if(value is GLib.Object) if(value is Gst.GLib.Object)
g_value_set_object (ref this, (value as GLib.Object).Handle); g_value_set_object (ref this, (value as Gst.GLib.Object).Handle);
else else
g_value_set_object (ref this, (value as GLib.GInterfaceAdapter).Handle); g_value_set_object (ref this, (value as Gst.GLib.GInterfaceAdapter).Handle);
else if (GType.Is (type, GType.Boxed)) { else if (GType.Is (type, GType.Boxed)) {
if (value is IWrapper) { if (value is IWrapper) {
g_value_set_boxed (ref this, ((IWrapper)value).Handle); g_value_set_boxed (ref this, ((IWrapper)value).Handle);
@ -527,7 +527,7 @@ namespace Gst.GLib {
IntPtr buf = Marshaller.StructureToPtrAlloc (value); IntPtr buf = Marshaller.StructureToPtrAlloc (value);
g_value_set_boxed (ref this, buf); g_value_set_boxed (ref this, buf);
Marshal.FreeHGlobal (buf); Marshal.FreeHGlobal (buf);
} else if (GLib.GType.LookupType (type) != null) { } else if (Gst.GLib.GType.LookupType (type) != null) {
FromRegisteredType (value); FromRegisteredType (value);
} else } else
throw new Exception ("Unknown type " + new GType (type).ToString ()); throw new Exception ("Unknown type " + new GType (type).ToString ());
@ -570,10 +570,10 @@ namespace Gst.GLib {
static extern bool g_type_check_value_holds (ref Value val, IntPtr gtype); static extern bool g_type_check_value_holds (ref Value val, IntPtr gtype);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_value_init (ref GLib.Value val, IntPtr gtype); static extern void g_value_init (ref Gst.GLib.Value val, IntPtr gtype);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_value_unset (ref GLib.Value val); static extern void g_value_unset (ref Gst.GLib.Value val);
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_value_set_boolean (ref Value val, bool data); static extern void g_value_set_boolean (ref Value val, bool data);

View File

@ -116,25 +116,25 @@ namespace Gst.GLib {
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_value_array_append (IntPtr raw, ref GLib.Value val); static extern void g_value_array_append (IntPtr raw, ref Gst.GLib.Value val);
public void Append (GLib.Value val) public void Append (Gst.GLib.Value val)
{ {
g_value_array_append (Handle, ref val); g_value_array_append (Handle, ref val);
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_value_array_insert (IntPtr raw, uint idx, ref GLib.Value val); static extern void g_value_array_insert (IntPtr raw, uint idx, ref Gst.GLib.Value val);
public void Insert (uint idx, GLib.Value val) public void Insert (uint idx, Gst.GLib.Value val)
{ {
g_value_array_insert (Handle, idx, ref val); g_value_array_insert (Handle, idx, ref val);
} }
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_value_array_prepend (IntPtr raw, ref GLib.Value val); static extern void g_value_array_prepend (IntPtr raw, ref Gst.GLib.Value val);
public void Prepend (GLib.Value val) public void Prepend (Gst.GLib.Value val)
{ {
g_value_array_prepend (Handle, ref val); g_value_array_prepend (Handle, ref val);
} }
@ -158,7 +158,7 @@ namespace Gst.GLib {
public object this [int index] { public object this [int index] {
get { get {
IntPtr raw_val = g_value_array_get_nth (Handle, (uint) index); IntPtr raw_val = g_value_array_get_nth (Handle, (uint) index);
return Marshal.PtrToStructure (raw_val, typeof (GLib.Value)); return Marshal.PtrToStructure (raw_val, typeof (Gst.GLib.Value));
} }
} }
@ -238,9 +238,9 @@ namespace Gst.GLib {
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr g_value_array_get_type (); static extern IntPtr g_value_array_get_type ();
public static GLib.GType GType { public static Gst.GLib.GType GType {
get { get {
return new GLib.GType (g_value_array_get_type ()); return new Gst.GLib.GType (g_value_array_get_type ());
} }
} }
} }

File diff suppressed because it is too large Load Diff