Search in sources :

Example 1 with InputParameters

use of org.fagu.fmv.ffmpeg.operation.InputParameters in project fmv by f-agu.

the class FFMPEGExecutorBuilder method addMediaInput.

/**
 * @param input
 * @return
 */
public InputProcessor addMediaInput(MediaInput input) {
    if (input instanceof Demuxer) {
        return demux((Demuxer<?>) input);
    }
    Processor<?> processor = defaultFFMPEGOperation.getProcessor(input);
    if (processor != null && !(processor instanceof InputProcessor)) {
        throw new IllegalArgumentException("Already defined: " + input);
    }
    InputParameters inputParameters = defaultFFMPEGOperation.getInputParameters();
    return inputParameters.addInput(input);
}
Also used : Demuxer(org.fagu.fmv.ffmpeg.format.Demuxer) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) InputParameters(org.fagu.fmv.ffmpeg.operation.InputParameters)

Example 2 with InputParameters

use of org.fagu.fmv.ffmpeg.operation.InputParameters in project fmv by f-agu.

the class MockFFMPEGExecutorBuilder method mock.

/**
 * @param movieMetadatasSupplier
 * @param commandExecute
 */
public static void mock(Supplier<Function<String, MovieMetadatas>> movieMetadatasSupplier, final Consumer<String> commandExecute) {
    FFMPEGExecutorBuilder.setFactory(() -> {
        final FFExecutorFactory ffExecutorFactory = new FFExecutorFactory() {

            @Override
            public <R> FFExecutor<R> create(Operation<R, ?> operation, FFMPEGExecutorBuilder ffmpegExecutorBuilder) {
                return new FFExecutor<R>(operation) {

                    /**
                     * @see org.fagu.fmv.ffmpeg.executor.FFExecutor#execute()
                     */
                    @Override
                    public Executed<R> execute() throws IOException {
                        commandExecute.accept(getCommandLine());
                        return null;
                    }
                };
            }
        };
        Require require = new Require(false);
        DefaultFFMPEGOperation<?> defaultFFMPEGOperation = new DefaultFFMPEGOperation<Object>(new FilterNaming(), require);
        defaultFFMPEGOperation.getInputParameters().setInputProcessorFactory(new InputProcessorFactory() {

            /**
             * @see org.fagu.fmv.ffmpeg.operation.InputProcessorFactory#create(org.fagu.fmv.ffmpeg.operation.InputParameters,
             *      org.fagu.fmv.ffmpeg.operation.MediaInput, int, org.fagu.fmv.ffmpeg.require.Require)
             */
            @Override
            public InputProcessor create(InputParameters inputParameters, MediaInput input, int index, Require require) {
                return new MyInputProcessor(movieMetadatasSupplier.get(), inputParameters, input, index, require);
            }
        });
        return new MyFFMPEGExecutorBuilder(ffExecutorFactory, defaultFFMPEGOperation);
    });
}
Also used : FFExecutorFactory(org.fagu.fmv.ffmpeg.executor.FFExecutorFactory) FFMPEGExecutorBuilder(org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder) Require(org.fagu.fmv.ffmpeg.require.Require) InputProcessor(org.fagu.fmv.ffmpeg.operation.InputProcessor) Operation(org.fagu.fmv.ffmpeg.operation.Operation) DefaultFFMPEGOperation(org.fagu.fmv.ffmpeg.operation.DefaultFFMPEGOperation) DefaultFFMPEGOperation(org.fagu.fmv.ffmpeg.operation.DefaultFFMPEGOperation) FFExecutor(org.fagu.fmv.ffmpeg.executor.FFExecutor) InputProcessorFactory(org.fagu.fmv.ffmpeg.operation.InputProcessorFactory) FilterNaming(org.fagu.fmv.ffmpeg.filter.FilterNaming) InputParameters(org.fagu.fmv.ffmpeg.operation.InputParameters) MediaInput(org.fagu.fmv.ffmpeg.operation.MediaInput)

Aggregations

InputParameters (org.fagu.fmv.ffmpeg.operation.InputParameters)2 InputProcessor (org.fagu.fmv.ffmpeg.operation.InputProcessor)2 FFExecutor (org.fagu.fmv.ffmpeg.executor.FFExecutor)1 FFExecutorFactory (org.fagu.fmv.ffmpeg.executor.FFExecutorFactory)1 FFMPEGExecutorBuilder (org.fagu.fmv.ffmpeg.executor.FFMPEGExecutorBuilder)1 FilterNaming (org.fagu.fmv.ffmpeg.filter.FilterNaming)1 Demuxer (org.fagu.fmv.ffmpeg.format.Demuxer)1 DefaultFFMPEGOperation (org.fagu.fmv.ffmpeg.operation.DefaultFFMPEGOperation)1 InputProcessorFactory (org.fagu.fmv.ffmpeg.operation.InputProcessorFactory)1 MediaInput (org.fagu.fmv.ffmpeg.operation.MediaInput)1 Operation (org.fagu.fmv.ffmpeg.operation.Operation)1 Require (org.fagu.fmv.ffmpeg.require.Require)1