Refactored to remove code duplication.
[meviz.git] / src / main / java / eu / svjatoslav / meviz / encoder / converters / AvconvAudio.java
1 /*
2  * Meviz - Various tools collection to work with multimedia.
3  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.meviz.encoder.converters;
11
12 import java.io.File;
13 import java.util.List;
14
15 import eu.svjatoslav.meviz.encoder.EncodingOptions;
16
17 public class AvconvAudio extends AbstractConverter {
18
19         @Override
20         public String getCommand(final File inputFile, final File targetFile,
21                         final EncodingOptions options) {
22
23                 final String codecParams = "-b:a 192k";
24
25                 return "avconv -i \"" + inputFile.getAbsolutePath() + "\" "
26                                 + codecParams + " \"" + targetFile.getAbsolutePath() + "\"";
27         }
28
29         @Override
30         public List<String> getSourceFileExtensions() {
31                 return toList("ogg", "wav");
32         }
33
34         @Override
35         public List<String> getTargetFileExtensions() {
36                 return toList("mp3");
37         }
38
39         @Override
40         public boolean isTerminalMandatory() {
41                 return false;
42         }
43
44 }