use of org.fagu.fmv.core.exec.Identifiable in project fmv by f-agu.
the class FadeAudioVideo method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
if (args.length != 4) {
help();
return;
}
// TEST
Optional<Identifiable> identifiableOpt = BaseIdentifiable.findById(project, args[1]);
if (!identifiableOpt.isPresent()) {
println("not found: " + args[1]);
return;
}
FadeType fadeType = FadeType.valueOf(args[0].toUpperCase());
Time startTime = Time.parse(args[2]);
Duration duration = Duration.parse(args[2]);
Identifiable identifiable = identifiableOpt.get();
FadeAudioVideoFilterExec filterExec = new FadeAudioVideoFilterExec(project, fadeType, startTime, duration);
filterExec.add(identifiable);
}
use of org.fagu.fmv.core.exec.Identifiable in project fmv by f-agu.
the class GenericFilterExec method populateWithIdentifiables.
// *************************************************************
/**
* @param filterComplex
* @param cache
* @param builder
* @return
*/
protected Set<Type> populateWithIdentifiables(FilterComplexBase filterComplex, Cache cache, FFMPEGExecutorBuilder builder) {
Set<Type> undeclaredTypes = new HashSet<>(filterComplex.getTypes());
for (Identifiable identifiable : getIdentifiableChildren()) {
if (identifiable.isExecutable()) {
File file = getProject().getFileCache().getFile((Executable) identifiable, cache);
InputProcessor inputProcessor = builder.addMediaInputFile(file);
addInputIntoFilter(filterComplex, inputProcessor, undeclaredTypes);
} else if (identifiable.isSource()) {
FilterInput filterInput = ((Source) identifiable).createAndAdd(builder);
addInputIntoFilter(filterComplex, filterInput, undeclaredTypes);
} else if (identifiable.isFilterExec()) {
Filter inFilter = ((FilterExec) identifiable).makeFilter(builder, cache);
addInputIntoFilter(filterComplex, (FilterComplexBase) inFilter, undeclaredTypes);
}
}
return undeclaredTypes;
}
use of org.fagu.fmv.core.exec.Identifiable in project fmv by f-agu.
the class ExecList method displayIdentifiable.
// *******************************************************
/**
* @param identifiables
* @param paddingSize
*/
private void displayIdentifiable(List<? extends Identifiable> identifiables, int paddingSize) {
for (Identifiable identifiable : identifiables) {
StringBuilder buf = new StringBuilder(100);
buf.append(StringUtils.rightPad(identifiable.getId(), ID_WIDTH));
buf.append(StringUtils.rightPad(typesToString(identifiable.getTypes()), TYPE_WIDTH));
buf.append(StringUtils.rightPad(identifiable.getDuration().flatMap(d -> Optional.of(d == null ? "-" : d.toString())).get(), TIME_WIDTH));
buf.append(StringUtils.leftPad("", paddingSize));
buf.append(identifiable.toString());
println(buf.toString());
displayIdentifiable(identifiable.getIdentifiableChildren(), paddingSize + 3);
}
}
use of org.fagu.fmv.core.exec.Identifiable in project fmv by f-agu.
the class ToExecutable method run.
/**
* @see org.fagu.fmv.cli.Command#run(java.lang.String[])
*/
@Override
public void run(String[] args) {
if (args.length != 1) {
help();
return;
}
String id = args[0];
if (".".equals(id)) {
environnement.setCurrentExecutable(null);
return;
}
Optional<Identifiable> opt = BaseIdentifiable.findById(project, id);
if (!opt.isPresent()) {
println("ID not found: " + id);
return;
}
Identifiable identifiable = opt.get();
if (!(identifiable instanceof Executable)) {
println("ID is not an executable: " + id);
return;
}
Executable executable = (Executable) identifiable;
environnement.setCurrentExecutable(executable);
}
Aggregations