From be717efd804c0e83882161a937578cc74bd963c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 16 Mar 2013 12:23:34 +0100 Subject: [PATCH] Add switch for highest quality encoding. --- .../sonitus/data/filter/LameMp3Encoder.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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(); } -- 2.7.4