gstreamer/gstreamer-sharp/Bin.custom
Sebastian Dröge aa7bb8fa1c Use internal glib-sharp copy everywhere and make it work side-by-side with real glib-sharp
glib-sharp will only get a new release with the new API that we need for
3.0 in a year or something. Instead of waiting a year before we can release
something we now have our own internal copy of glib-sharp trunk that will
be dropped once glib-sharp 3.0 is released.

Everything is now compilable and working without any additional patches.
2009-08-05 16:57:20 +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);
}