use of org.fagu.fmv.ffmpeg.utils.AvailableHelp in project fmv by f-agu.
the class Filters method runnable.
/**
* @return
*/
private static Runnable runnable() {
return () -> {
LinesFFMPEGOperation operation = new LinesFFMPEGOperation();
operation.addParameter("-filters");
try {
FFExecutor<List<String>> executor = new FFExecutor<>(operation);
Consumer<FilterHelp> cacheConsumer = HELP_CACHE.consumer();
final Pattern PATTERN = Pattern.compile("([AVN\\|]+)-\\>([AVN\\|]+)\\s+(\\w+.*)");
Function<String, FilterHelp> factory = name -> new FilterHelp(name);
Consumer<FilterHelp> consumer = help -> {
Matcher matcher = PATTERN.matcher(help.getText());
if (matcher.matches()) {
help.inputType = IOType.parse(matcher.group(1));
help.outputType = IOType.parse(matcher.group(2));
help.description = matcher.group(3);
cacheConsumer.accept(help);
} else {
throw new RuntimeException("Filter description unparsable: " + help.getText());
}
};
AvailableHelp<FilterHelp> availableHelp = AvailableHelp.create();
availableHelp.title().legend(true).values(factory, consumer).parse(executor.execute().getResult());
} catch (IOException e) {
throw new RuntimeException(e);
}
};
}
Aggregations