From 1652ccdd294fb982628c4acb412206ad2bca1023 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Tue, 17 Dec 2013 19:26:50 +0200 Subject: [PATCH] wav to flac conversion --- .../meviz/encoder/FormatsRegistry.java | 8 ++-- .../meviz/encoder/converters/Wav2flac.java | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 src/main/java/eu/svjatoslav/meviz/encoder/converters/Wav2flac.java diff --git a/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java b/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java index 9555e6e..3c294f1 100755 --- a/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java +++ b/src/main/java/eu/svjatoslav/meviz/encoder/FormatsRegistry.java @@ -23,6 +23,7 @@ import eu.svjatoslav.meviz.encoder.converters.Ogg2Mp3; import eu.svjatoslav.meviz.encoder.converters.Ogg2Wav; import eu.svjatoslav.meviz.encoder.converters.Png2Tiff; import eu.svjatoslav.meviz.encoder.converters.Tiff2Png; +import eu.svjatoslav.meviz.encoder.converters.Wav2flac; import eu.svjatoslav.meviz.encoder.converters.Wav2mp3; public class FormatsRegistry { @@ -45,6 +46,7 @@ public class FormatsRegistry { // audio conversion registerEncoder(new Ogg2Wav()); registerEncoder(new Wav2mp3()); + registerEncoder(new Wav2flac()); registerEncoder(new Ogg2Mp3()); } @@ -56,15 +58,13 @@ public class FormatsRegistry { final ArrayList encoders = new ArrayList(); - for (final Converter encoder : this.encoders) { - if (encoder.getSourceFileExtension().equals(sourceFormatLowerCase)) { + for (final Converter encoder : this.encoders) + if (encoder.getSourceFileExtension().equals(sourceFormatLowerCase)) if (encoder.getTargetFileExtension().equals( targetFormatLowerCase)) { encoders.add(encoder); return encoders; } - } - } return encoders; } diff --git a/src/main/java/eu/svjatoslav/meviz/encoder/converters/Wav2flac.java b/src/main/java/eu/svjatoslav/meviz/encoder/converters/Wav2flac.java new file mode 100644 index 0000000..9a09d25 --- /dev/null +++ b/src/main/java/eu/svjatoslav/meviz/encoder/converters/Wav2flac.java @@ -0,0 +1,41 @@ +/* + * 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. + */ + +package eu.svjatoslav.meviz.encoder.converters; + +import java.io.File; + +import eu.svjatoslav.meviz.encoder.EncodingOptions; + +public class Wav2flac implements Converter { + + @Override + public String getCommand(final File inputFile, final File targetFile, + final EncodingOptions options) { + + return "flac -8 \"" + inputFile.getAbsolutePath() + "\" -o \"" + + targetFile.getAbsolutePath() + "\""; + } + + @Override + public String getSourceFileExtension() { + return "wav"; + } + + @Override + public String getTargetFileExtension() { + return "flac"; + } + + @Override + public boolean isTerminalMandatory() { + return false; + } + +} -- 2.20.1