2009-04-07 09:27:20 +00:00
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
static extern bool gst_bin_add (IntPtr raw, IntPtr element);
|
|
|
|
|
2009-04-30 19:48:05 +00:00
|
|
|
[DllImport ("libgobject-2.0-0.dll") ]
|
2009-04-23 19:12:31 +00:00
|
|
|
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.
|
2009-04-23 19:12:31 +00:00
|
|
|
g_object_ref (element.Handle);
|
2009-04-07 09:27:20 +00:00
|
|
|
}
|
|
|
|
bool ret = raw_ret;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-05-01 15:08:07 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-05-01 15:08:07 +00:00
|
|
|
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;
|
2006-05-20 22:35:40 +00:00
|
|
|
}
|
2009-04-07 09:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2006-06-21 07:25:57 +00:00
|
|
|
|
2009-05-01 15:08:07 +00:00
|
|
|
public Gst.Element GetByInterface (System.Type type) {
|
|
|
|
if (!type.IsSubclassOf (typeof (GLib.GInterfaceAdapter)))
|
|
|
|
return null;
|
|
|
|
|
|
|
|
GLib.GType t = (GLib.GType) type;
|
|
|
|
|
|
|
|
return GetByInterface (t);
|
|
|
|
}
|
|
|
|
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
static extern IntPtr gst_bin_iterate_elements (IntPtr bin);
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
static extern IntPtr gst_bin_iterate_recurse (IntPtr bin);
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
static extern IntPtr gst_bin_iterate_sinks (IntPtr bin);
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
static extern IntPtr gst_bin_iterate_sorted (IntPtr bin);
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
static extern IntPtr gst_bin_iterate_sources (IntPtr bin);
|
|
|
|
[DllImport ("gstreamer-0.10.dll") ]
|
|
|
|
static extern IntPtr gst_bin_iterate_all_by_interface (IntPtr bin, IntPtr gtype);
|
|
|
|
|
|
|
|
public IEnumerable Elements {
|
|
|
|
get {
|
2009-05-09 17:29:40 +00:00
|
|
|
return new Enumerable (gst_bin_iterate_elements (Handle));
|
2009-05-01 15:08:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable ElementsRecurse {
|
|
|
|
get {
|
2009-05-09 17:29:40 +00:00
|
|
|
return new Enumerable (gst_bin_iterate_recurse (Handle));
|
2009-05-01 15:08:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable ElementsSorted {
|
|
|
|
get {
|
2009-05-09 17:29:40 +00:00
|
|
|
return new Enumerable (gst_bin_iterate_sorted (Handle));
|
2009-05-01 15:08:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable SinkElements {
|
|
|
|
get {
|
2009-05-09 17:29:40 +00:00
|
|
|
return new Enumerable (gst_bin_iterate_sinks (Handle));
|
2009-05-01 15:08:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable SourceElements {
|
|
|
|
get {
|
2009-05-09 17:29:40 +00:00
|
|
|
return new Enumerable (gst_bin_iterate_sources (Handle));
|
2009-05-01 15:08:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable GetAllByInterface (GLib.GType type) {
|
2009-05-09 17:29:40 +00:00
|
|
|
return new Enumerable (gst_bin_iterate_all_by_interface (Handle, type.Val));
|
2009-05-01 15:08:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public IEnumerable GetAllByInterface (System.Type type) {
|
|
|
|
if (!type.IsSubclassOf (typeof (GLib.GInterfaceAdapter)))
|
|
|
|
return null;
|
|
|
|
|
|
|
|
GLib.GType t = (GLib.GType) type;
|
|
|
|
|
|
|
|
return GetAllByInterface (t);
|
|
|
|
}
|