Rename --no-display to --no-mirror
The option impacts both video and audio playback, so "no display" is not an appropriate name. PR #3978 <https://github.com/Genymobile/scrcpy/pull/3978>
This commit is contained in:
@@ -72,6 +72,7 @@ enum {
|
||||
OPT_REQUIRE_AUDIO,
|
||||
OPT_AUDIO_BUFFER,
|
||||
OPT_AUDIO_OUTPUT_BUFFER,
|
||||
OPT_NO_DISPLAY,
|
||||
};
|
||||
|
||||
struct sc_option {
|
||||
@@ -380,9 +381,14 @@ static const struct sc_option options[] = {
|
||||
},
|
||||
{
|
||||
.shortopt = 'N',
|
||||
.longopt = "no-mirror",
|
||||
.text = "Do not mirror device video or audio on the computer (only "
|
||||
"when recording or V4L2 sink is enabled).",
|
||||
},
|
||||
{
|
||||
// deprecated
|
||||
.longopt_id = OPT_NO_DISPLAY,
|
||||
.longopt = "no-display",
|
||||
.text = "Do not display device (only when screen recording or V4L2 "
|
||||
"sink is enabled).",
|
||||
},
|
||||
{
|
||||
.longopt_id = OPT_NO_KEY_REPEAT,
|
||||
@@ -1642,8 +1648,11 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
case 'n':
|
||||
opts->control = false;
|
||||
break;
|
||||
case OPT_NO_DISPLAY:
|
||||
LOGW("--no-display is deprecated, use --no-mirror instead.");
|
||||
// fall through
|
||||
case 'N':
|
||||
opts->display = false;
|
||||
opts->mirror = false;
|
||||
break;
|
||||
case 'p':
|
||||
if (!parse_port_range(optarg, &opts->port_range)) {
|
||||
@@ -1890,8 +1899,8 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
}
|
||||
|
||||
#ifdef HAVE_V4L2
|
||||
if (!opts->display && !opts->record_filename && !opts->v4l2_device) {
|
||||
LOGE("-N/--no-display requires either screen recording (-r/--record)"
|
||||
if (!opts->mirror && !opts->record_filename && !opts->v4l2_device) {
|
||||
LOGE("-N/--no-mirror requires either screen recording (-r/--record)"
|
||||
" or sink to v4l2loopback device (--v4l2-sink)");
|
||||
return false;
|
||||
}
|
||||
@@ -1915,14 +1924,14 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (!opts->display && !opts->record_filename) {
|
||||
LOGE("-N/--no-display requires screen recording (-r/--record)");
|
||||
if (!opts->mirror && !opts->record_filename) {
|
||||
LOGE("-N/--no-mirror requires screen recording (-r/--record)");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (opts->audio && !opts->display && !opts->record_filename) {
|
||||
LOGI("No display and no recording: audio disabled");
|
||||
if (opts->audio && !opts->mirror && !opts->record_filename) {
|
||||
LOGI("No mirror and no recording: audio disabled");
|
||||
opts->audio = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ const struct scrcpy_options scrcpy_options_default = {
|
||||
.fullscreen = false,
|
||||
.always_on_top = false,
|
||||
.control = true,
|
||||
.display = true,
|
||||
.mirror = true,
|
||||
.turn_screen_off = false,
|
||||
.key_inject_mode = SC_KEY_INJECT_MODE_MIXED,
|
||||
.window_borderless = false,
|
||||
|
||||
@@ -135,7 +135,7 @@ struct scrcpy_options {
|
||||
bool fullscreen;
|
||||
bool always_on_top;
|
||||
bool control;
|
||||
bool display;
|
||||
bool mirror;
|
||||
bool turn_screen_off;
|
||||
enum sc_key_inject_mode key_inject_mode;
|
||||
bool window_borderless;
|
||||
|
||||
@@ -137,7 +137,7 @@ sdl_set_hints(const char *render_driver) {
|
||||
}
|
||||
|
||||
static void
|
||||
sdl_configure(bool display, bool disable_screensaver) {
|
||||
sdl_configure(bool mirror, bool disable_screensaver) {
|
||||
#ifdef _WIN32
|
||||
// Clean up properly on Ctrl+C on Windows
|
||||
bool ok = SetConsoleCtrlHandler(windows_ctrl_handler, TRUE);
|
||||
@@ -146,7 +146,7 @@ sdl_configure(bool display, bool disable_screensaver) {
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
if (!display) {
|
||||
if (!mirror) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -385,12 +385,10 @@ scrcpy(struct scrcpy_options *options) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (options->display) {
|
||||
if (options->mirror) {
|
||||
sdl_set_hints(options->render_driver);
|
||||
}
|
||||
|
||||
// Initialize SDL video in addition if display is enabled
|
||||
if (options->display) {
|
||||
// Initialize SDL video and audio in addition if mirroring is enabled
|
||||
if (SDL_Init(SDL_INIT_VIDEO)) {
|
||||
LOGE("Could not initialize SDL video: %s", SDL_GetError());
|
||||
goto end;
|
||||
@@ -402,7 +400,7 @@ scrcpy(struct scrcpy_options *options) {
|
||||
}
|
||||
}
|
||||
|
||||
sdl_configure(options->display, options->disable_screensaver);
|
||||
sdl_configure(options->mirror, options->disable_screensaver);
|
||||
|
||||
// Await for server without blocking Ctrl+C handling
|
||||
bool connected;
|
||||
@@ -428,7 +426,7 @@ scrcpy(struct scrcpy_options *options) {
|
||||
|
||||
struct sc_file_pusher *fp = NULL;
|
||||
|
||||
if (options->display && options->control) {
|
||||
if (options->mirror && options->control) {
|
||||
if (!sc_file_pusher_init(&s->file_pusher, serial,
|
||||
options->push_target)) {
|
||||
goto end;
|
||||
@@ -451,8 +449,8 @@ scrcpy(struct scrcpy_options *options) {
|
||||
&audio_demuxer_cbs, options);
|
||||
}
|
||||
|
||||
bool needs_video_decoder = options->display;
|
||||
bool needs_audio_decoder = options->audio && options->display;
|
||||
bool needs_video_decoder = options->mirror;
|
||||
bool needs_audio_decoder = options->mirror && options->audio;
|
||||
#ifdef HAVE_V4L2
|
||||
needs_video_decoder |= !!options->v4l2_device;
|
||||
#endif
|
||||
@@ -646,7 +644,7 @@ aoa_hid_end:
|
||||
// There is a controller if and only if control is enabled
|
||||
assert(options->control == !!controller);
|
||||
|
||||
if (options->display) {
|
||||
if (options->mirror) {
|
||||
const char *window_title =
|
||||
options->window_title ? options->window_title : info->device_name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user