use of org.fagu.fmv.ffmpeg.filter.impl.ScaleMode in project fmv by f-agu.
the class Libx264NotDisibleBy2FFExecFallback method prepare.
/**
* @see org.fagu.fmv.ffmpeg.executor.FFExecFallback#prepare(org.fagu.fmv.ffmpeg.executor.FFEnv, java.io.IOException)
*/
@Override
public boolean prepare(FFEnv ffEnv, IOException ioException) throws IOException {
FFExecutor<Object> executor = ffEnv.getExecutor();
AbstractOperation<?, ?> operation = (AbstractOperation<?, ?>) ffEnv.getOperation();
for (String line : executor.getOutputReadLine().getLines()) {
if (line.startsWith("[libx264 @") && line.contains(" not divisible by 2")) {
for (Filter filter : operation.getFilters()) {
if (filter instanceof Scale) {
Scale scale = (Scale) filter;
Size size = scale.getSize();
ScaleMode scaleMode = scale.getScaleMode();
if (size != null && scaleMode != null) {
Size newSize = resize(size);
if (newSize == null) {
return false;
}
scale.set(size, scaleMode);
return true;
}
}
}
}
}
return false;
}
Aggregations