gstreamer/gstreamer-sharp/Bin.custom
Maarten Bosmans 663d3e047d Replace custom Enumerable code with generator GstIterator bindings
The custom properties that return a IEnumerable are replaced by generated
properties that return an Iterator.  Most of the code in Iterator.cs has
moved to Iterator.custom to implement IEnumerable.
2009-06-21 10:29:24 +02:00

63 lines
1.3 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 (GLib.GInterfaceAdapter)))
return null;
GLib.GType t = (GLib.GType) type;
return GetByInterface (t);
}
public IEnumerable GetAllByInterface (System.Type type) {
if (!type.IsSubclassOf (typeof (GLib.GInterfaceAdapter)))
return null;
GLib.GType t = (GLib.GType) type;
return GetAllByInterface (t);
}