use terminal when copying memory card
[meviz.git] / src / main / java / eu / svjatoslav / meviz / encoder / EncodingTask.java
index 535f8f7..b5dbe08 100755 (executable)
@@ -1,7 +1,7 @@
 /*
  * 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.
@@ -29,13 +29,15 @@ public class EncodingTask {
 
        private boolean useTerminal;
 
-       public EncodingTask(final File source, final File destination,
-                       final eu.svjatoslav.meviz.encoder.converters.AbstractConverter converter) {
+       private final String targetFormat;
+
+       public EncodingTask(final File source, final File target, final AbstractConverter converter,
+                       final String targetFormat) {
 
                this.source = source;
-               target = destination;
+               this.target = target;
                this.converter = converter;
-
+               this.targetFormat = targetFormat;
        }
 
        /**
@@ -68,11 +70,10 @@ public class EncodingTask {
 
                        System.out.println("Executing command: " + command);
 
-                       final Runtime run = Runtime.getRuntime();
-                       Process pr;
-                       pr = run.exec(new String[] { "/bin/bash", "-c", command });
+                       final Runtime runtime = Runtime.getRuntime();
+                       final Process process = runtime.exec(new String[] { "/bin/bash", "-c", command });
 
-                       pr.waitFor();
+                       process.waitFor();
 
                } catch (final Exception e) {
                        System.out.println(e.toString());
@@ -82,7 +83,7 @@ public class EncodingTask {
        }
 
        public String getCommand(final EncodingOptions encodingOptions) {
-               return converter.getCommand(source, target, encodingOptions);
+               return converter.getCommand(source, target, encodingOptions, targetFormat);
        }
 
        /**