mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 23:40:26 +00:00
parse_bitrate: use map for special vals
This commit is contained in:
13
src/main.cpp
13
src/main.cpp
@@ -503,8 +503,13 @@ static void *capture_thread(void *arg)
|
||||
}
|
||||
|
||||
static bool parse_bitrate(char *optarg, long long int *bitrate) {
|
||||
if (strcmp(optarg, "auto") == 0) {
|
||||
*bitrate = RATE_AUTO;
|
||||
map<const char *, long long int> bitrate_spec_map = {
|
||||
{ "auto", RATE_AUTO },
|
||||
{ "unlimited", RATE_UNLIMITED },
|
||||
};
|
||||
|
||||
if (auto it = bitrate_spec_map.find(optarg); it != bitrate_spec_map.end()) {
|
||||
*bitrate = it->second;
|
||||
return true;
|
||||
}
|
||||
if (strcmp(optarg, "help") == 0) {
|
||||
@@ -519,10 +524,6 @@ static bool parse_bitrate(char *optarg, long long int *bitrate) {
|
||||
"\n";
|
||||
return true;
|
||||
}
|
||||
if (strcmp(optarg, "unlimited") == 0) {
|
||||
*bitrate = RATE_UNLIMITED;
|
||||
return true;
|
||||
}
|
||||
bool force = false, fixed = false;
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (optarg[strlen(optarg) - 1] == '!' ||
|
||||
|
||||
Reference in New Issue
Block a user