/*
- * 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.
+ * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
*/
package eu.svjatoslav.meviz.encoder;
-import eu.svjatoslav.commons.commandline.parameterparser.ArgumentCount;
-import eu.svjatoslav.commons.commandline.parameterparser.Parameter;
-
-public class BitrateParameter extends Parameter {
-
- static public enum bitrate {
- LOW, MEDIUM, HIGH, COPY
- }
-
- public BitrateParameter(final String description) {
- super(description, ArgumentCount.SINGLE);
- }
-
- @Override
- public BitrateParameter addAliases(final String... aliasArray) {
- addAliasesProtected(aliasArray);
- return this;
- }
-
- @Override
- public String describeFormat() {
- return "Target bitrate [LOW / MEDIUM / HIGH / COPY]";
- };
-
- @Override
- public bitrate getValue() {
- return bitrate.valueOf(arguments.get(0).toUpperCase());
- }
-
- @Override
- public BitrateParameter setMandatory() {
- setMandatoryProtected();
- return this;
- }
-
- @Override
- public boolean validate(final String value) {
- try {
- bitrate.valueOf(value.toUpperCase());
- } catch (final IllegalArgumentException exception) {
- return false;
- }
-
- return true;
- }
+import eu.svjatoslav.commons.cli_helper.parameter_parser.ArgumentCount;
+import eu.svjatoslav.commons.cli_helper.parameter_parser.Parameter;
+
+public class BitrateParameter extends Parameter<BitrateParameter.Bitrate, BitrateParameter> {
+
+ public BitrateParameter(final String description) {
+ super(description, ArgumentCount.SINGLE);
+ }
+
+ @Override
+ public String describeFormat() {
+ return "Target bitrate [NONE / LOW / MEDIUM / HIGH / COPY / LOSSLESS]";
+ }
+
+ @Override
+ public Bitrate getValue() {
+ return Bitrate.valueOf(arguments.get(0).toUpperCase());
+ }
+
+ @Override
+ public boolean validate(final String value) {
+ try {
+ Bitrate.valueOf(value.toUpperCase());
+ } catch (final IllegalArgumentException exception) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public enum Bitrate {
+ NONE, LOW, MEDIUM, HIGH, COPY, LOSSLESS
+ }
}