/*
- * Meviz - Various tools collection to work with multimedia.
- * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public License
- * as published by the Free Software Foundation.
+ * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
*/
+
package eu.svjatoslav.meviz.encoder;
-import java.io.IOException;
import java.util.ArrayList;
public class EncodingPlan {
- public ArrayList<EncodingTask> encodingTasks = new ArrayList<EncodingTask>();
-
- public void execute(final EncodingOptions encodingOptions) throws IOException {
- for (final EncodingTask task : encodingTasks) {
-
- try {
- String command = task.getCommand(encodingOptions);
-
- if (task.doUseTerminal()) {
- command = "xterm -e '" + command + "'";
- }
+ private final ArrayList<EncodingTask> encodingTasks = new ArrayList<>();
- System.out.println("Executing command: " + command);
+ public void execute(final EncodingOptions encodingOptions) {
- final Runtime run = Runtime.getRuntime();
- Process pr;
- pr = run.exec(new String[] { "/bin/bash", "-c", command });
-
- pr.waitFor();
-
- } catch (final Exception e) {
- System.out.println(e.toString());
- e.printStackTrace();
- }
-
- }
+ for (final EncodingTask task : encodingTasks)
+ task.execute(encodingOptions);
}
public void scheduleTask(final EncodingTask encodingTask) {
encodingTasks.add(encodingTask);
- };
+ }
}