2009-05-12 12:31:57 +00:00
|
|
|
using System;
|
2009-05-12 13:50:04 +00:00
|
|
|
using System.Runtime.InteropServices;
|
2009-08-05 14:57:20 +00:00
|
|
|
using Gst.GLib;
|
2009-05-12 12:31:57 +00:00
|
|
|
|
|
|
|
namespace Gst {
|
|
|
|
public struct PropertyInfo {
|
|
|
|
internal string name;
|
|
|
|
public string Name {
|
|
|
|
get {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal string nick;
|
|
|
|
public string Nick {
|
|
|
|
get {
|
|
|
|
return nick;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal string blurb;
|
|
|
|
public string Blurb {
|
|
|
|
get {
|
|
|
|
return blurb;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal bool readable;
|
|
|
|
public bool Readable {
|
|
|
|
get {
|
|
|
|
return readable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal bool writeable;
|
|
|
|
public bool Writeable {
|
|
|
|
get {
|
|
|
|
return writeable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal bool controllable;
|
|
|
|
public bool Controllable {
|
|
|
|
get {
|
|
|
|
return controllable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal System.Type type;
|
|
|
|
public System.Type Type {
|
|
|
|
get {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-05 14:57:20 +00:00
|
|
|
internal Gst.GLib.GType gtype;
|
|
|
|
public Gst.GLib.GType GType {
|
2009-05-12 13:26:50 +00:00
|
|
|
get {
|
|
|
|
return gtype;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-12 12:31:57 +00:00
|
|
|
internal object dflt;
|
|
|
|
public object Default {
|
|
|
|
get {
|
|
|
|
return dflt;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal object min;
|
|
|
|
public object Min {
|
|
|
|
get {
|
|
|
|
return min;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal object max;
|
|
|
|
public object Max {
|
|
|
|
get {
|
|
|
|
return max;
|
|
|
|
}
|
|
|
|
}
|
2009-05-12 13:50:04 +00:00
|
|
|
|
|
|
|
[DllImport ("libgobject-2.0-0.dll") ]
|
|
|
|
static extern IntPtr g_param_spec_get_name (IntPtr pspec);
|
|
|
|
|
|
|
|
[DllImport ("libgobject-2.0-0.dll") ]
|
|
|
|
static extern IntPtr g_param_spec_get_nick (IntPtr pspec);
|
|
|
|
|
|
|
|
[DllImport ("libgobject-2.0-0.dll") ]
|
|
|
|
static extern IntPtr g_param_spec_get_blurb (IntPtr pspec);
|
|
|
|
|
|
|
|
[DllImport ("libgobject-2.0-0.dll") ]
|
2009-08-05 14:57:20 +00:00
|
|
|
static extern void g_param_value_set_default (IntPtr pspec, ref Gst.GLib.Value val);
|
2009-05-12 13:50:04 +00:00
|
|
|
|
2009-05-25 10:12:35 +00:00
|
|
|
[DllImport ("gstreamersharpglue-0.10.dll") ]
|
2009-08-05 14:57:20 +00:00
|
|
|
static extern bool gstsharp_g_param_spec_get_range (IntPtr pspec, ref Gst.GLib.Value min, ref Gst.GLib.Value max);
|
2009-05-12 13:50:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
[StructLayout (LayoutKind.Sequential) ]
|
|
|
|
struct GTypeInstance {
|
|
|
|
public IntPtr g_class;
|
|
|
|
}
|
|
|
|
|
|
|
|
[StructLayout (LayoutKind.Sequential) ]
|
|
|
|
struct GParamSpec {
|
|
|
|
public GTypeInstance instance;
|
|
|
|
IntPtr name;
|
|
|
|
public int Flags;
|
|
|
|
public IntPtr ValueType;
|
|
|
|
public IntPtr OwnerType;
|
|
|
|
}
|
|
|
|
|
2009-05-13 14:46:57 +00:00
|
|
|
public PropertyInfo (IntPtr pspec_ptr) {
|
2009-05-12 13:50:04 +00:00
|
|
|
GParamSpec pspec = (GParamSpec) Marshal.PtrToStructure (pspec_ptr, typeof (GParamSpec));
|
|
|
|
IntPtr name = g_param_spec_get_name (pspec_ptr);
|
|
|
|
IntPtr nick = g_param_spec_get_nick (pspec_ptr);
|
|
|
|
IntPtr blurb = g_param_spec_get_blurb (pspec_ptr);
|
|
|
|
|
2009-08-05 14:57:20 +00:00
|
|
|
this.name = Gst.GLib.Marshaller.Utf8PtrToString (name);
|
|
|
|
this.nick = Gst.GLib.Marshaller.Utf8PtrToString (nick);
|
|
|
|
this.blurb = Gst.GLib.Marshaller.Utf8PtrToString (blurb);
|
2009-05-12 13:50:04 +00:00
|
|
|
|
|
|
|
this.readable = ( (pspec.Flags & (1 << 0)) != 0);
|
|
|
|
this.writeable = ( (pspec.Flags & (1 << 1)) != 0);
|
|
|
|
this.controllable = ( (pspec.Flags & (1 << 9)) != 0);
|
|
|
|
/* TODO: Add more flags later, like the mutable flags */
|
|
|
|
|
2009-08-05 14:57:20 +00:00
|
|
|
this.gtype = new Gst.GLib.GType (pspec.ValueType);
|
2009-05-12 13:50:04 +00:00
|
|
|
this.type = (System.Type) this.gtype;
|
|
|
|
|
|
|
|
this.dflt = this.min = this.max = null;
|
|
|
|
|
|
|
|
try {
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Value v = new Gst.GLib.Value (new Gst.GLib.GType (pspec.ValueType));
|
2009-05-12 13:50:04 +00:00
|
|
|
g_param_value_set_default (pspec_ptr, ref v);
|
|
|
|
this.dflt = v.Val;
|
|
|
|
v.Dispose ();
|
|
|
|
|
|
|
|
if (EnumInfo.IsEnumType (this.gtype)) {
|
|
|
|
EnumInfo ei = new EnumInfo (this.gtype);
|
|
|
|
this.min = ei.Min;
|
|
|
|
this.max = ei.Max;
|
|
|
|
} else {
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Value min = new Gst.GLib.Value (new Gst.GLib.GType (pspec.ValueType));
|
|
|
|
Gst.GLib.Value max = new Gst.GLib.Value (new Gst.GLib.GType (pspec.ValueType));
|
2009-05-12 13:50:04 +00:00
|
|
|
if (gstsharp_g_param_spec_get_range (pspec_ptr, ref min, ref max)) {
|
|
|
|
this.min = (object) min.Val;
|
|
|
|
this.max = (object) max.Val;
|
|
|
|
}
|
|
|
|
min.Dispose ();
|
|
|
|
max.Dispose ();
|
|
|
|
}
|
|
|
|
} catch (Exception) {}
|
|
|
|
}
|
2009-05-12 12:31:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|