gstreamer/gstreamer-sharp/Bin.custom

64 lines
1.3 KiB
Text
Raw Normal View History

public Bin () : this (null) {}
[DllImport("libgstreamer-0.10.dll") ]
2009-04-07 09:27:20 +00:00
static extern bool gst_bin_add (IntPtr raw, IntPtr element);
2009-04-30 19:48:05 +00:00
[DllImport ("libgobject-2.0-0.dll") ]
static extern IntPtr g_object_ref (IntPtr raw);
2009-04-07 09:27:20 +00:00
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);
2009-04-07 09:27:20 +00:00
}
bool ret = raw_ret;
return ret;
}
public bool Add (params Element[] elements) {
2009-04-07 09:27:20 +00:00
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) {
2009-04-07 09:27:20 +00:00
if (elements == null) {
return false;
}
foreach (Element element in elements) {
if (element == null || !Remove (element)) {
return false;
}
2009-04-07 09:27:20 +00:00
}
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);
}