use of org.fagu.fmv.ffmpeg.filter.FilterComplexBase in project fmv by f-agu.
the class GenericFilterExec method makeFilter.
/**
* @see org.fagu.fmv.core.exec.FilterExec#makeFilter(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder, Cache)
*/
@Override
public Filter makeFilter(FFMPEGExecutorBuilder builder, Cache cache) {
Filter filter = getFilter();
// parameters
ObjectInvoker.invoke(filter, attributeMap);
FilterComplexBase filterComplex = filter instanceof FilterComplexBase ? (FilterComplexBase) filter : FilterComplex.create(filter);
builder.filter(filterComplex);
Set<Type> undeclaredTypes = populateWithIdentifiables(filterComplex, cache, builder);
if (!undeclaredTypes.isEmpty()) {
undeclaredTypes(undeclaredTypes, filterComplex, cache, builder);
}
return filterComplex;
}
use of org.fagu.fmv.ffmpeg.filter.FilterComplexBase in project fmv by f-agu.
the class GenericExecutable method populateWithIdentifiables.
// *******************************************************
/**
* @param toFile
* @param cache
* @param builder
*/
protected List<FilterInput> populateWithIdentifiables(File toFile, Cache cache, FFMPEGExecutorBuilder builder) {
List<FilterInput> filterInputs = new ArrayList<>();
// executable
for (Executable executable : executables) {
File file = getProject().getFileCache().getFile(executable, cache);
filterInputs.add(builder.addMediaInputFile(file));
}
// source
for (Source source : sources) {
filterInputs.add(source.createAndAdd(builder));
}
// filters
for (FilterExec filterExec : getFilters()) {
Filter filter = filterExec.makeFilter(builder, cache);
builder.filter(filter);
if (filter instanceof FilterComplexBase) {
filterInputs.add((FilterComplexBase) filter);
}
}
return filterInputs;
}
use of org.fagu.fmv.ffmpeg.filter.FilterComplexBase in project fmv by f-agu.
the class AbstractOperation method add.
/**
* @see org.fagu.fmv.ffmpeg.operation.Operation#add(Filter)
*/
@Override
public boolean add(Filter filter) {
if (rawFilters.contains(filter)) {
return false;
}
OperationListener operationListener = operationListener();
operationListener.eventPreAddFilter(this, filter);
addRawFilter(filter);
if (filter instanceof FilterComplexBase) {
if (!containsFilterComplex) {
containsFilterComplex = true;
List<Filter> newFilters = new ArrayList<>();
for (Filter f : filters) {
FilterComplex fc = FilterComplex.create(f);
newFilters.add(fc);
addRawFilter(fc);
}
filters = newFilters;
}
filters.add(filter);
} else {
if (containsFilterComplex) {
FilterComplex fc = FilterComplex.create(filter);
filters.add(fc);
addRawFilter(fc);
} else {
filters.add(filter);
}
}
if (filter instanceof LibLog) {
libLogs.add((LibLog) filter);
}
operationListener.eventPostAddFilter(this, filter);
return true;
}
Aggregations