Commit graph

1372 commits

Author SHA1 Message Date
Romain Vimont 376201a83c Update links to v1.18 in README and BUILD 2021-06-20 22:11:56 +02:00
Romain Vimont 60c4e886d4 Bump version to 1.18
Make the versionCode a decimal representation of the scrcpy version.

This will for example allow to correctly number the versionCode of
v1.17.1 after a v1.18 is released:
 - v1.18   -> 11800
 - v1.17.1 -> 11701
 - v1.18.1 -> 11801
2021-06-20 22:01:07 +02:00
Romain Vimont ff7baad709 Upgrade platform-tools (31.0.2) for Windows
Include the latest version of adb in Windows releases.
2021-06-20 21:19:11 +02:00
Romain Vimont e712f30ceb Merge branch 'master' into dev 2021-06-20 21:18:58 +02:00
Wirtos_new a9d9cbf8b5 Replace VLA by dynamic allocation
And increase the command buffer size.

Refs #1358 <https://github.com/Genymobile/scrcpy/issues/1358#issuecomment-862989748>
PR #2405 <https://github.com/Genymobile/scrcpy/pull/2405>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-06-20 21:16:42 +02:00
Wirtos_new fda32928c1 Rename cmd to argv
This is more explicit.

PR #2405 <https://github.com/Genymobile/scrcpy/pull/2405>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-06-20 21:16:42 +02:00
Romain Vimont 710e80aa0d Return build_cmd() success via a boolean
For consistency with other functions in the codebase.
2021-06-20 21:16:42 +02:00
Romain Vimont 77e96d745b Suggest --record-format instead of -F on error
The short option -F has been deprecated by
ff061b4f30. On error, suggest the long
option --record-format instead.
2021-06-20 21:16:03 +02:00
Romain Vimont 1c95043478 Attempt to log message only in verbose mode
If the log level is not verbose, there is no need to attempt to log
control messages at all.
2021-06-20 16:44:59 +02:00
Romain Vimont 488991116b Expose function to get the current log level
This will allow to avoid unnecessary processing for creating logs which
will be discarded anyway.
2021-06-20 16:04:18 +02:00
Romain Vimont 5c95d18beb Move log level conversion to log API 2021-06-20 16:04:18 +02:00
Romain Vimont 1039f9b531 Workaround PRIu64 on Windows
On Windows, PRIu64 is defined to "llu", which is not supported:

    error: unknown conversion type character 'l' in format
2021-06-20 16:04:18 +02:00
Marti Raudsepp 19ca02cd8f Log control messages in verbose mode
PR #2371 <https://github.com/Genymobile/scrcpy/pull/2371>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-06-20 16:03:52 +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
Romain Vimont 7db0189f23 Forward mouse motion only on main clicks
Mouse motion events were forwarded as soon as any mouse button was
pressed.

Instead, only consider left-click (and also middle-click and right-click
if --forward-all-clicks is enabled).
2021-06-20 12:34:19 +02:00
Romain Vimont 8b90e1d3f4 Remove extra ';' in #define 2021-06-20 12:34:19 +02:00
Romain Vimont df017160ed Replace strcpy() by memcpy()
It was safe to call strcpy() since the input length was checked, but
then it is more straightforward to call memcpy() directly.
2021-06-20 12:34:19 +02:00
Romain Vimont b846d3a085 Adapt call() on ContentProvider for Android 12
Android 12 changed one of the call() overloads with a new parameter
AttributionSource. Adapt the wrapper.

Fixes #2402 <https://github.com/Genymobile/scrcpy/issues/2402>
2021-06-19 22:59:48 +02:00
Romain Vimont a1f2094787 Push to /sdcard/Download/ by default
Change the default push target from /sdcard/ to /sdcard/Download/.

Pushing to the root of /sdcard/ is not very convenient, many apps do not
expose its content directly.

It can still be changed by --push-target.

PR #2384 <https://github.com/Genymobile/scrcpy/pull/2384>
2021-06-16 22:56:11 +02:00
Romain Vimont 9b89b7ab72 Center the window on resize-to-fit
When removing the black borders (by double-clicking on them, or by
pressing MOD+w), the window is resized to fit the device screen, but its
top-left position was left unchanged.

Instead, move the window so that the new window area is at the center of
the old window area.

Refs #2387 <https://github.com/Genymobile/scrcpy/issues/2387>
2021-06-14 21:24:51 +02:00
Romain Vimont 7343b233e4 Render screen on window restored
It should not be necessary, since screen_render() is called just after
on SDL_WINDOWEVENT_EXPOSED, but in practice the window content might not
be correctly displayed on restored if a rotation occurred while
minimized.

Note that calling screen_render() twice in a row on
SDL_WINDOWEVENT_EXPOSED also "fixes" the issue.
2021-06-14 09:36:08 +02:00
Romain Vimont cd2894570d Allocate AVPacket for v4l2_sink
From FFmpeg/doc/APIchanges:

    2021-03-17 - f7db77bd87 - lavc 58.133.100 - codec.h
      Deprecated av_init_packet(). Once removed, sizeof(AVPacket) will
      no longer be a part of the public ABI.

Refs #2302 <https://github.com/Genymobile/scrcpy/issues/2302>
2021-06-14 09:07:49 +02:00
Romain Vimont 4af317d40d Allocate AVPacket for recorder
From FFmpeg/doc/APIchanges:

    2021-03-17 - f7db77bd87 - lavc 58.133.100 - codec.h
      Deprecated av_init_packet(). Once removed, sizeof(AVPacket) will
      no longer be a part of the public ABI.

Refs #2302 <https://github.com/Genymobile/scrcpy/issues/2302>
2021-06-14 09:07:49 +02:00
Romain Vimont 318b6a572e Allocate AVPacket for local stream packet
From FFmpeg/doc/APIchanges:

    2021-03-17 - f7db77bd87 - lavc 58.133.100 - codec.h
      Deprecated av_init_packet(). Once removed, sizeof(AVPacket) will
      no longer be a part of the public ABI.

Refs #2302 <https://github.com/Genymobile/scrcpy/issues/2302>
2021-06-14 09:07:49 +02:00
Romain Vimont e8b053ad2f Allocate AVPacket for stream->pending
From FFmpeg/doc/APIchanges:

    2021-03-17 - f7db77bd87 - lavc 58.133.100 - codec.h
      Deprecated av_init_packet(). Once removed, sizeof(AVPacket) will
      no longer be a part of the public ABI.

Remove the has_pending boolean, which can be replaced by:

    stream->pending != NULL

Refs #2302 <https://github.com/Genymobile/scrcpy/issues/2302>
2021-06-14 09:07:49 +02:00
Romain Vimont a5d71eee45 Clarify --no-display usage with v4l2 2021-06-14 08:16:05 +02:00
Romain Vimont af228706f1 Fix compatibility with old FFmpeg
V4L2 sink used a "url" field format AVFormatContext which has been
introduced in lavf 58.7.100.

Fixes #2382 <https://github.com/Genymobile/scrcpy/issues/2382>

Refs <ea3672b7d6>
Refs <fa8308d3d4>
2021-06-13 19:20:57 +02:00
Romain Vimont f76fe2c0d4 Fix --lock-video-orientation syntax
The argument for option --lock-video-orientation has been made optional
by 5af9d0ee0f.

With getopt_long(), contrary to mandatory arguments, optional arguments
must be given with a '=':

    --lock-video-orientation 2   # wrong, parse error
    --lock-video-orientation=2   # correct
2021-06-11 18:40:12 +02:00
Romain Vimont 16a63e0917 Use non-secure display for Android 12 preview
Android 12 preview identifies as Android 11, but its codename is "S".

Refs #2129 <https://github.com/Genymobile/scrcpy/issues/2129>
2021-06-11 10:02:52 +02:00
Romain Vimont f7533e8896 Use non-secure display for Android >= 12
Since Android 12, secure displays could not be created with shell
permissions anymore.

Refs commit 1fdde490fd
Fixes #2129 <https://github.com/Genymobile/scrcpy/issues/2129>
2021-06-11 09:37:29 +02:00
Romain Vimont 969bfd4374 Serialize clean-up configuration
This avoids to pass each option as individual parameter and parse them
manually (it's still "manual" in the Parcelable implementation).

Refs #824 <https://github.com/Genymobile/scrcpy/pull/824#issuecomment-780319422>

Reviewed-by: Yu-Chen Lin <npes87184@gmail.com>
2021-06-11 09:33:29 +02:00
Romain Vimont 506f918fb7 Group components into struct scrcpy
This avoids to refer to many structs globally.
2021-05-28 21:29:14 +02:00
Romain Vimont 6fd7e89da1 Explicitly initialize decoder sink_count
The zero-initialization relied on the fact that the decoder instance is
static.
2021-05-28 21:23:18 +02:00
Romain Vimont 4c31911df2 Pass serial within struct server_params
This was the only option passed separately.
2021-05-28 21:21:54 +02:00
Secreto31126 d3d955f67b Translate README.md into Spanish
PR #2318 <https://github.com/Genymobile/scrcpy/pull/2318>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-05-28 10:19:17 +02:00
Alberto Pasqualetto 8121b0b7e7 FAQ in Italian
PR #2316 <https://github.com/Genymobile/scrcpy/pull/2316>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-05-28 10:19:17 +02:00
Alberto Pasqualetto 2e9d520080 README in Italian
PR #2316 <https://github.com/Genymobile/scrcpy/pull/2316>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-05-28 10:18:49 +02:00
Romain Vimont 1b7c9b3e1c Reference translations from FAQ.md 2021-05-28 10:18:36 +02:00
Romain Vimont 9bed8cf3f4 Fix syntax highlighting in README 2021-05-28 10:06:26 +02:00
Romain Vimont 6adc97198b Provide device info directly on server connection
This avoids to retrieve them in a separate step.
2021-05-17 08:52:08 +02:00
Romain Vimont 6a2cd089a1 Initialize input manager dynamically
The input manager was partially initialized statically, but a call to
input_manager_init() was needed anyway, so initialize all the fields
from the "constructor".

This is consistent with the initialization of the other structs.
2021-05-17 08:48:51 +02:00
Romain Vimont dcee7c0f7f Factorize screen_init() error management 2021-05-16 18:48:04 +02:00
Romain Vimont e604e8a752 Move fps_counter to screen
The FPS counter specifically count frames from the screen video buffer,
so it is specific to the screen.
2021-05-16 18:47:16 +02:00
Romain Vimont f19c455110 Fix leak on error
Destroy video buffer if screen window creation failed.
2021-05-16 18:46:47 +02:00
Romain Vimont 83116fc199 Notify end-of-stream via callback
Do not send a SDL event directly, to make stream independent of SDL.
2021-05-16 15:48:07 +02:00
Alberto Pasqualetto 72081a241b Fix visualization of comment in code block
PR #2315 <https://github.com/Genymobile/scrcpy/pull/2315>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-05-15 18:58:04 +02:00
LYK 42b3d1e66e Reformat README.ko.md
PR #2311 <https://github.com/Genymobile/scrcpy/pull/2311>

Signed-off-by: Romain Vimont <rom@rom1v.com>
2021-05-15 18:56:45 +02:00
Romain Vimont 1e64f0f931 Use ARRAY_LEN() macro 2021-05-09 11:06:02 +02:00
Romain Vimont 8fb5715740 Add libavdevice-dev in BUILD instructions
On Linux, scrcpy now depends on libavdevice for v4l2.
2021-05-09 11:01:16 +02:00
Romain Vimont f062dfd30b Merge branch 'master' into dev 2021-05-09 11:00:30 +02:00