Commit graph

111 commits

Author SHA1 Message Date
Romain Vimont
9477594f80 Move version handling to a separate file
This will avoid to include all dependencies headers from main.c.
2022-02-09 10:15:07 +01:00
Romain Vimont
91418c79ab Add OTG mode
Add an option --otg to run scrcpy with only physical keyboard and mouse
simulation (HID over AOA), without mirroring and without requiring adb.

To avoid adding complexity into the scrcpy initialization and screen
implementation, OTG mode is implemented totally separately, with a
separate window.

PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974>
2022-01-27 23:36:23 +01:00
Romain Vimont
8ea6fb1f0f Print version on stdout
Refs b25404ee4b
2022-01-27 21:26:56 +01:00
Romain Vimont
b546c33eff Do not print scrcpy version twice on --version
Refs 6da6d905c2
2022-01-27 21:12:46 +01:00
Romain Vimont
6da6d905c2 Print scrcpy header first
Inconditionnally print the scrcpy version first, without using LOGI().

The log level is configured only after parsing the command line
parameters (it may be changed via -V), and command line parsing logs
should not appear before the scrcpy version.
2021-11-19 09:45:02 +01:00
Romain Vimont
27fa23846d Define default options as const struct
This is more readable than a macro, and we could ifdef some fields.
2021-10-27 18:43:47 +02:00
Romain Vimont
e4d5c1ce36 Move scrcpy option structs to options.h
This will allow to define symbols in options.c without all the
dependencies of scrcpy.c.
2021-10-27 18:43:47 +02:00
Romain Vimont
5c95d18beb Move log level conversion to log API 2021-06-20 16:04:18 +02:00
Marti Raudsepp
937fa704a6 Add --verbosity=verbose log level
PR #2371 <https://github.com/Genymobile/scrcpy/pull/2371>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-06-20 12:34:19 +02:00
Marco Martinelli
d39161f753 Add support for v4l2loopback
It allows to send the video stream to /dev/videoN, so that it can be
captured (like a webcam) by any v4l2-capable tool.

PR #2232 <https://github.com/Genymobile/scrcpy/pull/2232>
PR #2233 <https://github.com/Genymobile/scrcpy/pull/2233>
PR #2268 <https://github.com/Genymobile/scrcpy/pull/2268>

Co-authored-by: Romain Vimont <rom@rom1v.com>
2021-04-25 14:59:10 +02:00
Romain Vimont
ab912c23e7 Define feature test macros in common.h
This enables necessary functions once for all.

As a consequence, define common.h before any other header.
2021-01-17 14:08:48 +01:00
Romain Vimont
59feb2a15c Group common includes into common.h
Include config.h and compat.h in common.h, and include common.h from all
source files.
2021-01-08 19:22:10 +01:00
Romain Vimont
904d470579 Pause on error from a wrapper script
On Windows, scrcpy paused on error before exiting to give the user a
chance to see the user message.

This was a hack and causes issues when using scrcpy from batch scripts.

Disable this pause from the scrcpy binary, and provide a batch wrapper
(scrcpy-console.bat) to pause on error.

Fixes #1875 <https://github.com/Genymobile/scrcpy/issues/1875>
2020-12-14 09:44:17 +01:00
Brinan Sjostrom
56d237f152 Fix "press Enter key" message
The message said "Press any key to continue...", whereas only
Enter/Return is accepted.

PR #1783 <https://github.com/Genymobile/scrcpy/pull/1783>
Fixes #1757 <https://github.com/Genymobile/scrcpy/issues/1757>

Reviewed-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2020-10-01 14:52:24 +02:00
Romain Vimont
0ba74fbd9a Make scrcpy.h independant of other headers
The header scrcpy.h is intended to be the "public" API. It should not
depend on other internal headers.

Therefore, declare all required structs in this header and adapt
internal code.
2020-06-19 22:30:02 +02:00
Romain Vimont
6e1069a822 Configure log level for application only
Do not expose internal SDL logs to users.

Fixes #1441 <https://github.com/Genymobile/scrcpy/issues/1441>
2020-06-02 18:27:23 +02:00
Romain Vimont
c4323df976 Fix incorrect log return value
The function must return a SDL_LogPriority, but returned an enum
sc_log_level.

(It was harmless because this specific return should never happen, as
asserted.)
2020-06-02 18:27:14 +02:00
Romain Vimont
a3ef461d73 Add cli option to set the verbosity level
The verbosity was set either to info (in release mode) or debug (in
debug mode).

Add a command-line argument to change it, so that users can enable debug
logs using the release:

    scrcpy -Vdebug
2020-05-24 22:01:51 +02:00
Romain Vimont
024c2f7e6b Configure log priority early
The log priority must be configured before parsing command-line
arguments, in order to get logs as expected.
2019-12-09 22:31:14 +01:00
Romain Vimont
d950383b72 Move command-line parsing to a separate file 2019-12-08 23:18:57 +01:00
Romain Vimont
61274a7cdb Factorize integer argument parsing
Add util functions for integer parsing (with tests), and factorize
integer argument parsing to avoid code duplication.
2019-12-08 21:19:53 +01:00
Romain Vimont
eb0f339271 Add shortcut to rotate screen
On Ctrl+r, disable auto-rotation (if enabled), set the screen rotation
and re-enable auto-rotation (if it was enabled).

Closes #11 <https://github.com/Genymobile/scrcpy/issues/11>
2019-12-04 22:03:25 +01:00
Romain Vimont
b5ebb234dd Replace BUILD_DEBUG by NDEBUG
Use the "standard" NDEBUG definition, which is used by assert().
2019-11-27 21:11:52 +01:00
Romain Vimont
8dc11a0286 Fix warnings on Windows
fix warnings reported with -Dwarning_level=2 on Windows.
2019-11-27 21:11:52 +01:00
Romain Vimont
dfd0707a29 Move utilities to util/ 2019-11-24 11:53:23 +01:00
Romain Vimont
c2116082ab Remove deprecated options from help and manpage
Ref: ff061b4f30
2019-11-19 23:05:39 +01:00
Romain Vimont
3599fcaae5 Fix help for --window-width and --window-height
The default value is 0 (automatic), not -1.
2019-11-19 22:58:18 +01:00
Romain Vimont
1d97d7213d Add option --max-fps
Add an option to limit the capture frame rate. It only works for devices
with Android >= 10.

Fixes <https://github.com/Genymobile/scrcpy/issues/488>
2019-11-17 22:10:39 +01:00
Romain Vimont
1b78a77962 Fix error message 2019-11-17 22:08:34 +01:00
Diego Fernando Díaz A
59bc5bc1f5 Add option to disable window decoration
Add --window-borderless parameter.

Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-11-15 18:59:40 +01:00
Romain Vimont
9fd7a80a89 Add option to specify the initial window size
Add --window-width and --window-height parameters.

If only one is provided, the other is computed so that the aspect ratio
is preserved.
2019-11-15 18:52:58 +01:00
Diego Fernando Díaz A
ce5635f28c Add option to specify the initial window position
Add --window-x and --window-y parameters.

Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-11-15 18:50:49 +01:00
Romain Vimont
c916af0984 Add --prefer-text option
Expose an option to configure how key/text events are forwarded to the
Android device.

Enabling the option avoids issues when combining multiple keys to enter
special characters, but breaks the expected behavior of alpha keys in
games (typically WASD).

Fixes <https://github.com/Genymobile/scrcpy/issues/650>
2019-11-07 19:01:35 +01:00
Romain Vimont
ff061b4f30 Deprecate short options for advanced features
The short options will be removed in the future (and may be reused for
other features).
2019-11-07 10:01:59 +01:00
Romain Vimont
157c60feb4 Fix indentation 2019-11-07 09:48:48 +01:00
Romain Vimont
0e301ddf19 Factorize scrcpy options and command-line args
Do not duplicate all scrcpy options fields in the structure storing the
parsed command-line arguments.
2019-11-06 22:06:54 +01:00
Romain Vimont
1380f6e00f Fix help for --record-format
Record format requires a parameter.
2019-10-30 22:51:40 +01:00
Romain Vimont
1f8ba1ca79 Include config.h everywhere
Ref: <https://github.com/Genymobile/scrcpy/issues/829>

Suggested-by: Louis Kruger <louisk@gmail.com>
2019-09-29 22:39:53 +02:00
Ta-da
513d1ac96d
Fix option "record-format" related short opt 2019-09-27 10:04:41 +08:00
Romain Vimont
e2ac996183 Use Cmd instead of Ctrl on macOS when possible
Fixes <https://github.com/Genymobile/scrcpy/issues/642>
2019-08-03 23:13:44 +02:00
Romain Vimont
d4ed8b6f26 Log scrcpy version and URL on start
Keep --version which also print the version of dependencies.
2019-07-31 01:55:43 +02:00
Romain Vimont
a90ccbdf3b Add option to change the push target
A drag & drop always pushed the file to /sdcard/.

Add an option to customize the target directory.

Fixes <https://github.com/Genymobile/scrcpy/issues/659>
2019-07-31 01:53:16 +02:00
beango1
8e65c10720 Add option --window-title
Add an option to set a custom window title.

Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-06-24 19:58:00 +02:00
Romain Vimont
056e47e752 Replace "cannot" by "could not" 2019-06-23 20:52:03 +02:00
Romain Vimont
bfb3f0842f Prevent to turn screen off if no control
If --no-control is set, then the controller is not initialized (both in
the client and the server), so it is not possible to control the device
to turn its screen off.

See <https://github.com/Genymobile/scrcpy/issues/608>.
2019-06-20 10:59:19 +02:00
Romain Vimont
b91ecf5225 Fix --serial help
Make explicit that --serial excepts a parameter.
2019-06-18 17:13:53 +02:00
Romain Vimont
ebccb9f6cc Add runtime option to render expired frames
Replace the compilation flag SKIP_FRAMES by a runtime flag to force
rendering of expired frames. By default, the expired frames are skipped.
2019-06-05 21:39:42 +02:00
Romain Vimont
a143b8b07a Indent command-line options
Prepare indentation for --render-expired-frames.
2019-06-05 19:02:42 +02:00
Romain Vimont
8e66b33000 Add option to turn device screen off
In addition to the shortcut (Ctrl+o) to turn the device screen off, add
a command-line argument to turn it off on start.
2019-06-05 00:55:46 +02:00
Romain Vimont
7f07b13446 Indent command-line options
Preparse indentation for --turn-screen-off.
2019-06-05 00:55:39 +02:00