@Override public void visitSources(IElementVisitor visitor) { if (visitor == null) return; Pointer pIterator = gst_bin_iterate_sources(ptr); if (pIterator == null || pIterator == Pointer.NULL) return; boolean done = false; PointerByReference ref = new PointerByReference(); while (!done) { // This will increase the ref counter -- so we need to create an object // that doesn't increase the ref counter when it's built so on dispose(), // the ref count will be zero. switch (IteratorResult.fromNative(gst_iterator_next(pIterator, ref))) { case OK: // Passing true here tells it to increase the ref count // when building a new element from the pointer. IElement element = Element.from(ref.getValue(), true); boolean ret = visitor.visit(this, element); element.unref(); done = !ret; break; case Resync: gst_iterator_resync(pIterator); break; case Error: case Done: case Unknown: done = true; break; default: done = true; break; } } gst_iterator_free(pIterator); }
@Override public IElement elementFromName(String name) { Pointer p = gst_bin_get_by_name(ptr, name); if (p == null || p == Pointer.NULL) return null; return Element.from(p); }
@Override public boolean addAndLinkMany(IElement... elements) { if (!addMany(elements)) return false; return Element.linkMany(elements); }