Reorder command line options checks
Perform checks that impact the options first.
This commit is contained in:
parent
a2c8910006
commit
e71f5358b3
1 changed files with 15 additions and 15 deletions
|
@ -1922,6 +1922,21 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_USB
|
||||||
|
if (!(opts->playback && opts->video) && !opts->otg) {
|
||||||
|
#else
|
||||||
|
if (!(opts->playback && opts->video)) {
|
||||||
|
#endif
|
||||||
|
// If video playback is disabled and OTG are disabled, then there is
|
||||||
|
// no way to control the device.
|
||||||
|
opts->control = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!opts->video) {
|
||||||
|
// If video is disabled, then scrcpy must exit on audio failure.
|
||||||
|
opts->require_audio = true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
if (!opts->playback && !opts->record_filename && !opts->v4l2_device) {
|
if (!opts->playback && !opts->record_filename && !opts->v4l2_device) {
|
||||||
LOGE("-N/--no-playback requires either screen recording (-r/--record)"
|
LOGE("-N/--no-playback requires either screen recording (-r/--record)"
|
||||||
|
@ -2087,21 +2102,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_USB
|
|
||||||
if (!(opts->playback && opts->video) && !opts->otg) {
|
|
||||||
#else
|
|
||||||
if (!(opts->playback && opts->video)) {
|
|
||||||
#endif
|
|
||||||
// If video playback is disabled and OTG are disabled, then there is
|
|
||||||
// no way to control the device.
|
|
||||||
opts->control = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!opts->video) {
|
|
||||||
// If video is disabled, then scrcpy must exit on audio failure.
|
|
||||||
opts->require_audio = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue