use of org.fagu.fmv.ffmpeg.filter.FilterComplexBase.In in project fmv by f-agu.
the class FilterGraph method of.
/**
* @param operation
* @param filterNaming
* @return
*/
public static FilterGraph of(Operation<?, ?> operation) {
FilterGraph filterGraph = new FilterGraph(operation.getFilterNaming());
List<FilterComplex> filterComplexs = operation.getFilterComplexs();
for (FilterComplex filterComplex : filterComplexs) {
// System.out.println(filterComplex);
Map<IOKey, In> inputMap = filterComplex.getInputMap();
if (inputMap.isEmpty()) {
for (MediaInput mediaInput : filterComplex.getInputs()) {
if (mediaInput instanceof GeneratedSource) {
filterGraph.roots.add(filterComplex);
for (OutputKey outputKey : filterComplex.getOutputKeys()) {
filterGraph.byOutMap.add(outputKey.getLabel(), filterComplex);
}
}
}
} else {
for (Entry<IOKey, In> entry : inputMap.entrySet()) {
FilterInput filterInput = entry.getValue().getFilterInput();
for (OutputKey inputKey : filterInput.getOutputKeys()) {
filterGraph.byInMap.add(inputKey.getLabel(), filterComplex);
}
if (filterInput instanceof InputProcessor) {
filterGraph.roots.add(filterComplex);
}
for (OutputKey outputKey : filterComplex.getOutputKeys()) {
filterGraph.byOutMap.add(outputKey.getLabel(), filterComplex);
}
}
}
}
return filterGraph;
}
use of org.fagu.fmv.ffmpeg.filter.FilterComplexBase.In in project fmv by f-agu.
the class FilterGraphUI method addRoot.
// **************************************************
/**
*/
private void addRoot() {
Map<InputProcessor, Node> inputProcessorNodeMap = new HashMap<>();
operation.getInputProcessorStream().forEach(ip -> {
for (OutputKey outputKey : ip.getOutputKeys()) {
Node node = createRootNode(ip, outputKey);
inputProcessorNodeMap.put(ip, node);
}
});
for (FilterComplex rootFC : filterGraph.getRoots()) {
Map<IOKey, In> inputMap = rootFC.getInputMap();
if (!inputMap.isEmpty()) {
for (Entry<IOKey, In> entry : inputMap.entrySet()) {
FilterInput filterInput = entry.getValue().getFilterInput();
if (filterInput instanceof InputProcessor) {
Node node = inputProcessorNodeMap.get(filterInput);
Edge edge = graph.addEdge(node.getId() + "-" + rootFC.toString(), createOrGetNode(rootFC), node);
// edge.addAttribute("ui.label", values);
}
}
}
}
}
Aggregations