use of org.fagu.fmv.ffmpeg.filter.graph.FilterGraph in project fmv by f-agu.
the class FilterGraphUI method show.
/**
* @param builder
*/
public static void show(Operation<?, ?> operation) {
FilterGraph filterGraph = operation.getFilterGraph();
FilterGraphUI graphTest = new FilterGraphUI(operation, filterGraph);
filterGraph.discover(() -> graphTest);
graphTest.display();
}
use of org.fagu.fmv.ffmpeg.filter.graph.FilterGraph in project fmv by f-agu.
the class AutoMaps method oneStreamByType.
/**
* @param types
* @return
*/
public static AutoMap oneStreamByType(Set<Type> types, FilterNaming filterNaming) {
return new AutoMap() {
@Override
public boolean useLabels() {
return true;
}
@Override
public Set<Label> find(Operation<?, ?> operation) {
FilterGraph filterGraph = FilterGraph.of(operation);
// filterGraph.discover(() -> Visitors.checkSameTypes());
MapSet<Label, Type> mapSet = MultiValueMaps.hashMapHashSet();
filterGraph.discover(() -> Visitors.lastLabelWithType(mapSet));
Map<Type, Label> chdirMap = new HashMap<>(4);
for (Entry<Label, Set<Type>> entry : mapSet.entrySet()) {
for (Type type : entry.getValue()) {
if (chdirMap.putIfAbsent(type, entry.getKey()) != null) {
throw new RuntimeException("Type " + type + " already defined in an other output filter: " + mapSet);
}
}
}
for (Type type : types) {
// missing some types ?
if (!chdirMap.containsKey(type)) {
InputParameters inputParameters = operation.getInputParameters();
for (IOEntity ioEntity : inputParameters.getIOEntities()) {
Processor<?> processor = inputParameters.getProcessor(ioEntity);
if (processor instanceof InputProcessor) {
try {
MovieMetadatas movieMetadatas = ((InputProcessor) processor).getMovieMetadatas();
if (movieMetadatas.contains(type)) {
chdirMap.put(type, Label.input(processor.getIndex(), type));
break;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}
}
return new HashSet<>(chdirMap.values());
}
};
}
Aggregations