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:
parent
0f3af2d20b
commit
6928acdeac
11 changed files with 42 additions and 35 deletions
|
@ -33,7 +33,7 @@ _scrcpy() {
|
||||||
--no-clipboard-autosync
|
--no-clipboard-autosync
|
||||||
--no-downsize-on-error
|
--no-downsize-on-error
|
||||||
-n --no-control
|
-n --no-control
|
||||||
-N --no-display
|
-N --no-mirror
|
||||||
--no-key-repeat
|
--no-key-repeat
|
||||||
--no-mipmaps
|
--no-mipmaps
|
||||||
--no-power-on
|
--no-power-on
|
||||||
|
|
|
@ -39,7 +39,7 @@ arguments=(
|
||||||
'--no-clipboard-autosync[Disable automatic clipboard synchronization]'
|
'--no-clipboard-autosync[Disable automatic clipboard synchronization]'
|
||||||
'--no-downsize-on-error[Disable lowering definition on MediaCodec error]'
|
'--no-downsize-on-error[Disable lowering definition on MediaCodec error]'
|
||||||
{-n,--no-control}'[Disable device control \(mirror the device in read only\)]'
|
{-n,--no-control}'[Disable device control \(mirror the device in read only\)]'
|
||||||
{-N,--no-display}'[Do not display device \(during screen recording or when V4L2 sink is enabled\)]'
|
{-N,--no-mirror}'[Do not mirror device \(only when recording or V4L2 sink is enabled\)]'
|
||||||
'--no-key-repeat[Do not forward repeated key events when a key is held down]'
|
'--no-key-repeat[Do not forward repeated key events when a key is held down]'
|
||||||
'--no-mipmaps[Disable the generation of mipmaps]'
|
'--no-mipmaps[Disable the generation of mipmaps]'
|
||||||
'--no-power-on[Do not power on the device on start]'
|
'--no-power-on[Do not power on the device on start]'
|
||||||
|
|
|
@ -210,8 +210,8 @@ This option disables this behavior.
|
||||||
Disable device control (mirror the device in read\-only).
|
Disable device control (mirror the device in read\-only).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-N, \-\-no\-display
|
.B \-N, \-\-no\-mirror
|
||||||
Do not display device (only when screen recording is enabled).
|
Do not mirror device video or audio on the computer (only when recording or V4L2 sink is enabled).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-no\-key\-repeat
|
.B \-\-no\-key\-repeat
|
||||||
|
|
|
@ -72,6 +72,7 @@ enum {
|
||||||
OPT_REQUIRE_AUDIO,
|
OPT_REQUIRE_AUDIO,
|
||||||
OPT_AUDIO_BUFFER,
|
OPT_AUDIO_BUFFER,
|
||||||
OPT_AUDIO_OUTPUT_BUFFER,
|
OPT_AUDIO_OUTPUT_BUFFER,
|
||||||
|
OPT_NO_DISPLAY,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_option {
|
struct sc_option {
|
||||||
|
@ -380,9 +381,14 @@ static const struct sc_option options[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.shortopt = 'N',
|
.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",
|
.longopt = "no-display",
|
||||||
.text = "Do not display device (only when screen recording or V4L2 "
|
|
||||||
"sink is enabled).",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_NO_KEY_REPEAT,
|
.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':
|
case 'n':
|
||||||
opts->control = false;
|
opts->control = false;
|
||||||
break;
|
break;
|
||||||
|
case OPT_NO_DISPLAY:
|
||||||
|
LOGW("--no-display is deprecated, use --no-mirror instead.");
|
||||||
|
// fall through
|
||||||
case 'N':
|
case 'N':
|
||||||
opts->display = false;
|
opts->mirror = false;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (!parse_port_range(optarg, &opts->port_range)) {
|
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
|
#ifdef HAVE_V4L2
|
||||||
if (!opts->display && !opts->record_filename && !opts->v4l2_device) {
|
if (!opts->mirror && !opts->record_filename && !opts->v4l2_device) {
|
||||||
LOGE("-N/--no-display requires either screen recording (-r/--record)"
|
LOGE("-N/--no-mirror requires either screen recording (-r/--record)"
|
||||||
" or sink to v4l2loopback device (--v4l2-sink)");
|
" or sink to v4l2loopback device (--v4l2-sink)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1915,14 +1924,14 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (!opts->display && !opts->record_filename) {
|
if (!opts->mirror && !opts->record_filename) {
|
||||||
LOGE("-N/--no-display requires screen recording (-r/--record)");
|
LOGE("-N/--no-mirror requires screen recording (-r/--record)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (opts->audio && !opts->display && !opts->record_filename) {
|
if (opts->audio && !opts->mirror && !opts->record_filename) {
|
||||||
LOGI("No display and no recording: audio disabled");
|
LOGI("No mirror and no recording: audio disabled");
|
||||||
opts->audio = false;
|
opts->audio = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ const struct scrcpy_options scrcpy_options_default = {
|
||||||
.fullscreen = false,
|
.fullscreen = false,
|
||||||
.always_on_top = false,
|
.always_on_top = false,
|
||||||
.control = true,
|
.control = true,
|
||||||
.display = true,
|
.mirror = true,
|
||||||
.turn_screen_off = false,
|
.turn_screen_off = false,
|
||||||
.key_inject_mode = SC_KEY_INJECT_MODE_MIXED,
|
.key_inject_mode = SC_KEY_INJECT_MODE_MIXED,
|
||||||
.window_borderless = false,
|
.window_borderless = false,
|
||||||
|
|
|
@ -135,7 +135,7 @@ struct scrcpy_options {
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool always_on_top;
|
bool always_on_top;
|
||||||
bool control;
|
bool control;
|
||||||
bool display;
|
bool mirror;
|
||||||
bool turn_screen_off;
|
bool turn_screen_off;
|
||||||
enum sc_key_inject_mode key_inject_mode;
|
enum sc_key_inject_mode key_inject_mode;
|
||||||
bool window_borderless;
|
bool window_borderless;
|
||||||
|
|
|
@ -137,7 +137,7 @@ sdl_set_hints(const char *render_driver) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sdl_configure(bool display, bool disable_screensaver) {
|
sdl_configure(bool mirror, bool disable_screensaver) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Clean up properly on Ctrl+C on Windows
|
// Clean up properly on Ctrl+C on Windows
|
||||||
bool ok = SetConsoleCtrlHandler(windows_ctrl_handler, TRUE);
|
bool ok = SetConsoleCtrlHandler(windows_ctrl_handler, TRUE);
|
||||||
|
@ -146,7 +146,7 @@ sdl_configure(bool display, bool disable_screensaver) {
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
if (!display) {
|
if (!mirror) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,12 +385,10 @@ scrcpy(struct scrcpy_options *options) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options->display) {
|
if (options->mirror) {
|
||||||
sdl_set_hints(options->render_driver);
|
sdl_set_hints(options->render_driver);
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize SDL video in addition if display is enabled
|
// Initialize SDL video and audio in addition if mirroring is enabled
|
||||||
if (options->display) {
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO)) {
|
if (SDL_Init(SDL_INIT_VIDEO)) {
|
||||||
LOGE("Could not initialize SDL video: %s", SDL_GetError());
|
LOGE("Could not initialize SDL video: %s", SDL_GetError());
|
||||||
goto end;
|
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
|
// Await for server without blocking Ctrl+C handling
|
||||||
bool connected;
|
bool connected;
|
||||||
|
@ -428,7 +426,7 @@ scrcpy(struct scrcpy_options *options) {
|
||||||
|
|
||||||
struct sc_file_pusher *fp = NULL;
|
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,
|
if (!sc_file_pusher_init(&s->file_pusher, serial,
|
||||||
options->push_target)) {
|
options->push_target)) {
|
||||||
goto end;
|
goto end;
|
||||||
|
@ -451,8 +449,8 @@ scrcpy(struct scrcpy_options *options) {
|
||||||
&audio_demuxer_cbs, options);
|
&audio_demuxer_cbs, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needs_video_decoder = options->display;
|
bool needs_video_decoder = options->mirror;
|
||||||
bool needs_audio_decoder = options->audio && options->display;
|
bool needs_audio_decoder = options->mirror && options->audio;
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
needs_video_decoder |= !!options->v4l2_device;
|
needs_video_decoder |= !!options->v4l2_device;
|
||||||
#endif
|
#endif
|
||||||
|
@ -646,7 +644,7 @@ aoa_hid_end:
|
||||||
// There is a controller if and only if control is enabled
|
// There is a controller if and only if control is enabled
|
||||||
assert(options->control == !!controller);
|
assert(options->control == !!controller);
|
||||||
|
|
||||||
if (options->display) {
|
if (options->mirror) {
|
||||||
const char *window_title =
|
const char *window_title =
|
||||||
options->window_title ? options->window_title : info->device_name;
|
options->window_title ? options->window_title : info->device_name;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ static void test_options(void) {
|
||||||
"--max-size", "1024",
|
"--max-size", "1024",
|
||||||
"--lock-video-orientation=2", // optional arguments require '='
|
"--lock-video-orientation=2", // optional arguments require '='
|
||||||
// "--no-control" is not compatible with "--turn-screen-off"
|
// "--no-control" is not compatible with "--turn-screen-off"
|
||||||
// "--no-display" is not compatible with "--fulscreen"
|
// "--no-mirror" is not compatible with "--fulscreen"
|
||||||
"--port", "1234:1236",
|
"--port", "1234:1236",
|
||||||
"--push-target", "/sdcard/Movies",
|
"--push-target", "/sdcard/Movies",
|
||||||
"--record", "file",
|
"--record", "file",
|
||||||
|
@ -108,8 +108,8 @@ static void test_options2(void) {
|
||||||
char *argv[] = {
|
char *argv[] = {
|
||||||
"scrcpy",
|
"scrcpy",
|
||||||
"--no-control",
|
"--no-control",
|
||||||
"--no-display",
|
"--no-mirror",
|
||||||
"--record", "file.mp4", // cannot enable --no-display without recording
|
"--record", "file.mp4", // cannot enable --no-mirror without recording
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ok = scrcpy_parse_args(&args, ARRAY_LEN(argv), argv);
|
bool ok = scrcpy_parse_args(&args, ARRAY_LEN(argv), argv);
|
||||||
|
@ -117,7 +117,7 @@ static void test_options2(void) {
|
||||||
|
|
||||||
const struct scrcpy_options *opts = &args.opts;
|
const struct scrcpy_options *opts = &args.opts;
|
||||||
assert(!opts->control);
|
assert(!opts->control);
|
||||||
assert(!opts->display);
|
assert(!opts->mirror);
|
||||||
assert(!strcmp(opts->record_filename, "file.mp4"));
|
assert(!strcmp(opts->record_filename, "file.mp4"));
|
||||||
assert(opts->record_format == SC_RECORD_FORMAT_MP4);
|
assert(opts->record_format == SC_RECORD_FORMAT_MP4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ _It is currently not possible to record only the audio._
|
||||||
To disable mirroring while recording:
|
To disable mirroring while recording:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --no-display --record=file.mp4
|
scrcpy --no-mirror --record=file.mp4
|
||||||
scrcpy -Nr file.mkv
|
scrcpy -Nr file.mkv
|
||||||
# interrupt recording with Ctrl+C
|
# interrupt recording with Ctrl+C
|
||||||
```
|
```
|
||||||
|
|
|
@ -35,7 +35,7 @@ To start `scrcpy` using a v4l2 sink:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --v4l2-sink=/dev/videoN
|
scrcpy --v4l2-sink=/dev/videoN
|
||||||
scrcpy --v4l2-sink=/dev/videoN --no-display # disable mirroring window
|
scrcpy --v4l2-sink=/dev/videoN --no-mirror # disable mirroring window
|
||||||
```
|
```
|
||||||
|
|
||||||
(replace `N` with the device ID, check with `ls /dev/video*`)
|
(replace `N` with the device ID, check with `ls /dev/video*`)
|
||||||
|
|
|
@ -159,15 +159,15 @@ scrcpy --display-buffer=50 --v4l2-buffer=300
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## No display
|
## No mirror
|
||||||
|
|
||||||
It is possible to capture an Android device without displaying a mirroring
|
It is possible to capture an Android device without displaying a mirroring
|
||||||
window. This option is available if either [recording](recording.md) or
|
window. This option is available if either [recording](recording.md) or
|
||||||
[v4l2](#video4linux) is enabled:
|
[v4l2](#video4linux) is enabled:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
scrcpy --v4l2-sink=/dev/video2 --no-display
|
scrcpy --v4l2-sink=/dev/video2 --no-mirror
|
||||||
scrcpy --record=file.mkv --no-display
|
scrcpy --record=file.mkv --no-mirror
|
||||||
```
|
```
|
||||||
|
|
||||||
## Video4Linux
|
## Video4Linux
|
||||||
|
|
Loading…
Reference in a new issue