From: David ‘Bombe’ Roden Date: Sat, 16 Mar 2013 11:23:34 +0000 (+0100) Subject: Add switch for highest quality encoding. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=be717efd804c0e83882161a937578cc74bd963c9;p=sonitus.git Add switch for highest quality encoding. --- diff --git a/src/main/java/net/pterodactylus/sonitus/data/filter/LameMp3Encoder.java b/src/main/java/net/pterodactylus/sonitus/data/filter/LameMp3Encoder.java index c88d939..66abb10 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/filter/LameMp3Encoder.java +++ b/src/main/java/net/pterodactylus/sonitus/data/filter/LameMp3Encoder.java @@ -60,6 +60,9 @@ public class LameMp3Encoder extends ExternalMp3Encoder { /** The bitrate to encode to. */ private final Optional bitrate; + /** Whether to use highest quality encoding. */ + private boolean hq = false; + /** * Creates a new LAME MP3 encoder. * @@ -110,6 +113,18 @@ public class LameMp3Encoder extends ExternalMp3Encoder { this.bitrate = (bitrate < 0) ? Optional.absent() : Optional.of(bitrate); } + /** + * Sets whether to use highest quality encoding. + * + * @param hq + * {@code true} to use highest quality encoding, {@code false} otherwise + * @return This MP3 encoder + */ + public LameMp3Encoder hq(boolean hq) { + this.hq = hq; + return this; + } + // // EXTERNALFILTER METHODS // @@ -138,7 +153,9 @@ public class LameMp3Encoder extends ExternalMp3Encoder { parameters.add(String.valueOf(bitrate.get())); } parameters.add("-p"); - parameters.add("-q").add("0"); + if (hq) { + parameters.add("-q").add("0"); + } parameters.add("-").add("-"); return parameters.build(); }