feat: video reconnect cli arg
This commit is contained in:
+16
@@ -32,6 +32,7 @@ static void print_help(int status_code) {
|
||||
#ifdef VIDEO_IN
|
||||
"[-vi=FILE] "
|
||||
"[-vs=SIZE] "
|
||||
"[-vr / -nvr] "
|
||||
#endif /* VIDEO_IN */
|
||||
"[-is=SIZE] "
|
||||
"[-ls / -nls] "
|
||||
@@ -63,6 +64,8 @@ static void print_help(int status_code) {
|
||||
"allowed)\n"
|
||||
" -vs, --video-size video capture desired height (default: "
|
||||
"internal texture height)\n"
|
||||
" -vr, --video-reconnect auto-reconnect video (default)\n"
|
||||
" -nvr, --no-video-reconnect do not auto-reconnect video\n"
|
||||
#endif /* VIDEO_IN */
|
||||
" -is, --internal-size internal texture height (default: 720)\n"
|
||||
" -ls, --load-state load saved state (default)\n"
|
||||
@@ -130,6 +133,7 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
||||
params->auto_random_cycle = 4;
|
||||
params->video_in.length = 0;
|
||||
params->video_size = 0;
|
||||
params->video_reconnect = true;
|
||||
params->internal_size = 720;
|
||||
params->load_state = true;
|
||||
params->save_state = true;
|
||||
@@ -195,6 +199,18 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
||||
}
|
||||
#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);
|
||||
|
||||
+9
-4
@@ -121,6 +121,9 @@ static bool start_video_captures(unsigned int video_count, bool trace_fps) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!init_params.video_reconnect) {
|
||||
return true;
|
||||
}
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
log_error("Could not create subprocess");
|
||||
@@ -268,10 +271,12 @@ static bool loop(bool hr, bool trace_fps) {
|
||||
}
|
||||
|
||||
#ifdef VIDEO_IN
|
||||
for (unsigned int i = 0; i < context->inputs.length; i++) {
|
||||
if (context->inputs.values[i].needs_reload) {
|
||||
shaders_relink_input(&program, &project, &context->inputs, i);
|
||||
context->inputs.values[i].needs_reload = false;
|
||||
if (init_params.video_reconnect) {
|
||||
for (unsigned int i = 0; i < context->inputs.length; i++) {
|
||||
if (context->inputs.values[i].needs_reload) {
|
||||
shaders_relink_input(&program, &project, &context->inputs, i);
|
||||
context->inputs.values[i].needs_reload = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* VIDEO_IN */
|
||||
|
||||
@@ -48,6 +48,7 @@ typedef struct Parameters {
|
||||
StringArray video_in;
|
||||
unsigned int video_size;
|
||||
unsigned int internal_size;
|
||||
bool video_reconnect;
|
||||
bool load_state;
|
||||
bool save_state;
|
||||
bool trace_midi;
|
||||
|
||||
Reference in New Issue
Block a user