use of android.filterpacks.base.FrameBranch in project android_frameworks_base by DirtyUnicorns.
the class FilterGraph method connectPorts.
private void connectPorts() {
int branchId = 1;
for (Entry<OutputPort, LinkedList<InputPort>> connection : mPreconnections.entrySet()) {
OutputPort outputPort = connection.getKey();
LinkedList<InputPort> inputPorts = connection.getValue();
if (inputPorts.size() == 1) {
outputPort.connectTo(inputPorts.get(0));
} else if (mAutoBranchMode == AUTOBRANCH_OFF) {
throw new RuntimeException("Attempting to connect " + outputPort + " to multiple " + "filter ports! Enable auto-branching to allow this.");
} else {
if (mLogVerbose)
Log.v(TAG, "Creating branch for " + outputPort + "!");
FrameBranch branch = null;
if (mAutoBranchMode == AUTOBRANCH_SYNCED) {
branch = new FrameBranch("branch" + branchId++);
} else {
throw new RuntimeException("TODO: Unsynced branches not implemented yet!");
}
KeyValueMap branchParams = new KeyValueMap();
branch.initWithAssignmentList("outputs", inputPorts.size());
addFilter(branch);
outputPort.connectTo(branch.getInputPort("in"));
Iterator<InputPort> inputPortIter = inputPorts.iterator();
for (OutputPort branchOutPort : ((Filter) branch).getOutputPorts()) {
branchOutPort.connectTo(inputPortIter.next());
}
}
}
mPreconnections.clear();
}
Aggregations