mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 23:16:38 +00:00
e1775ea341
Also update docs and fix indention
69 lines
1.4 KiB
Text
69 lines
1.4 KiB
Text
|
|
[DllImport ("gstreamersharpglue-0.10") ]
|
|
private extern static uint gstsharp_gst_bin_get_children_offset();
|
|
|
|
static uint children_offset = gstsharp_gst_bin_get_children_offset();
|
|
|
|
public Element [] Children {
|
|
get {
|
|
GLib.List list;
|
|
|
|
unsafe {
|
|
IntPtr* raw_ptr = (IntPtr*) ( ( (byte*) Handle) + children_offset);
|
|
list = new GLib.List ( (*raw_ptr));
|
|
}
|
|
|
|
Element [] result = new Element[list.Count];
|
|
|
|
for (int i = list.Count - 1; i >= 0; i--) {
|
|
result[i] = list[i] as Element;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
static extern bool gst_bin_add (IntPtr raw, IntPtr element);
|
|
|
|
[DllImport ("gobject-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 AddMany (params Element[] elements) {
|
|
if (elements == null) {
|
|
return false;
|
|
}
|
|
|
|
foreach (Element element in elements) {
|
|
if (element == null || !Add (element)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public bool RemoveMany (params Element[] elements) {
|
|
if (elements == null) {
|
|
return false;
|
|
}
|
|
|
|
foreach (Element element in elements) {
|
|
if (element == null || !Remove (element)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|