Search in sources :

Example 1 with FilterComplexBase

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;
}
Also used : Type(org.fagu.fmv.ffmpeg.operation.Type) Filter(org.fagu.fmv.ffmpeg.filter.Filter) FilterComplexBase(org.fagu.fmv.ffmpeg.filter.FilterComplexBase)

Example 2 with FilterComplexBase

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;
}
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)

Example 3 with FilterComplexBase

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;
}
Also used : FilterComplex(org.fagu.fmv.ffmpeg.filter.FilterComplex) Filter(org.fagu.fmv.ffmpeg.filter.Filter) ArrayList(java.util.ArrayList) FilterComplexBase(org.fagu.fmv.ffmpeg.filter.FilterComplexBase)

Aggregations

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