refactor: specify number of video input buffers
Clang Lint CI / lint-no-video (push) Successful in 1m5s
Clang Build CI / run-no-video (push) Successful in 1m5s
Clang Build CI / run-video (push) Successful in 1m5s
Clang Build CI / build-release (push) Successful in 2m24s
Clang Lint CI / lint-video (push) Successful in 2m22s
Clang Lint CI / lint-no-video (push) Successful in 1m5s
Clang Build CI / run-no-video (push) Successful in 1m5s
Clang Build CI / run-video (push) Successful in 1m5s
Clang Build CI / build-release (push) Successful in 2m24s
Clang Lint CI / lint-video (push) Successful in 2m22s
This commit is contained in:
+35
-33
@@ -32,6 +32,7 @@ static void print_help(int status_code) {
|
||||
#ifdef VIDEO_IN
|
||||
"[-vi=FILE] "
|
||||
"[-vs=SIZE] "
|
||||
"[-vb=COUNT] "
|
||||
"[-vr / -nvr] "
|
||||
#endif /* VIDEO_IN */
|
||||
"[-is=SIZE] "
|
||||
@@ -63,6 +64,8 @@ static void print_help(int status_code) {
|
||||
#ifdef VIDEO_IN
|
||||
" -vi, --video-in path to video capture device (multiple "
|
||||
"allowed)\n"
|
||||
" -vb, --video-buffers number of video buffers to use (default: "
|
||||
"2)\n"
|
||||
" -vs, --video-size video capture desired height (default: "
|
||||
"internal texture height)\n"
|
||||
" -vr, --video-reconnect auto-reconnect video (default)\n"
|
||||
@@ -134,9 +137,12 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
||||
params->demo = false;
|
||||
params->auto_random = false;
|
||||
params->auto_random_cycle = 4;
|
||||
#ifdef VIDEO_IN
|
||||
params->video_in.length = 0;
|
||||
params->video_buffers = 2;
|
||||
params->video_size = 0;
|
||||
params->video_reconnect = true;
|
||||
#endif /* VIDEO_IN */
|
||||
params->internal_size = 720;
|
||||
params->load_state = true;
|
||||
params->save_state = true;
|
||||
@@ -184,38 +190,6 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
||||
if (params->auto_random_cycle == 0) {
|
||||
invalid_value(arg, value);
|
||||
}
|
||||
} else if (is_arg(arg, "-vi") || is_arg(arg, "--video-in")) {
|
||||
#ifdef VIDEO_IN
|
||||
if (params->video_in.length == MAX_VIDEO) {
|
||||
log_error("maximum video input reached");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
strlcpy(params->video_in.values[params->video_in.length++], value,
|
||||
STR_LEN);
|
||||
#else
|
||||
invalid_arg(arg);
|
||||
#endif /* VIDEO_IN */
|
||||
} else if (is_arg(arg, "-vs") || is_arg(arg, "--video-size")) {
|
||||
#ifdef VIDEO_IN
|
||||
params->video_size = parse_uint(arg, value);
|
||||
if (params->video_size == 0) {
|
||||
invalid_value(arg, value);
|
||||
}
|
||||
#else
|
||||
invalid_arg(arg);
|
||||
#endif /* VIDEO_IN */
|
||||
} else if (is_arg(arg, "-vr") || is_arg(arg, "--video-reconnect")) {
|
||||
#ifdef VIDEO_IN
|
||||
params->video_reconnect = true;
|
||||
#else
|
||||
invalid_arg(arg);
|
||||
#endif /* VIDEO_IN */
|
||||
} else if (is_arg(arg, "-nvr") || is_arg(arg, "--no-video-reconnect")) {
|
||||
#ifdef VIDEO_IN
|
||||
params->video_reconnect = false;
|
||||
#else
|
||||
invalid_arg(arg);
|
||||
#endif /* VIDEO_IN */
|
||||
} else if (is_arg(arg, "-is") || is_arg(arg, "--internal-size")) {
|
||||
params->internal_size = parse_uint(arg, value);
|
||||
if (params->internal_size == 0) {
|
||||
@@ -238,7 +212,34 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
||||
} else if (is_arg(arg, "-tf") || is_arg(arg, "--trace-fps")) {
|
||||
params->trace_fps = true;
|
||||
} else {
|
||||
#ifdef VIDEO_IN
|
||||
if (is_arg(arg, "-vi") || is_arg(arg, "--video-in")) {
|
||||
if (params->video_in.length == MAX_VIDEO) {
|
||||
log_error("maximum video input reached");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
strlcpy(params->video_in.values[params->video_in.length++], value,
|
||||
STR_LEN);
|
||||
} else if (is_arg(arg, "-vb") || is_arg(arg, "--video-buffers")) {
|
||||
params->video_buffers = parse_uint(arg, value);
|
||||
if (params->video_buffers == 0) {
|
||||
invalid_value(arg, value);
|
||||
}
|
||||
} else if (is_arg(arg, "-vs") || is_arg(arg, "--video-size")) {
|
||||
params->video_size = parse_uint(arg, value);
|
||||
if (params->video_size == 0) {
|
||||
invalid_value(arg, value);
|
||||
}
|
||||
} else if (is_arg(arg, "-vr") || is_arg(arg, "--video-reconnect")) {
|
||||
params->video_reconnect = true;
|
||||
} else if (is_arg(arg, "-nvr") || is_arg(arg, "--no-video-reconnect")) {
|
||||
params->video_reconnect = false;
|
||||
} else {
|
||||
invalid_arg(arg);
|
||||
}
|
||||
#else
|
||||
invalid_arg(arg);
|
||||
#endif /* VIDEO_IN */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,8 +248,9 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
||||
log_error("monitor screen cannot be the same as output screen");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef VIDEO_IN
|
||||
if (params->video_size == 0) {
|
||||
params->video_size = params->internal_size;
|
||||
}
|
||||
#endif /* VIDEO_IN */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user