use of org.fagu.fmv.soft.exec.ReadLine in project fmv by f-agu.
the class FFExecutor method getErrReadLine.
/**
* @return
*/
protected ReadLine getErrReadLine() {
List<ReadLine> lines = new ArrayList<>();
if (progressReadLine != null) {
lines.add(progressReadLine);
}
ReadLine readLine = operation.getErrReadLine();
if (readLine != null) {
lines.add(readLine);
}
if (debug) {
lines.add(errDebugConsumer::accept);
}
if (!libLogReadLine.isEmpty()) {
lines.add(libLogReadLine);
}
if (!errReadLines.isEmpty()) {
lines.addAll(errReadLines);
}
if (!readLines.isEmpty()) {
lines.addAll(readLines);
}
return MultiReadLine.createWith(lines);
}
use of org.fagu.fmv.soft.exec.ReadLine in project fmv by f-agu.
the class FFExecutor method getOutReadLine.
// ************************************************
/**
* @return
*/
protected ReadLine getOutReadLine() {
if (operation.containsGlobalParameter("nostats")) {
return null;
}
List<ReadLine> lines = new ArrayList<>();
ReadLine readLine = operation.getOutReadLine();
if (readLine != null) {
lines.add(readLine);
}
if (debug) {
lines.add(outDebugConsumer::accept);
}
if (!outReadLines.isEmpty()) {
lines.addAll(outReadLines);
}
if (!readLines.isEmpty()) {
lines.addAll(readLines);
}
return MultiReadLine.createWith(lines);
}
use of org.fagu.fmv.soft.exec.ReadLine in project fmv by f-agu.
the class SoftExecutor method execute.
// -------------------------------------------------------------
/**
* @param executorService
* @return
* @throws IOException
*/
private <R> R execute(SoftExecutor.ForExec<R> forExec) throws IOException {
ExecListener execListener = new Proxifier<>(ExecListener.class).addAll(execListeners).proxify();
CommandLine commandLine = getCommandLine();
String cmdLineStr = CommandLineUtils.toLine(commandLine);
execListener.eventPrepare(cmdLineStr);
List<String> readLineList = new ArrayList<>();
ReadLine bufferedReadLine = new BufferedReadLine(readLineList);
FMVExecutor fmvExecutor = createFMVExecutor(execFile.getParentFile(), bufferedReadLine);
applyCustomizeExecutor(fmvExecutor);
return forExec.exec(fmvExecutor, commandLine, execListener, readLineList);
}
use of org.fagu.fmv.soft.exec.ReadLine in project fmv by f-agu.
the class PixelFormatGenerator method generate.
/**
* @throws IOException
*/
@Test
@Ignore
public void generate() throws IOException {
final Pattern PATTERN = Pattern.compile("(I|\\.)(O|\\.)(H|\\.)(P|\\.)(B|\\.)\\s(\\w+)\\s+(\\d+)\\s+(\\d+).*");
List<String> arguments = Arrays.asList("-v", "quiet", "-pix_fmts");
final Map<String, String> map = new TreeMap<String, String>();
ReadLine readLine = new ReadLine() {
/**
* @see org.fagu.fmv.utils.exec.ReadLine#read(java.lang.String)
*/
@Override
public void read(String line) {
StringBuilder buf = new StringBuilder();
buf.append("public static final PixelFormat ");
// System.out.println(line);
Matcher matcher = PATTERN.matcher(line);
if (matcher.matches()) {
boolean supportedInput = "I".equals(matcher.group(1));
boolean supportedOutput = "O".equals(matcher.group(2));
boolean hardwareAccelerated = "H".equals(matcher.group(3));
boolean paletted = "P".equals(matcher.group(4));
boolean bitstream = "B".equals(matcher.group(5));
String name = matcher.group(6);
int nbComponents = Integer.parseInt(matcher.group(7));
int bitsPerPixel = Integer.parseInt(matcher.group(8));
if (Character.isDigit(name.charAt(0))) {
buf.append('_');
}
buf.append(name.toUpperCase());
buf.append(" = new PixelFormat(").append(supportedInput).append(", ").append(supportedOutput).append(", ");
buf.append(hardwareAccelerated).append(", ").append(paletted).append(", ");
buf.append(bitstream).append(", \"").append(name).append("\", ");
buf.append(nbComponents).append(", ").append(bitsPerPixel).append(");");
map.put(name, buf.toString());
}
}
};
//
FFMpeg.search().withParameters(//
arguments).addCommonReadLine(//
readLine).execute();
for (String str : map.values()) {
System.out.println(str);
}
}
Aggregations