mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 01:40:28 +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) {
|
static bool parse_bitrate(char *optarg, long long int *bitrate) {
|
||||||
if (strcmp(optarg, "auto") == 0) {
|
map<const char *, long long int> bitrate_spec_map = {
|
||||||
*bitrate = RATE_AUTO;
|
{ "auto", RATE_AUTO },
|
||||||
|
{ "unlimited", RATE_UNLIMITED },
|
||||||
|
};
|
||||||
|
|
||||||
|
if (auto it = bitrate_spec_map.find(optarg); it != bitrate_spec_map.end()) {
|
||||||
|
*bitrate = it->second;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (strcmp(optarg, "help") == 0) {
|
if (strcmp(optarg, "help") == 0) {
|
||||||
@@ -519,10 +524,6 @@ static bool parse_bitrate(char *optarg, long long int *bitrate) {
|
|||||||
"\n";
|
"\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (strcmp(optarg, "unlimited") == 0) {
|
|
||||||
*bitrate = RATE_UNLIMITED;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
bool force = false, fixed = false;
|
bool force = false, fixed = false;
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
if (optarg[strlen(optarg) - 1] == '!' ||
|
if (optarg[strlen(optarg) - 1] == '!' ||
|
||||||
|
|||||||
Reference in New Issue
Block a user