Commit graph

668 commits

Author SHA1 Message Date
zzndb bcd0a876f7 Fix a spell mistake
After commented default portable option in `app/meson.build` get some
error and then find this. :)

Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-06-12 11:22:50 +02:00
Romain Vimont de2016a48e Add link to Snap package in README
<https://github.com/Genymobile/scrcpy/issues/523>
2019-06-11 23:41:56 +02:00
Romain Vimont 19ca6a0d66 Fix typo in README 2019-06-11 23:01:23 +02:00
Romain Vimont e2996e85c0 Update links to v1.9 in README and BUILD 2019-06-11 23:00:09 +02:00
Romain Vimont c2df0228a3 Merge branch 'dev' 2019-06-11 22:54:58 +02:00
Romain Vimont 259d3aee93 Bump version to 1.9 2019-06-11 21:50:29 +02:00
Romain Vimont 90859f1dcf Upgrade tarketSdkVersion to 29
This fixes a lint warning.
2019-06-11 21:49:14 +02:00
Romain Vimont 1afe9ce2ee Fix deprecation warning in Java unit test 2019-06-11 21:48:58 +02:00
Romain Vimont 273cec8a92 Fix typo in test name 2019-06-11 21:47:31 +02:00
Romain Vimont 02f189b1de Remove obsolete detail in README
Now that scrcpy-server.jar is found in the same directory as the
scrcpy executable, using SCRCPY_SERVER_PATH is not particularly useful
on Windows anymore
2019-06-11 21:37:09 +02:00
Romain Vimont 4abe163233 Remove obsolete explanation in FAQ
Issue 9 was about stdout/stderr not printed in Windows console. This is
solved since the Windows version is cross-compiled from Linux.
2019-06-11 21:20:06 +02:00
Romain Vimont 5ffdcbb7be Update DEVELOP.md 2019-06-11 21:18:43 +02:00
Romain Vimont ffe0417228 Update platform-tools (29.0.1) for Windows
Include the latest version of adb in Windows releases.
2019-06-11 19:19:47 +02:00
Romain Vimont e3afb67e7f Downgrade SDL to 2.0.8 for Windows
Revert "Update SDL (2.0.9) for Windows"

Several users experienced freezes with SDL 2.0.9.

This reverts commit a5787dccd6.

See:
 - <https://github.com/Genymobile/scrcpy/issues/425>
 - <https://discourse.libsdl.org/t/unstable-frame-rate-unexpectedly/25783>
2019-06-11 19:18:45 +02:00
Romain Vimont 4ee1391361 Upgrade FFmpeg (4.1.3) for Windows
Include the latest version of FFmpeg in Windows releases.
2019-06-11 19:18:45 +02:00
Romain Vimont 2755bfc255 Improve portable builds
In portable builds, scrcpy-server.jar was supposed to be present in the
current directory, so in practice it worked only if scrcpy was launched
from its own directory.

Instead, find the absolute path of the executable and build a suitable
path to use scrcpy-server.jar from the same directory.
2019-06-11 17:44:07 +02:00
Romain Vimont 3b17ff7c86 Add functions to convert wide char to UTF-8
There was already utf8_to_wide_char(), used to correctly execute
commands on Windows.

Add the reverse converter: utf8_from_wide_char(). We will need it to
build the scrcpy-server path based on the executable directory.
2019-06-11 17:44:07 +02:00
Romain Vimont 4eb6b26c93 Extract "scrcpy-server.jar" string
The filename is used at several places.
2019-06-11 17:44:07 +02:00
Romain Vimont eb34098add Simplify portable build configuration
To create a portable build (with scrcpy-server.jar accessible from the
scrcpy directory), replace OVERRIDE_SERVER_PATH by a simple compilation
flag: PORTABLE.

This paves the way to use more complex rules to determine the path of
scrcpy-server.jar in portable builds.
2019-06-11 17:44:07 +02:00
Romain Vimont b777760bca Simplify scrcpy-server path configuration
The full path of scrcpy-server.jar was partially configured from
meson.build then concatenated by C code.

Instead, directly write the path in C.
2019-06-11 17:44:07 +02:00
Romain Vimont 72bdfbc7a6 Never return 0 for stream protocol
On socket disconnection, on Linux, recv() returns -1 and errno is set.
But on Windows, errno is 0.

In that case, AVERROR(errno) == 0, leading to the warning:

> Invalid return value 0 for stream protocol

To avoid the problem, if errno is 0, return AVERROR_EOF.

Ref: commit 2876463d39
2019-06-11 17:44:07 +02:00
Romain Vimont 8604f16b30 Truncate device name at UTF-8 code point boundary
Just in case.
2019-06-07 17:45:03 +02:00
Romain Vimont 5d11339259 Inline lock_util functions
They are just tiny wrappers.
2019-06-07 17:19:00 +02:00
Romain Vimont e2a272bf99 Improve framerate counting
The FPS counter was called only on new frames, so it could not print
values regularly, especially when there are very few FPS (when the
device surface does not change).

To the extreme, it was never able to display 0 fps.

Add a separate thread to print framerate every second.
2019-06-07 17:16:26 +02:00
Romain Vimont d104d3bda9 Add cond_wait_timeout()
Add a "timed out" version of cond_wait().
2019-06-07 16:54:31 +02:00
Romain Vimont eda44b6068 Fix controller cleanup
After commit bfb86ca2c2, the controller
was not stopped and destroyed on quit.
2019-06-07 00:03:21 +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 9253996873 Add README section explaining --turn-screen-off 2019-06-05 19:02:42 +02:00
Romain Vimont a13524e7f9 Replace android-tools-adb by adb
Here is the description of the adb package in Debian:

> Description: Android Debug Bridge
>
> A versatile command line tool that lets you communicate with an
> emulator instance or connected Android-powered device.
>
> This package recommends "android-sdk-platform-tools-common" which
> contains the udev rules for Android devices. Without this package, adb
> and fastboot need to be running with root permission.

And android-tools-adb:

> Description: transitional package
>
> This is a transitional package. It can safely be removed.
2019-06-05 09:52:25 +02:00
Romain Vimont f3f3433163
Merge pull request #574 from crow1170/patch-1
Fix dependencies
2019-06-05 09:51:47 +02:00
Chris Knowles 232aaa386e
Fix dependencies
Some missing or misspelled dependencies. Checked on Ubuntu 19.04.
2019-06-05 01:15:59 -04: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
Romain Vimont acc4dcd520 Disable server controller if --no-control
If --no-control is disabled, there is no need for a controller.

It also avoids to power on the device on start if control is disabled.
2019-06-05 00:25:57 +02:00
Romain Vimont ca767ba364 Group server params in a struct
Starting the server requires more and more parameters. For clarity,
group them in a struct.
2019-06-05 00:25:57 +02:00
Romain Vimont c8a6783494 Use positive options names internally
For clarity, store the flag resulting of the command-line options
--no-control and --no-display into "control" and "display".
2019-06-05 00:25:15 +02:00
Romain Vimont 5b56900e2b Rename unused field
The flag is used only in the server_start() implementation, there is no
need to store it in the structure.
2019-06-04 21:29:14 +02:00
Romain Vimont 8c8649cfcd Remove "turn device screen on" feature
Only keep "turn device screen off" and POWER button.

After we turn the device screen off (with Ctrl+o), turning it back on
does not always work, and leaves the device in a weird state, where even
the power button may not be sufficient:
<https://github.com/Genymobile/scrcpy/issues/175#issuecomment-497946596>

This is not an acceptable behavior, so disable the shortcut to turn the
physical device screen on. We can use the POWER button (or Ctrl+p)
instead.
2019-06-03 11:44:39 +02:00
Romain Vimont e572d81fa2 Rename function to "power on"
This will reduce confusion between "power on" when the device is off and
"turn device screen off" while mirroring.
2019-06-02 20:34:52 +02:00
Romain Vimont 41225c3e41 Improve key processing readability
The condition "event->type == SDL_KEYDOWN" and the variable
input_manager->controller are used many times. Replace them by local
variables to reduce verbosity.
2019-06-01 07:18:05 +02:00
Romain Vimont 296047d82a Use net_close() to close sockets
So that it also works on Windows.
2019-05-31 23:33:44 +02:00
Romain Vimont 0792998cc2 Remove unused import
Introduced by the previous commit.
2019-05-31 23:31:53 +02:00
Romain Vimont 12a3bb25d3 Implement device screen off while mirroring
Add two shortcuts:
 - Ctrl+o to turn the device screen off while mirroring
 - Ctrl+Shift+o to turn it back on

On power on (either via the POWER key or BACK while screen is off), both
the device screen and the mirror are turned on.

<https://github.com/Genymobile/scrcpy/issues/175>
2019-05-31 23:07:23 +02:00
Romain Vimont 3ee9560ece Fix comment style
For consistency.
2019-05-31 22:57:12 +02:00
Yu-Chen Lin a56045dd80 Prevent socket leak on error
Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-05-31 22:24:31 +02:00
Yu-Chen Lin fcf225049d Use consistent variable names
Use the same variable name in functions declaration and definition.

Signed-off-by: Yu-Chen Lin <npes87184@gmail.com>
Signed-off-by: Romain Vimont <rom@rom1v.com>
2019-05-31 22:24:17 +02:00
Romain Vimont 6537c2ef01 Add clipboard logs
Synchronizing local and device clipboards in invisible. Add INFO logs
on success.
2019-05-31 16:18:00 +02:00
Romain Vimont 9712cb8123 Do not minimize on focus loss
The default behavior seems annoying.

Fixes <https://github.com/Genymobile/scrcpy/issues/554>
2019-05-31 16:18:00 +02:00
Romain Vimont ad55a9addc Prefix server logs
Sometimes, it is not obvious whether a log is generated by the server or
by the client. Prefix server logs for clarity.
2019-05-31 16:18:00 +02:00