Add --require-audio

By default, scrcpy mirrors only the video when audio capture fails on
the device. Add a flag to force scrcpy to fail if audio is enabled but
does not work.

PR #3757 <https://github.com/Genymobile/scrcpy/pull/3757>
This commit is contained in:
Romain Vimont
2023-02-28 21:19:43 +01:00
parent af577f23fe
commit aeea39e589
9 changed files with 47 additions and 15 deletions

View File

@@ -69,6 +69,7 @@ enum {
OPT_AUDIO_ENCODER,
OPT_LIST_ENCODERS,
OPT_LIST_DISPLAYS,
OPT_REQUIRE_AUDIO,
};
struct sc_option {
@@ -458,6 +459,13 @@ static const struct sc_option options[] = {
.longopt_id = OPT_RENDER_EXPIRED_FRAMES,
.longopt = "render-expired-frames",
},
{
.longopt_id = OPT_REQUIRE_AUDIO,
.longopt = "require-audio",
.text = "By default, scrcpy mirrors only the video when audio capture "
"fails on the device. This flag makes scrcpy fail if audio is "
"enabled but does not work."
},
{
.longopt_id = OPT_ROTATION,
.longopt = "rotation",
@@ -1801,6 +1809,9 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
case OPT_LIST_DISPLAYS:
opts->list_displays = true;
break;
case OPT_REQUIRE_AUDIO:
opts->require_audio = true;
break;
default:
// getopt prints the error message on stderr
return false;