Updated dependencies
[meviz.git] / src / main / java / eu / svjatoslav / meviz / encoder / BitrateParameter.java
1 /*
2  * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
3  * This project is released under Creative Commons Zero (CC0) license.
4  */
5
6 package eu.svjatoslav.meviz.encoder;
7
8 import eu.svjatoslav.commons.cli_helper.parameter_parser.ArgumentCount;
9 import eu.svjatoslav.commons.cli_helper.parameter_parser.Parameter;
10
11 public class BitrateParameter extends Parameter<BitrateParameter.Bitrate, BitrateParameter> {
12
13     public BitrateParameter(final String description) {
14         super(description, ArgumentCount.SINGLE);
15     }
16
17     @Override
18     public String describeFormat() {
19         return "Target bitrate [NONE / LOW / MEDIUM / HIGH / COPY / LOSSLESS]";
20     }
21
22     @Override
23     public Bitrate getValue() {
24         return Bitrate.valueOf(arguments.get(0).toUpperCase());
25     }
26
27     @Override
28     public boolean validate(final String value) {
29         try {
30             Bitrate.valueOf(value.toUpperCase());
31         } catch (final IllegalArgumentException exception) {
32             return false;
33         }
34
35         return true;
36     }
37
38     public enum Bitrate {
39         NONE, LOW, MEDIUM, HIGH, COPY, LOSSLESS
40     }
41 }