|
|
|
@ -74,6 +74,8 @@ enum {
|
|
|
|
|
OPT_AUDIO_OUTPUT_BUFFER,
|
|
|
|
|
OPT_NO_DISPLAY,
|
|
|
|
|
OPT_NO_VIDEO,
|
|
|
|
|
OPT_NO_AUDIO_PLAYBACK,
|
|
|
|
|
OPT_NO_VIDEO_PLAYBACK,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct sc_option {
|
|
|
|
@ -351,6 +353,11 @@ static const struct sc_option options[] = {
|
|
|
|
|
.longopt = "no-audio",
|
|
|
|
|
.text = "Disable audio forwarding.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
.longopt_id = OPT_NO_AUDIO_PLAYBACK,
|
|
|
|
|
.longopt = "no-audio-playback",
|
|
|
|
|
.text = "Disable audio playback on the computer.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
.longopt_id = OPT_NO_CLEANUP,
|
|
|
|
|
.longopt = "no-cleanup",
|
|
|
|
@ -383,7 +390,8 @@ static const struct sc_option options[] = {
|
|
|
|
|
{
|
|
|
|
|
.shortopt = 'N',
|
|
|
|
|
.longopt = "no-playback",
|
|
|
|
|
.text = "Disable video and audio playback on the computer.",
|
|
|
|
|
.text = "Disable video and audio playback on the computer (equivalent "
|
|
|
|
|
"to --no-video-playback --no-audio-playback).",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
// deprecated
|
|
|
|
@ -412,6 +420,11 @@ static const struct sc_option options[] = {
|
|
|
|
|
.longopt = "no-video",
|
|
|
|
|
.text = "Disable video forwarding.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
.longopt_id = OPT_NO_VIDEO_PLAYBACK,
|
|
|
|
|
.longopt = "no-video-playback",
|
|
|
|
|
.text = "Disable video playback on the computer.",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
.longopt_id = OPT_OTG,
|
|
|
|
|
.longopt = "otg",
|
|
|
|
@ -1673,7 +1686,14 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|
|
|
|
LOGW("--no-display is deprecated, use --no-playback instead.");
|
|
|
|
|
// fall through
|
|
|
|
|
case 'N':
|
|
|
|
|
opts->playback = false;
|
|
|
|
|
opts->video_playback = false;
|
|
|
|
|
opts->audio_playback = false;
|
|
|
|
|
break;
|
|
|
|
|
case OPT_NO_VIDEO_PLAYBACK:
|
|
|
|
|
opts->video_playback = false;
|
|
|
|
|
break;
|
|
|
|
|
case OPT_NO_AUDIO_PLAYBACK:
|
|
|
|
|
opts->audio_playback = false;
|
|
|
|
|
break;
|
|
|
|
|
case 'p':
|
|
|
|
|
if (!parse_port_range(optarg, &opts->port_range)) {
|
|
|
|
@ -1932,23 +1952,41 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|
|
|
|
v4l2 = !!opts->v4l2_device;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(opts->playback && opts->video) && !otg) {
|
|
|
|
|
if (!opts->video) {
|
|
|
|
|
opts->video_playback = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!opts->audio) {
|
|
|
|
|
opts->audio_playback = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!opts->video_playback && !otg) {
|
|
|
|
|
// 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;
|
|
|
|
|
if (opts->video && !opts->video_playback && !opts->record_filename
|
|
|
|
|
&& !v4l2) {
|
|
|
|
|
LOGI("No video playback, no recording, no V4L2 sink: video disabled");
|
|
|
|
|
opts->video = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts->audio && !opts->audio_playback && !opts->record_filename) {
|
|
|
|
|
LOGI("No audio playback, no recording: audio disabled");
|
|
|
|
|
opts->audio = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!opts->playback && !opts->record_filename && !v4l2) {
|
|
|
|
|
LOGE("-N/--no-playback requires either screen recording (-r/--record)"
|
|
|
|
|
" or sink to v4l2loopback device (--v4l2-sink)");
|
|
|
|
|
if (!opts->video && !opts->audio && !otg) {
|
|
|
|
|
LOGE("No video, no audio, no OTG: nothing to do");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!opts->video && !otg) {
|
|
|
|
|
// If video is disabled, then scrcpy must exit on audio failure.
|
|
|
|
|
opts->require_audio = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_V4L2
|
|
|
|
|
if (v4l2) {
|
|
|
|
|
if (opts->lock_video_orientation ==
|
|
|
|
@ -1970,11 +2008,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (opts->audio && !opts->playback && !opts->record_filename) {
|
|
|
|
|
LOGI("No playback and no recording: audio disabled");
|
|
|
|
|
opts->audio = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((opts->tunnel_host || opts->tunnel_port) && !opts->force_adb_forward) {
|
|
|
|
|
LOGI("Tunnel host/port is set, "
|
|
|
|
|
"--force-adb-forward automatically enabled.");
|
|
|
|
|