gstreamer/gstreamer-sharp/Bin.custom
2009-09-20 10:22:16 +02:00

63 lines
1.4 KiB
Text

public Bin () : this (null) {}
[DllImport ("libgstreamer-0.10.dll") ]
static extern bool gst_bin_add (IntPtr raw, IntPtr element);
[DllImport ("libgobject-2.0-0.dll") ]
static extern IntPtr g_object_ref (IntPtr raw);
public bool Add (Gst.Element element) {
bool raw_ret = gst_bin_add (Handle, element == null ? IntPtr.Zero : element.Handle);
if (raw_ret) {
// Incrmenting the refcount of the element.
g_object_ref (element.Handle);
}
bool ret = raw_ret;
return ret;
}
public bool Add (params Element[] elements) {
if (elements == null) {
return false;
}
foreach (Element element in elements) {
if (element == null || !Add (element)) {
return false;
}
}
return true;
}
public bool Remove (params Element[] elements) {
if (elements == null) {
return false;
}
foreach (Element element in elements) {
if (element == null || !Remove (element)) {
return false;
}
}
return true;
}
public Gst.Element GetByInterface (System.Type type) {
if (!type.IsSubclassOf (typeof (Gst.GLib.GInterfaceAdapter)))
return null;
Gst.GLib.GType t = (Gst.GLib.GType) type;
return GetByInterface (t);
}
public IEnumerable GetAllByInterface (System.Type type) {
if (!type.IsSubclassOf (typeof (Gst.GLib.GInterfaceAdapter)))
return null;
Gst.GLib.GType t = (Gst.GLib.GType) type;
return GetAllByInterface (t);
}