Compare commits
5 Commits
v1.20
...
fix_inheri
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
020b3510ae | ||
|
|
dcf9887f56 | ||
|
|
6a27062f48 | ||
|
|
739ff9dce0 | ||
|
|
65b023ac6d |
6
BUILD.md
6
BUILD.md
@@ -270,10 +270,10 @@ install` must be run as root)._
|
||||
|
||||
#### Option 2: Use prebuilt server
|
||||
|
||||
- [`scrcpy-server-v1.19`][direct-scrcpy-server]
|
||||
_(SHA-256: 876f9322182e6aac6a58db1334f4225855ef3a17eaebc80aab6601d9d1ecb867)_
|
||||
- [`scrcpy-server-v1.20`][direct-scrcpy-server]
|
||||
_(SHA-256: b20aee4951f99b060c4a44000ba94de973f9604758ef62beb253b371aad3df34)_
|
||||
|
||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.19/scrcpy-server-v1.19
|
||||
[direct-scrcpy-server]: https://github.com/Genymobile/scrcpy/releases/download/v1.20/scrcpy-server-v1.20
|
||||
|
||||
Download the prebuilt server somewhere, and specify its path during the Meson
|
||||
configuration:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# scrcpy (v1.19)
|
||||
# scrcpy (v1.20)
|
||||
|
||||
<img src="data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||
|
||||
@@ -101,10 +101,10 @@ process][BUILD_simple]).
|
||||
For Windows, for simplicity, a prebuilt archive with all the dependencies
|
||||
(including `adb`) is available:
|
||||
|
||||
- [`scrcpy-win64-v1.19.zip`][direct-win64]
|
||||
_(SHA-256: 383d6483f25ac0092d4bb9fef6c967351ecd50fc248e0c82932db97d6d32f11b)_
|
||||
- [`scrcpy-win64-v1.20.zip`][direct-win64]
|
||||
_(SHA-256: 548532b616288bcaeceff6881ad5e6f0928e5ae2b48c380385f03627401cfdba)_
|
||||
|
||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.19/scrcpy-win64-v1.19.zip
|
||||
[direct-win64]: https://github.com/Genymobile/scrcpy/releases/download/v1.20/scrcpy-win64-v1.20.zip
|
||||
|
||||
It is also available in [Chocolatey]:
|
||||
|
||||
|
||||
@@ -158,6 +158,12 @@ free_ctx:
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !SDL_VERSION_ATLEAST(2, 0, 10)
|
||||
// SDL_PixelFormatEnum has been introduced in SDL 2.0.10. Use int for older SDL
|
||||
// versions.
|
||||
typedef int SDL_PixelFormatEnum;
|
||||
#endif
|
||||
|
||||
static SDL_PixelFormatEnum
|
||||
to_sdl_pixel_format(enum AVPixelFormat fmt) {
|
||||
switch (fmt) {
|
||||
@@ -172,7 +178,9 @@ to_sdl_pixel_format(enum AVPixelFormat fmt) {
|
||||
case AV_PIX_FMT_BGR565BE: return SDL_PIXELFORMAT_BGR565;
|
||||
case AV_PIX_FMT_BGR555BE: return SDL_PIXELFORMAT_BGR555;
|
||||
case AV_PIX_FMT_RGB444BE: return SDL_PIXELFORMAT_RGB444;
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 12)
|
||||
case AV_PIX_FMT_BGR444BE: return SDL_PIXELFORMAT_BGR444;
|
||||
#endif
|
||||
case AV_PIX_FMT_PAL8: return SDL_PIXELFORMAT_INDEX8;
|
||||
default: return SDL_PIXELFORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
@@ -234,6 +234,12 @@ connect_to_server(struct sc_server *server, uint32_t attempts, sc_tick delay) {
|
||||
|
||||
net_close(socket);
|
||||
}
|
||||
|
||||
if (sc_intr_is_interrupted(&server->intr)) {
|
||||
// Stop immediately
|
||||
break;
|
||||
}
|
||||
|
||||
if (attempts) {
|
||||
sc_mutex_lock(&server->mutex);
|
||||
sc_tick deadline = sc_tick_now() + delay;
|
||||
|
||||
@@ -26,6 +26,8 @@ sc_process_execute_p(const char *const argv[], HANDLE *handle,
|
||||
HANDLE *pin, HANDLE *pout, HANDLE *perr) {
|
||||
enum sc_process_result ret = SC_PROCESS_ERROR_GENERIC;
|
||||
|
||||
bool inherit_handles = pin || pout || perr;
|
||||
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
sa.lpSecurityDescriptor = NULL;
|
||||
@@ -69,7 +71,7 @@ sc_process_execute_p(const char *const argv[], HANDLE *handle,
|
||||
PROCESS_INFORMATION pi;
|
||||
memset(&si, 0, sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
if (pin || pout || perr) {
|
||||
if (inherit_handles) {
|
||||
si.dwFlags = STARTF_USESTDHANDLES;
|
||||
if (pin) {
|
||||
si.hStdInput = stdin_read_handle;
|
||||
@@ -95,8 +97,8 @@ sc_process_execute_p(const char *const argv[], HANDLE *handle,
|
||||
goto error_close_stderr;
|
||||
}
|
||||
|
||||
if (!CreateProcessW(NULL, wide, NULL, NULL, TRUE, 0, NULL, NULL, &si,
|
||||
&pi)) {
|
||||
if (!CreateProcessW(NULL, wide, NULL, NULL, inherit_handles, 0, NULL, NULL,
|
||||
&si, &pi)) {
|
||||
free(wide);
|
||||
*handle = NULL;
|
||||
|
||||
|
||||
@@ -96,6 +96,27 @@ net_perror(const char *s) {
|
||||
sc_socket
|
||||
net_socket(void) {
|
||||
sc_raw_socket raw_sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
/* To be able to communicate with a child process via stdin, stdout and
|
||||
* stderr, the CreateProcess() parameter bInheritHandles must be set to
|
||||
* TRUE. But this causes *all* handles to be inherited, including sockets.
|
||||
*
|
||||
* One possibility could be to use an extended API to set extra attributes
|
||||
* on process creation:
|
||||
* - <https://stackoverflow.com/a/28185363/1987178>
|
||||
* - <https://devblogs.microsoft.com/oldnewthing/20111216-00/?p=8873>
|
||||
* But it seems that this API is not available on MinGW (it does not
|
||||
* compile).
|
||||
*
|
||||
* As an alternative, explicitly mark all sockets as non-inheritable.
|
||||
*/
|
||||
if (!SetHandleInformation((HANDLE) raw_sock, HANDLE_FLAG_INHERIT, 0)) {
|
||||
closesocket(raw_sock);
|
||||
return SC_SOCKET_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
sc_socket sock = wrap(raw_sock);
|
||||
if (sock == SC_SOCKET_NONE) {
|
||||
net_perror("socket");
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
set -e
|
||||
|
||||
BUILDDIR=build-auto
|
||||
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.19/scrcpy-server-v1.19
|
||||
PREBUILT_SERVER_SHA256=876f9322182e6aac6a58db1334f4225855ef3a17eaebc80aab6601d9d1ecb867
|
||||
PREBUILT_SERVER_URL=https://github.com/Genymobile/scrcpy/releases/download/v1.20/scrcpy-server-v1.20
|
||||
PREBUILT_SERVER_SHA256=b20aee4951f99b060c4a44000ba94de973f9604758ef62beb253b371aad3df34
|
||||
|
||||
echo "[scrcpy] Downloading prebuilt server..."
|
||||
wget "$PREBUILT_SERVER_URL" -O scrcpy-server
|
||||
|
||||
Reference in New Issue
Block a user