Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nocontrols flag to facilitate "headless mode" #143

Merged
merged 2 commits into from
Feb 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/droidcam-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ unsigned v4l2_width = 0, v4l2_height = 0;
int v_running = 0;
int a_running = 0;
int thread_cmd = 0;
int no_controls = 0;
struct settings g_settings = {0};


Expand Down Expand Up @@ -76,6 +77,9 @@ static inline void usage(int argc, char *argv[]) {
" -v Enable Video\n"
" (only -v by default)\n"
"\n"
" -nocontrols Disable controls to avoid reading from stdin\n"
" Only use this if reading from stdin is causing problems!"
"\n"
" -dev=PATH Specify v4l2loopback device to use, instead of first available.\n"
" Ex: /dev/video5\n"
"\n"
Expand Down Expand Up @@ -122,6 +126,10 @@ static void parse_args(int argc, char *argv[]) {
goto ERROR;
continue;
}
if (argv[i][0] == '-' && strstr(&argv[i][1], "nocontrols") != NULL) {
no_controls = 1;
continue;
}
break;
}
if (i > (argc - 2))
Expand Down Expand Up @@ -256,7 +264,11 @@ int main(int argc, char *argv[]) {

signal(SIGINT, sig_handler);
signal(SIGHUP, sig_handler);
wait_command();

if (!no_controls){
wait_command();
}

while (v_running || a_running)
usleep(2000);

Expand Down