X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fmeviz%2Fencoder%2FBitrateParameter.java;h=ec88b61b02288796db6e40594a3ac5525f08b032;hb=afb36656f930daf68be6a2f0fdb72f012fbdbe4e;hp=168f2b46fe01cb6043abd5ea43d7a5a81596fe01;hpb=b0c6e70ecdcb0dc55eed55ded5a82edc8bdfa729;p=meviz.git diff --git a/src/main/java/eu/svjatoslav/meviz/encoder/BitrateParameter.java b/src/main/java/eu/svjatoslav/meviz/encoder/BitrateParameter.java index 168f2b4..ec88b61 100755 --- a/src/main/java/eu/svjatoslav/meviz/encoder/BitrateParameter.java +++ b/src/main/java/eu/svjatoslav/meviz/encoder/BitrateParameter.java @@ -1,7 +1,7 @@ /* * 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. @@ -12,33 +12,34 @@ package eu.svjatoslav.meviz.encoder; import eu.svjatoslav.commons.commandline.parameterparser.ArgumentCount; import eu.svjatoslav.commons.commandline.parameterparser.Parameter; -public class BitrateParameter extends Parameter { +public class BitrateParameter extends Parameter { - public BitrateParameter(String description) { + static public enum bitrate { + NONE, LOW, MEDIUM, HIGH, COPY + } + + public BitrateParameter(final String description) { super(description, ArgumentCount.SINGLE); } @Override public String describeFormat() { - return "Target bitrate [LOW / MEDIUM / HIGH / COPY]"; + return "Target bitrate [NONE / LOW / MEDIUM / HIGH / COPY ]"; + }; + + @Override + public bitrate getValue() { + return bitrate.valueOf(arguments.get(0).toUpperCase()); } @Override public boolean validate(final String value) { try { - bitrate.valueOf(value); + bitrate.valueOf(value.toUpperCase()); } catch (final IllegalArgumentException exception) { return false; } return true; } - - static public enum bitrate { - LOW, MEDIUM, HIGH, COPY - }; - - public bitrate getValue() { - return bitrate.valueOf(getArgumentsAsStrings().get(0).toUpperCase()); - } }