2009-04-30 14:54:39 +00:00
|
|
|
public object this[string property] {
|
|
|
|
get {
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Value v = GetProperty (property);
|
2009-05-26 07:48:22 +00:00
|
|
|
object o = v.Val;
|
|
|
|
v.Dispose ();
|
|
|
|
return o;
|
2009-09-20 08:19:49 +00:00
|
|
|
} set {
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Value v = new Gst.GLib.Value (this, property);
|
2009-05-12 13:32:15 +00:00
|
|
|
v.Val = value;
|
|
|
|
SetProperty (property, v);
|
|
|
|
v.Dispose ();
|
2009-04-30 14:54:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-12 12:31:57 +00:00
|
|
|
[DllImport ("libgobject-2.0-0.dll") ]
|
|
|
|
static extern IntPtr g_object_class_list_properties (IntPtr klass, out uint n_properties);
|
|
|
|
|
|
|
|
[DllImport ("libgobject-2.0-0.dll") ]
|
2009-05-12 13:50:04 +00:00
|
|
|
static extern IntPtr g_object_class_find_property (IntPtr gclass, IntPtr name);
|
2009-05-12 12:31:57 +00:00
|
|
|
|
2009-05-12 13:50:04 +00:00
|
|
|
public PropertyInfo GetPropertyInfo (string property) {
|
|
|
|
IntPtr klass = Marshal.ReadIntPtr (Handle);
|
2009-05-12 12:31:57 +00:00
|
|
|
|
2009-08-05 14:57:20 +00:00
|
|
|
IntPtr native_property = Gst.GLib.Marshaller.StringToPtrGStrdup (property);
|
2009-05-12 13:50:04 +00:00
|
|
|
IntPtr pspec = g_object_class_find_property (klass, native_property);
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Marshaller.Free (native_property);
|
2009-05-12 12:31:57 +00:00
|
|
|
|
2009-05-12 13:50:04 +00:00
|
|
|
if (pspec == IntPtr.Zero)
|
|
|
|
throw new ArgumentException ("Unknown property");
|
2009-05-12 12:31:57 +00:00
|
|
|
|
2009-05-12 13:50:04 +00:00
|
|
|
return new PropertyInfo (pspec);
|
|
|
|
}
|
2009-05-12 12:31:57 +00:00
|
|
|
|
2009-10-03 08:14:03 +00:00
|
|
|
public bool HasProperty (string property) {
|
|
|
|
IntPtr klass = Marshal.ReadIntPtr (Handle);
|
|
|
|
|
|
|
|
IntPtr native_property = Gst.GLib.Marshaller.StringToPtrGStrdup (property);
|
|
|
|
IntPtr pspec = g_object_class_find_property (klass, native_property);
|
|
|
|
Gst.GLib.Marshaller.Free (native_property);
|
|
|
|
|
|
|
|
return pspec != IntPtr.Zero;
|
|
|
|
}
|
|
|
|
|
2009-05-12 12:31:57 +00:00
|
|
|
public PropertyInfo[] Properties {
|
|
|
|
get {
|
|
|
|
uint n_properties;
|
|
|
|
IntPtr klass = Marshal.ReadIntPtr (Handle);
|
|
|
|
IntPtr properties = g_object_class_list_properties (klass, out n_properties);
|
|
|
|
|
|
|
|
PropertyInfo[] ret = new PropertyInfo[n_properties];
|
|
|
|
for (int i = 0; i < n_properties; i++) {
|
|
|
|
IntPtr pspec_ptr = Marshal.ReadIntPtr (properties, i * IntPtr.Size);
|
2009-05-12 13:50:04 +00:00
|
|
|
ret[i] = new PropertyInfo (pspec_ptr);
|
2009-05-12 12:31:57 +00:00
|
|
|
}
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Marshaller.Free (properties);
|
2009-05-12 12:31:57 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-05 18:59:24 +00:00
|
|
|
public void Connect (string signal, SignalHandler handler) {
|
2009-04-30 14:54:39 +00:00
|
|
|
DynamicSignal.Connect (this, signal, handler);
|
|
|
|
}
|
|
|
|
|
2009-06-05 18:59:24 +00:00
|
|
|
public void Disconnect (string signal, SignalHandler handler) {
|
|
|
|
DynamicSignal.Disconnect (this, signal, handler);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Connect (string signal, Delegate handler) {
|
|
|
|
DynamicSignal.Connect (this, signal, handler);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Disconnect (string signal, Delegate handler) {
|
2009-04-30 14:54:39 +00:00
|
|
|
DynamicSignal.Disconnect (this, signal, handler);
|
|
|
|
}
|
|
|
|
|
|
|
|
public object Emit (string signal, params object[] parameters) {
|
|
|
|
return DynamicSignal.Emit (this, signal, parameters);
|
|
|
|
}
|
|
|
|
|
2009-09-20 08:19:49 +00:00
|
|
|
[DllImport ("libgstreamer-0.10.dll") ]
|
2009-09-11 07:31:17 +00:00
|
|
|
static extern IntPtr gst_object_ref_sink (IntPtr raw);
|
2006-09-07 16:24:30 +00:00
|
|
|
|
2009-04-23 19:12:31 +00:00
|
|
|
protected override IntPtr Raw {
|
2009-04-07 09:27:20 +00:00
|
|
|
get {
|
2009-04-23 19:12:31 +00:00
|
|
|
return base.Raw;
|
2009-09-20 08:19:49 +00:00
|
|
|
} set {
|
2009-04-23 19:12:31 +00:00
|
|
|
if (value != IntPtr.Zero) {
|
2009-09-11 07:31:17 +00:00
|
|
|
gst_object_ref_sink (value);
|
2009-04-23 19:12:31 +00:00
|
|
|
}
|
|
|
|
base.Raw = value;
|
2009-04-07 09:27:20 +00:00
|
|
|
}
|
|
|
|
}
|
2006-09-07 16:24:30 +00:00
|
|
|
|
|
|
|
|
2009-09-20 08:19:49 +00:00
|
|
|
[DllImport ("libgstreamer-0.10.dll") ]
|
2009-04-23 19:12:31 +00:00
|
|
|
static extern bool gst_object_set_parent (IntPtr raw, IntPtr parent);
|
2009-09-20 08:19:49 +00:00
|
|
|
[DllImport ("libgstreamer-0.10.dll") ]
|
2009-04-23 19:12:31 +00:00
|
|
|
static extern IntPtr gst_object_get_parent (IntPtr raw);
|
|
|
|
|
|
|
|
public Gst.Object Parent {
|
|
|
|
set {
|
|
|
|
bool raw_ret = gst_object_set_parent (Handle, value == null ? IntPtr.Zero : value.Handle);
|
|
|
|
if (!raw_ret)
|
|
|
|
throw new ApplicationException ();
|
|
|
|
}
|
|
|
|
get {
|
|
|
|
IntPtr raw_ret = gst_object_get_parent (Handle);
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.Object ret = Gst.GLib.Object.GetObject (raw_ret, true) as Gst.Object;
|
2009-04-23 19:12:31 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-25 10:12:35 +00:00
|
|
|
[DllImport ("gstreamersharpglue-0.10.dll") ]
|
2009-04-23 19:12:31 +00:00
|
|
|
extern static uint gstsharp_gst_object_get_lock_offset ();
|
|
|
|
|
|
|
|
static uint lock_offset = gstsharp_gst_object_get_lock_offset ();
|
2009-04-27 09:32:58 +00:00
|
|
|
internal IntPtr LockPtr {
|
2009-04-23 19:12:31 +00:00
|
|
|
get {
|
|
|
|
unsafe {
|
|
|
|
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + lock_offset);
|
|
|
|
return (*raw_ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport ("libglib-2.0-0.dll") ]
|
|
|
|
static extern void g_mutex_lock (IntPtr mutex);
|
|
|
|
[DllImport ("libglib-2.0-0.dll") ]
|
|
|
|
static extern void g_mutex_unlock (IntPtr mutex);
|
|
|
|
[DllImport ("libglib-2.0-0.dll") ]
|
|
|
|
static extern bool g_mutex_trylock (IntPtr mutex);
|
|
|
|
|
|
|
|
public void Lock () {
|
|
|
|
g_mutex_lock (LockPtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Unlock () {
|
|
|
|
g_mutex_unlock (LockPtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool TryLock () {
|
|
|
|
return g_mutex_trylock (LockPtr);
|
|
|
|
}
|
|
|
|
|
2009-09-20 08:19:49 +00:00
|
|
|
[DllImport ("libgstreamer-0.10.dll") ]
|
2009-04-23 19:12:31 +00:00
|
|
|
static extern bool gst_object_check_uniqueness (IntPtr list, IntPtr name);
|
|
|
|
|
|
|
|
public static bool CheckUniqueness (Gst.Object[] objects, string name) {
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.List list = new Gst.GLib.List (objects, typeof (Gst.Object), false, false);
|
|
|
|
IntPtr native_name = Gst.GLib.Marshaller.StringToPtrGStrdup (name);
|
2009-04-23 19:12:31 +00:00
|
|
|
bool raw_ret = gst_object_check_uniqueness (list.Handle, native_name);
|
|
|
|
bool ret = raw_ret;
|
2009-08-05 14:57:20 +00:00
|
|
|
Gst.GLib.Marshaller.Free (native_name);
|
2009-04-23 19:12:31 +00:00
|
|
|
return ret;
|
|
|
|
}
|