Search in sources :

Example 1 with FilterExec

use of org.fagu.fmv.core.exec.FilterExec 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;
}
Also used : FilterExec(org.fagu.fmv.core.exec.FilterExec) Type(org.fagu.fmv.ffmpeg.operation.Type) Filter(org.fagu.fmv.ffmpeg.filter.Filter) FilterInput(org.fagu.fmv.ffmpeg.filter.FilterInput) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) File(java.io.File) HashSet(java.util.HashSet) Identifiable(org.fagu.fmv.core.exec.Identifiable)

Example 2 with FilterExec

use of org.fagu.fmv.core.exec.FilterExec 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;
}
Also used : FilterExec(org.fagu.fmv.core.exec.FilterExec) Filter(org.fagu.fmv.ffmpeg.filter.Filter) FilterInput(org.fagu.fmv.ffmpeg.filter.FilterInput) ArrayList(java.util.ArrayList) FilterComplexBase(org.fagu.fmv.ffmpeg.filter.FilterComplexBase) Executable(org.fagu.fmv.core.exec.Executable) File(java.io.File) Source(org.fagu.fmv.core.exec.Source)

Aggregations

File (java.io.File)2 FilterExec (org.fagu.fmv.core.exec.FilterExec)2 Filter (org.fagu.fmv.ffmpeg.filter.Filter)2 FilterInput (org.fagu.fmv.ffmpeg.filter.FilterInput)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Executable (org.fagu.fmv.core.exec.Executable)1 Identifiable (org.fagu.fmv.core.exec.Identifiable)1 Source (org.fagu.fmv.core.exec.Source)1 FilterComplexBase (org.fagu.fmv.ffmpeg.filter.FilterComplexBase)1 InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)1 Type (org.fagu.fmv.ffmpeg.operation.Type)1