use of org.fagu.fmv.ffmpeg.operation.DefaultFFMPEGOperation 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);
});
}
Aggregations