Add name to all controlled components.
[sonitus.git] / src / main / java / net / pterodactylus / sonitus / data / filter / LameMp3Decoder.java
index aae01fe..7493b3e 100644 (file)
@@ -17,7 +17,7 @@
 
 package net.pterodactylus.sonitus.data.filter;
 
-import net.pterodactylus.sonitus.data.Format;
+import net.pterodactylus.sonitus.data.Metadata;
 
 import com.google.common.collect.ImmutableList;
 
@@ -32,20 +32,30 @@ public class LameMp3Decoder extends ExternalMp3Decoder {
        private final String binary;
 
        /** Whether to swap bytes in the decoded output. */
-       private final boolean swapBytes;
+       private boolean swapBytes;
 
        /**
         * Creates a new LAME MP3 decoder.
         *
         * @param binary
         *              The location of the binary
+        */
+       public LameMp3Decoder(String binary) {
+               super("LAME Decoder");
+               this.binary = binary;
+       }
+
+       /**
+        * Sets whether to swap bytes on the decoded output.
+        *
         * @param swapBytes
         *              {@code true} to swap the decoded bytes, {@code false} to use platform
         *              endianness
+        * @return This MP3 decoder
         */
-       public LameMp3Decoder(String binary, boolean swapBytes) {
-               this.binary = binary;
+       public LameMp3Decoder swapBytes(boolean swapBytes) {
                this.swapBytes = swapBytes;
+               return this;
        }
 
        //
@@ -53,13 +63,13 @@ public class LameMp3Decoder extends ExternalMp3Decoder {
        //
 
        @Override
-       protected String binary(Format format) {
+       protected String binary(Metadata metadata) {
                return binary;
        }
 
        @Override
-       protected Iterable<String> parameters(Format format) {
-               ImmutableList.Builder parameters = ImmutableList.builder();
+       protected Iterable<String> parameters(Metadata metadata) {
+               ImmutableList.Builder<String> parameters = ImmutableList.builder();
                parameters.add("--mp3input").add("--decode").add("-t");
                if (swapBytes) {
                        parameters.add("-x");