public object this[string property] { get { if (PropertyExists (property)) { using (GLib.Value v = GetProperty (property)) { return v.Val; } } else throw new PropertyNotFoundException (); } set { if (PropertyExists (property)) { if (value == null) { throw new ArgumentNullException (); } var type = value.GetType (); var gtype = (GLib.GType)type; if (gtype == null) { throw new Exception ("Could not find a GType for type " + type.FullName); } GLib.Value v = new GLib.Value ((GLib.GType)value.GetType ()); v.Val = value; SetProperty (property, v); v.Dispose (); } else throw new PropertyNotFoundException (); } }
public void Add(Gst.TagMergeMode mode, string tag, object value) { if (!Tag.Exists (tag)) throw new ArgumentException (String.Format ("Invalid tag name '{0}'", tag)); GLib.Value v = new GLib.Value (value); AddValue (mode, tag, v); v.Dispose (); }
static extern void g_value_set_string (ref Value val, IntPtr data);
public void SetGValue (ref Gst.GLib.Value val) { foreach (object o in content) { Gst.GLib.Value v = new Gst.GLib.Value (o); gst_value_array_append_value (ref val, ref v); v.Dispose (); } }
static extern uint g_value_get_flags (ref Value val);
static extern uint g_value_get_uint (ref Value val);
static extern IntPtr g_value_get_pointer (ref Value val);
static extern IntPtr g_value_get_object (ref Value val);
static extern sbyte g_value_get_char (ref Value val);
static extern byte g_value_get_uchar (ref Value val);
static extern bool g_value_get_boolean (ref Value val);
static extern void g_value_set_flags (ref Value val, uint data);
static extern void g_value_set_enum (ref Value val, int data);
static extern void g_value_set_ulong (ref Value val, uint data);
static extern void g_value_set_ulong (ref Value val, UIntPtr data);
static extern UIntPtr g_value_get_ulong (ref Value val);
static extern int g_value_get_ulong_as_uint (ref Value val);
static extern IntPtr g_value_get_boxed (ref Value val);
static extern IntPtr g_value_get_param (ref Value val);
static extern double g_value_get_double (ref Value val);
static extern IntPtr g_value_get_string (ref Value val);
static extern float g_value_get_float (ref Value val);
static extern int g_value_get_enum (ref Value val);
static extern int g_value_get_int (ref Value val);
public void SetGValue (ref Gst.GLib.Value val) { Gst.GLib.Value min = new Gst.GLib.Value (Min); Gst.GLib.Value max = new Gst.GLib.Value (Max); gst_value_set_fraction_range (ref val, ref min, ref max); min.Dispose (); max.Dispose (); }
static extern long g_value_get_int64 (ref Value val);
static extern IntPtr g_value_get_long (ref Value val);
static extern ulong g_value_get_uint64 (ref Value val);
public PropertyInfo (IntPtr pspec_ptr) { 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); this.name = Gst.GLib.Marshaller.Utf8PtrToString (name); this.nick = Gst.GLib.Marshaller.Utf8PtrToString (nick); this.blurb = Gst.GLib.Marshaller.Utf8PtrToString (blurb); 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 */ this.gtype = new Gst.GLib.GType (pspec.ValueType); this.type = (System.Type) this.gtype; this.dflt = this.min = this.max = null; try { Gst.GLib.Value v = new Gst.GLib.Value (new Gst.GLib.GType (pspec.ValueType)); 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 { 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)); 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) {} }
static extern void g_value_set_pointer (ref Value val, IntPtr data);