mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-04 15:36:35 +00:00
aa7bb8fa1c
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.
75 lines
1.6 KiB
Text
Executable file
75 lines
1.6 KiB
Text
Executable file
[DllImport ("libgstreamer-0.10.dll") ]
|
|
static extern int gst_iterator_next (IntPtr iterator, out IntPtr elem);
|
|
[DllImport ("libgstreamer-0.10.dll") ]
|
|
static extern void gst_iterator_resync (IntPtr iterator);
|
|
|
|
private class Enumerator : IEnumerator {
|
|
Iterator iterator;
|
|
Hashtable seen = new Hashtable ();
|
|
|
|
private object current = null;
|
|
public object Current {
|
|
get {
|
|
return current;
|
|
}
|
|
}
|
|
|
|
public bool MoveNext () {
|
|
IntPtr raw_ret;
|
|
bool retry = false;
|
|
|
|
if (iterator.Handle == IntPtr.Zero)
|
|
return false;
|
|
|
|
do {
|
|
int ret = gst_iterator_next (iterator.Handle, out raw_ret);
|
|
switch (ret) {
|
|
case 0:
|
|
return false;
|
|
case 1:
|
|
if (seen.Contains (raw_ret)) {
|
|
retry = true;
|
|
break;
|
|
}
|
|
seen.Add (raw_ret, null);
|
|
current = Gst.GLib.Object.GetObject (raw_ret, true);
|
|
return true;
|
|
case 2:
|
|
gst_iterator_resync (iterator.Handle);
|
|
retry = true;
|
|
break;
|
|
default:
|
|
case 3:
|
|
throw new Exception ("Error while iterating pads");
|
|
}
|
|
} while (retry);
|
|
|
|
return false;
|
|
}
|
|
|
|
public void Reset () {
|
|
seen.Clear ();
|
|
if (iterator.Handle != IntPtr.Zero)
|
|
gst_iterator_resync (iterator.Handle);
|
|
}
|
|
|
|
public Enumerator (Iterator iterator) {
|
|
this.iterator = iterator;
|
|
}
|
|
}
|
|
|
|
private Enumerator enumerator = null;
|
|
|
|
public IEnumerator GetEnumerator () {
|
|
if (this.enumerator == null)
|
|
this.enumerator = new Enumerator (this);
|
|
return this.enumerator;
|
|
}
|
|
|
|
[DllImport ("libgstreamer-0.10.dll") ]
|
|
static extern void gst_iterator_free (IntPtr iterator);
|
|
|
|
~Iterator () {
|
|
if (Raw != IntPtr.Zero)
|
|
gst_iterator_free (Raw);
|
|
}
|