mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-24 13:35:01 +00:00
Compare commits
No commits in common. "master" and "v3.1" have entirely different histories.
156 changed files with 401 additions and 953 deletions
26
.github/workflows/release.yml
vendored
26
.github/workflows/release.yml
vendored
|
@ -74,7 +74,6 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||||
|
@ -84,7 +83,7 @@ jobs:
|
||||||
run: release/test_client.sh
|
run: release/test_client.sh
|
||||||
|
|
||||||
build-linux-x86_64:
|
build-linux-x86_64:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check architecture
|
- name: Check architecture
|
||||||
run: |
|
run: |
|
||||||
|
@ -100,7 +99,6 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||||
|
@ -131,12 +129,14 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||||
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
|
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
|
||||||
|
|
||||||
|
- name: Workaround for old meson version run by Github Actions
|
||||||
|
run: sed -i 's/^pkg-config/pkgconfig/' cross_win32.txt
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: release/build_windows.sh 32
|
run: release/build_windows.sh 32
|
||||||
|
|
||||||
|
@ -162,12 +162,14 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
sudo apt install -y meson ninja-build nasm ffmpeg libsdl2-2.0-0 \
|
||||||
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
libsdl2-dev libavcodec-dev libavdevice-dev libavformat-dev \
|
||||||
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
libavutil-dev libswresample-dev libusb-1.0-0 libusb-1.0-0-dev \
|
||||||
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
|
mingw-w64 mingw-w64-tools libz-mingw-w64-dev
|
||||||
|
|
||||||
|
- name: Workaround for old meson version run by Github Actions
|
||||||
|
run: sed -i 's/^pkg-config/pkgconfig/' cross_win64.txt
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: release/build_windows.sh 64
|
run: release/build_windows.sh 64
|
||||||
|
|
||||||
|
@ -206,13 +208,6 @@ jobs:
|
||||||
libtool
|
libtool
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
|
||||||
# the default Xcode (and macOS SDK) version can be found at
|
|
||||||
# <https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode>
|
|
||||||
#
|
|
||||||
# then the minimal supported deployment target of that macOS SDK can be found at
|
|
||||||
# <https://developer.apple.com/support/xcode/#minimum-requirements>
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.13
|
|
||||||
run: release/build_macos.sh aarch64
|
run: release/build_macos.sh aarch64
|
||||||
|
|
||||||
# upload-artifact does not preserve permissions
|
# upload-artifact does not preserve permissions
|
||||||
|
@ -249,13 +244,6 @@ jobs:
|
||||||
# autoconf and libtool are already installed on macos-13
|
# autoconf and libtool are already installed on macos-13
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
|
||||||
# the default Xcode (and macOS SDK) version can be found at
|
|
||||||
# <https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode>
|
|
||||||
#
|
|
||||||
# then the minimal supported deployment target of that macOS SDK can be found at
|
|
||||||
# <https://developer.apple.com/support/xcode/#minimum-requirements>
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: 10.13
|
|
||||||
run: release/build_macos.sh x86_64
|
run: release/build_macos.sh x86_64
|
||||||
|
|
||||||
# upload-artifact does not preserve permissions
|
# upload-artifact does not preserve permissions
|
||||||
|
|
5
FAQ.md
5
FAQ.md
|
@ -166,13 +166,14 @@ Rebooting the device is necessary once this option is set.
|
||||||
|
|
||||||
### Special characters do not work
|
### Special characters do not work
|
||||||
|
|
||||||
The default text injection method is limited to ASCII characters. A trick allows
|
The default text injection method is [limited to ASCII characters][text-input].
|
||||||
to also inject some [accented characters][accented-characters],
|
A trick allows to also inject some [accented characters][accented-characters],
|
||||||
but that's all. See [#37].
|
but that's all. See [#37].
|
||||||
|
|
||||||
To avoid the problem, [change the keyboard mode to simulate a physical
|
To avoid the problem, [change the keyboard mode to simulate a physical
|
||||||
keyboard][hid].
|
keyboard][hid].
|
||||||
|
|
||||||
|
[text-input]: https://github.com/Genymobile/scrcpy/issues?q=is%3Aopen+is%3Aissue+label%3Aunicode
|
||||||
[accented-characters]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters
|
[accented-characters]: https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters
|
||||||
[#37]: https://github.com/Genymobile/scrcpy/issues/37
|
[#37]: https://github.com/Genymobile/scrcpy/issues/37
|
||||||
[hid]: doc/keyboard.md#physical-keyboard-simulation
|
[hid]: doc/keyboard.md#physical-keyboard-simulation
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -188,7 +188,7 @@
|
||||||
identification within third-party archives.
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright (C) 2018 Genymobile
|
Copyright (C) 2018 Genymobile
|
||||||
Copyright (C) 2018-2025 Romain Vimont
|
Copyright (C) 2018-2024 Romain Vimont
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|
24
README.md
24
README.md
|
@ -2,16 +2,16 @@
|
||||||
source for the project. Do not download releases from random websites, even if
|
source for the project. Do not download releases from random websites, even if
|
||||||
their name contains `scrcpy`.**
|
their name contains `scrcpy`.**
|
||||||
|
|
||||||
# scrcpy (v3.2)
|
# scrcpy (v3.1)
|
||||||
|
|
||||||
<img src="app/data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
<img src="app/data/icon.svg" width="128" height="128" alt="scrcpy" align="right" />
|
||||||
|
|
||||||
_pronounced "**scr**een **c**o**py**"_
|
_pronounced "**scr**een **c**o**py**"_
|
||||||
|
|
||||||
This application mirrors Android devices (video and audio) connected via USB or
|
This application mirrors Android devices (video and audio) connected via
|
||||||
[TCP/IP](doc/connection.md#tcpip-wireless) and allows control using the
|
USB or [over TCP/IP](doc/connection.md#tcpip-wireless), and allows to control the
|
||||||
computer's keyboard and mouse. It does not require _root_ access or an app
|
device with the keyboard and the mouse of the computer. It does not require any
|
||||||
installed on the device. It works on _Linux_, _Windows_, and _macOS_.
|
_root_ access. It works on _Linux_, _Windows_ and _macOS_.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
@ -78,16 +78,6 @@ Note that USB debugging is not required to run scrcpy in [OTG mode](doc/otg.md).
|
||||||
- [macOS](doc/macos.md)
|
- [macOS](doc/macos.md)
|
||||||
|
|
||||||
|
|
||||||
## Must-know tips
|
|
||||||
|
|
||||||
- [Reducing resolution](doc/video.md#size) may greatly improve performance
|
|
||||||
(`scrcpy -m1024`)
|
|
||||||
- [_Right-click_](doc/mouse.md#mouse-bindings) triggers `BACK`
|
|
||||||
- [_Middle-click_](doc/mouse.md#mouse-bindings) triggers `HOME`
|
|
||||||
- <kbd>Alt</kbd>+<kbd>f</kbd> toggles [fullscreen](doc/window.md#fullscreen)
|
|
||||||
- There are many other [shortcuts](doc/shortcuts.md)
|
|
||||||
|
|
||||||
|
|
||||||
## Usage examples
|
## Usage examples
|
||||||
|
|
||||||
There are a lot of options, [documented](#user-documentation) in separate pages.
|
There are a lot of options, [documented](#user-documentation) in separate pages.
|
||||||
|
@ -207,10 +197,10 @@ work][donate]:
|
||||||
|
|
||||||
[donate]: https://blog.rom1v.com/about/#support-my-open-source-work
|
[donate]: https://blog.rom1v.com/about/#support-my-open-source-work
|
||||||
|
|
||||||
## License
|
## Licence
|
||||||
|
|
||||||
Copyright (C) 2018 Genymobile
|
Copyright (C) 2018 Genymobile
|
||||||
Copyright (C) 2018-2025 Romain Vimont
|
Copyright (C) 2018-2024 Romain Vimont
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|
|
@ -23,7 +23,6 @@ _scrcpy() {
|
||||||
-d --select-usb
|
-d --select-usb
|
||||||
--disable-screensaver
|
--disable-screensaver
|
||||||
--display-id=
|
--display-id=
|
||||||
--display-ime-policy=
|
|
||||||
--display-orientation=
|
--display-orientation=
|
||||||
-e --select-tcpip
|
-e --select-tcpip
|
||||||
-f --fullscreen
|
-f --fullscreen
|
||||||
|
@ -122,7 +121,7 @@ _scrcpy() {
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--audio-source)
|
--audio-source)
|
||||||
COMPREPLY=($(compgen -W 'output playback mic mic-unprocessed mic-camcorder mic-voice-recognition mic-voice-communication voice-call voice-call-uplink voice-call-downlink voice-performance' -- "$cur"))
|
COMPREPLY=($(compgen -W 'output mic playback' -- "$cur"))
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--camera-facing)
|
--camera-facing)
|
||||||
|
@ -149,10 +148,6 @@ _scrcpy() {
|
||||||
COMPREPLY=($(compgen -W '0 90 180 270 flip0 flip90 flip180 flip270' -- "$cur"))
|
COMPREPLY=($(compgen -W '0 90 180 270 flip0 flip90 flip180 flip270' -- "$cur"))
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
--display-ime-policy)
|
|
||||||
COMPREPLY=($(compgen -W 'local fallback hide' -- "$cur"))
|
|
||||||
return
|
|
||||||
;;
|
|
||||||
--record-orientation)
|
--record-orientation)
|
||||||
COMPREPLY=($(compgen -W '0 90 180 270' -- "$cur"))
|
COMPREPLY=($(compgen -W '0 90 180 270' -- "$cur"))
|
||||||
return
|
return
|
||||||
|
|
|
@ -16,7 +16,7 @@ arguments=(
|
||||||
'--audio-codec-options=[Set a list of comma-separated key\:type=value options for the device audio encoder]'
|
'--audio-codec-options=[Set a list of comma-separated key\:type=value options for the device audio encoder]'
|
||||||
'--audio-dup=[Duplicate audio]'
|
'--audio-dup=[Duplicate audio]'
|
||||||
'--audio-encoder=[Use a specific MediaCodec audio encoder]'
|
'--audio-encoder=[Use a specific MediaCodec audio encoder]'
|
||||||
'--audio-source=[Select the audio source]:source:(output playback mic mic-unprocessed mic-camcorder mic-voice-recognition mic-voice-communication voice-call voice-call-uplink voice-call-downlink voice-performance)'
|
'--audio-source=[Select the audio source]:source:(output mic playback)'
|
||||||
'--audio-output-buffer=[Configure the size of the SDL audio output buffer (in milliseconds)]'
|
'--audio-output-buffer=[Configure the size of the SDL audio output buffer (in milliseconds)]'
|
||||||
{-b,--video-bit-rate=}'[Encode the video at the given bit-rate]'
|
{-b,--video-bit-rate=}'[Encode the video at the given bit-rate]'
|
||||||
'--camera-ar=[Select the camera size by its aspect ratio]'
|
'--camera-ar=[Select the camera size by its aspect ratio]'
|
||||||
|
@ -30,7 +30,6 @@ arguments=(
|
||||||
{-d,--select-usb}'[Use USB device]'
|
{-d,--select-usb}'[Use USB device]'
|
||||||
'--disable-screensaver[Disable screensaver while scrcpy is running]'
|
'--disable-screensaver[Disable screensaver while scrcpy is running]'
|
||||||
'--display-id=[Specify the display id to mirror]'
|
'--display-id=[Specify the display id to mirror]'
|
||||||
'--display-ime-policy[Set the policy for selecting where the IME should be displayed]'
|
|
||||||
'--display-orientation=[Set the initial display orientation]:orientation values:(0 90 180 270 flip0 flip90 flip180 flip270)'
|
'--display-orientation=[Set the initial display orientation]:orientation values:(0 90 180 270 flip0 flip90 flip180 flip270)'
|
||||||
{-e,--select-tcpip}'[Use TCP/IP device]'
|
{-e,--select-tcpip}'[Use TCP/IP device]'
|
||||||
{-f,--fullscreen}'[Start in fullscreen]'
|
{-f,--fullscreen}'[Start in fullscreen]'
|
||||||
|
|
|
@ -5,10 +5,10 @@ cd "$DEPS_DIR"
|
||||||
. common
|
. common
|
||||||
process_args "$@"
|
process_args "$@"
|
||||||
|
|
||||||
VERSION=7.1.1
|
VERSION=7.1
|
||||||
FILENAME=ffmpeg-$VERSION.tar.xz
|
FILENAME=ffmpeg-$VERSION.tar.xz
|
||||||
PROJECT_DIR=ffmpeg-$VERSION
|
PROJECT_DIR=ffmpeg-$VERSION
|
||||||
SHA256SUM=733984395e0dbbe5c046abda2dc49a5544e7e0e1e2366bba849222ae9e3a03b1
|
SHA256SUM=40973D44970DBC83EF302B0609F2E74982BE2D85916DD2EE7472D30678A7ABE6
|
||||||
|
|
||||||
cd "$SOURCES_DIR"
|
cd "$SOURCES_DIR"
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ cd "$DEPS_DIR"
|
||||||
. common
|
. common
|
||||||
process_args "$@"
|
process_args "$@"
|
||||||
|
|
||||||
VERSION=1.0.28
|
VERSION=1.0.27
|
||||||
FILENAME=libusb-$VERSION.tar.gz
|
FILENAME=libusb-$VERSION.tar.gz
|
||||||
PROJECT_DIR=libusb-$VERSION
|
PROJECT_DIR=libusb-$VERSION
|
||||||
SHA256SUM=378b3709a405065f8f9fb9f35e82d666defde4d342c2a1b181a9ac134d23c6fe
|
SHA256SUM=e8f18a7a36ecbb11fb820bd71540350d8f61bcd9db0d2e8c18a6fb80b214a3de
|
||||||
|
|
||||||
cd "$SOURCES_DIR"
|
cd "$SOURCES_DIR"
|
||||||
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
From 6be87ceb33a9aad3bf5204bb13b3a5e8b498fd26 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Neal Gompa <neal@gompa.dev>
|
|
||||||
Date: Mon, 10 Feb 2025 05:00:56 -0500
|
|
||||||
Subject: [PATCH] pipewire: Ensure that the correct struct is used for
|
|
||||||
enumeration APIs
|
|
||||||
|
|
||||||
PipeWire now requires the correct struct type is used, otherwise
|
|
||||||
it will fail to compile.
|
|
||||||
|
|
||||||
Reference: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/188d920733f0791413d3386e5536ee7377f71b2f
|
|
||||||
|
|
||||||
Fixes: https://github.com/libsdl-org/SDL/issues/12224
|
|
||||||
(cherry picked from commit d35bef64e913dd7d5dd3153a4b61f10ef837dad6)
|
|
||||||
---
|
|
||||||
src/audio/pipewire/SDL_pipewire.c | 2 +-
|
|
||||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c
|
|
||||||
index 889e05decb..5d1bfc28de 100644
|
|
||||||
--- a/src/audio/pipewire/SDL_pipewire.c
|
|
||||||
+++ b/src/audio/pipewire/SDL_pipewire.c
|
|
||||||
@@ -590,7 +590,7 @@ static void node_event_info(void *object, const struct pw_node_info *info)
|
|
||||||
|
|
||||||
/* Need to parse the parameters to get the sample rate */
|
|
||||||
for (i = 0; i < info->n_params; ++i) {
|
|
||||||
- pw_node_enum_params(node->proxy, 0, info->params[i].id, 0, 0, NULL);
|
|
||||||
+ pw_node_enum_params((struct pw_node*)node->proxy, 0, info->params[i].id, 0, 0, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
hotplug_core_sync(node);
|
|
||||||
--
|
|
||||||
2.49.0
|
|
||||||
|
|
|
@ -5,10 +5,10 @@ cd "$DEPS_DIR"
|
||||||
. common
|
. common
|
||||||
process_args "$@"
|
process_args "$@"
|
||||||
|
|
||||||
VERSION=2.32.2
|
VERSION=2.30.10
|
||||||
FILENAME=SDL-$VERSION.tar.gz
|
FILENAME=SDL-$VERSION.tar.gz
|
||||||
PROJECT_DIR=SDL-release-$VERSION
|
PROJECT_DIR=SDL-release-$VERSION
|
||||||
SHA256SUM=f2c7297ae7b3d3910a8b131e1e2a558fdd6d1a4443d5e345374d45cadfcb05a4
|
SHA256SUM=35a8b9c4f3635d85762b904ac60ca4e0806bff89faeb269caafbe80860d67168
|
||||||
|
|
||||||
cd "$SOURCES_DIR"
|
cd "$SOURCES_DIR"
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ then
|
||||||
else
|
else
|
||||||
get_file "https://github.com/libsdl-org/SDL/archive/refs/tags/release-$VERSION.tar.gz" "$FILENAME" "$SHA256SUM"
|
get_file "https://github.com/libsdl-org/SDL/archive/refs/tags/release-$VERSION.tar.gz" "$FILENAME" "$SHA256SUM"
|
||||||
tar xf "$FILENAME" # First level directory is "$PROJECT_DIR"
|
tar xf "$FILENAME" # First level directory is "$PROJECT_DIR"
|
||||||
patch -d "$PROJECT_DIR" -p1 < "$PATCHES_DIR"/SDL-pipewire-Ensure-that-the-correct-struct-is-used-for-.patch
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$BUILD_DIR/$PROJECT_DIR"
|
mkdir -p "$BUILD_DIR/$PROJECT_DIR"
|
||||||
|
|
|
@ -192,19 +192,19 @@ datadir = get_option('datadir') # by default 'share'
|
||||||
install_man('scrcpy.1')
|
install_man('scrcpy.1')
|
||||||
install_data('data/icon.png',
|
install_data('data/icon.png',
|
||||||
rename: 'scrcpy.png',
|
rename: 'scrcpy.png',
|
||||||
install_dir: datadir / 'icons/hicolor/256x256/apps')
|
install_dir: join_paths(datadir, 'icons/hicolor/256x256/apps'))
|
||||||
install_data('data/zsh-completion/_scrcpy',
|
install_data('data/zsh-completion/_scrcpy',
|
||||||
install_dir: datadir / 'zsh/site-functions')
|
install_dir: join_paths(datadir, 'zsh/site-functions'))
|
||||||
install_data('data/bash-completion/scrcpy',
|
install_data('data/bash-completion/scrcpy',
|
||||||
install_dir: datadir / 'bash-completion/completions')
|
install_dir: join_paths(datadir, 'bash-completion/completions'))
|
||||||
|
|
||||||
# Desktop entry file for application launchers
|
# Desktop entry file for application launchers
|
||||||
if host_machine.system() == 'linux'
|
if host_machine.system() == 'linux'
|
||||||
# Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop)
|
# Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop)
|
||||||
install_data('data/scrcpy.desktop',
|
install_data('data/scrcpy.desktop',
|
||||||
install_dir: datadir / 'applications')
|
install_dir: join_paths(datadir, 'applications'))
|
||||||
install_data('data/scrcpy-console.desktop',
|
install_data('data/scrcpy-console.desktop',
|
||||||
install_dir: datadir / 'applications')
|
install_dir: join_paths(datadir, 'applications'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,9 +279,3 @@ if get_option('buildtype') == 'debug'
|
||||||
test(t[0], exe)
|
test(t[0], exe)
|
||||||
endforeach
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if meson.version().version_compare('>= 0.58.0')
|
|
||||||
devenv = environment()
|
|
||||||
devenv.set('SCRCPY_ICON_PATH', meson.current_source_dir() / 'data/icon.png')
|
|
||||||
meson.add_devenv(devenv)
|
|
||||||
endif
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ BEGIN
|
||||||
VALUE "LegalCopyright", "Romain Vimont, Genymobile"
|
VALUE "LegalCopyright", "Romain Vimont, Genymobile"
|
||||||
VALUE "OriginalFilename", "scrcpy.exe"
|
VALUE "OriginalFilename", "scrcpy.exe"
|
||||||
VALUE "ProductName", "scrcpy"
|
VALUE "ProductName", "scrcpy"
|
||||||
VALUE "ProductVersion", "3.2"
|
VALUE "ProductVersion", "3.1"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
35
app/scrcpy.1
35
app/scrcpy.1
|
@ -67,19 +67,13 @@ The available encoders can be listed by \fB\-\-list\-encoders\fR.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-audio\-source " source
|
.BI "\-\-audio\-source " source
|
||||||
Select the audio source. Possible values are:
|
Select the audio source (output, mic or playback).
|
||||||
|
|
||||||
- "output": forwards the whole audio output, and disables playback on the device.
|
The "output" source forwards the whole audio output, and disables playback on the device.
|
||||||
- "playback": captures the audio playback (Android apps can opt-out, so the whole output is not necessarily captured).
|
|
||||||
- "mic": captures the microphone.
|
The "playback" source captures the audio playback (Android apps can opt-out, so the whole output is not necessarily captured).
|
||||||
- "mic-unprocessed": captures the microphone unprocessed (raw) sound.
|
|
||||||
- "mic-camcorder": captures the microphone tuned for video recording, with the same orientation as the camera if available.
|
The "mic" source captures the microphone.
|
||||||
- "mic-voice-recognition": captures the microphone tuned for voice recognition.
|
|
||||||
- "mic-voice-communication": captures the microphone tuned for voice communications (it will for instance take advantage of echo cancellation or automatic gain control if available).
|
|
||||||
- "voice-call": captures voice call.
|
|
||||||
- "voice-call-uplink": captures voice call uplink only.
|
|
||||||
- "voice-call-downlink": captures voice call downlink only.
|
|
||||||
- "voice-performance": captures audio meant to be processed for live performance (karaoke), includes both the microphone and the device playback.
|
|
||||||
|
|
||||||
Default is output.
|
Default is output.
|
||||||
|
|
||||||
|
@ -167,19 +161,6 @@ The available display ids can be listed by \fB\-\-list\-displays\fR.
|
||||||
|
|
||||||
Default is 0.
|
Default is 0.
|
||||||
|
|
||||||
.TP
|
|
||||||
.BI "\-\-display\-ime\-policy " value
|
|
||||||
Set the policy for selecting where the IME should be displayed.
|
|
||||||
|
|
||||||
Possible values are "local", "fallback" and "hide":
|
|
||||||
|
|
||||||
- "local" means that the IME should appear on the local display.
|
|
||||||
- "fallback" means that the IME should appear on a fallback display (the default display).
|
|
||||||
- "hide" means that the IME should be hidden.
|
|
||||||
|
|
||||||
By default, the IME policy is left unchanged.
|
|
||||||
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-display\-orientation " value
|
.BI "\-\-display\-orientation " value
|
||||||
Set the initial display orientation.
|
Set the initial display orientation.
|
||||||
|
@ -408,7 +389,7 @@ Disable video playback on the computer.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-\-no\-window
|
.B \-\-no\-window
|
||||||
Disable scrcpy window. Implies --no-video-playback.
|
Disable scrcpy window. Implies --no-video-playback and --no-control.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI "\-\-orientation " value
|
.BI "\-\-orientation " value
|
||||||
|
@ -848,7 +829,7 @@ Report bugs to <https://github.com/Genymobile/scrcpy/issues>.
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2018 Genymobile <https://www.genymobile.com>
|
Copyright \(co 2018 Genymobile <https://www.genymobile.com>
|
||||||
|
|
||||||
Copyright \(co 2018\-2025 Romain Vimont <rom@rom1v.com>
|
Copyright \(co 2018\-2024 Romain Vimont <rom@rom1v.com>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0.
|
Licensed under the Apache License, Version 2.0.
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "adb/adb_device.h"
|
#include "adb_device.h"
|
||||||
#include "adb/adb_parser.h"
|
#include "adb_parser.h"
|
||||||
#include "util/env.h"
|
#include "util/env.h"
|
||||||
#include "util/file.h"
|
#include "util/file.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "adb/adb_device.h"
|
#include "adb_device.h"
|
||||||
#include "util/intr.h"
|
#include "util/intr.h"
|
||||||
|
|
||||||
#define SC_ADB_NO_STDOUT (1 << 0)
|
#define SC_ADB_NO_STDOUT (1 << 0)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "util/vector.h"
|
#include "util/vector.h"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/str.h"
|
#include "util/str.h"
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "adb/adb_device.h"
|
#include "adb_device.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the available devices from the output of `adb devices`
|
* Parse the available devices from the output of `adb devices`
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "adb_tunnel.h"
|
#include "adb_tunnel.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include "adb/adb.h"
|
#include "adb.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/net_intr.h"
|
#include "util/net_intr.h"
|
||||||
|
#include "util/process_intr.h"
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
listen_on_port(struct sc_intr *intr, sc_socket socket, uint16_t port) {
|
listen_on_port(struct sc_intr *intr, sc_socket socket, uint16_t port) {
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <SDL2/SDL_audio.h>
|
#include <stdatomic.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
#include "audio_regulator.h"
|
#include "audio_regulator.h"
|
||||||
#include "trait/frame_sink.h"
|
#include "trait/frame_sink.h"
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#include "audio_regulator.h"
|
#include "audio_regulator.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavutil/opt.h>
|
#include <libavutil/opt.h>
|
||||||
|
|
||||||
|
@ -76,10 +72,8 @@ sc_audio_regulator_pull(struct sc_audio_regulator *ar, uint8_t *out,
|
||||||
// Wait until the buffer is filled up to at least target_buffering
|
// Wait until the buffer is filled up to at least target_buffering
|
||||||
// before playing
|
// before playing
|
||||||
if (buffered_samples < ar->target_buffering) {
|
if (buffered_samples < ar->target_buffering) {
|
||||||
#ifdef SC_AUDIO_REGULATOR_DEBUG
|
LOGV("[Audio] Inserting initial buffering silence: %" PRIu32
|
||||||
LOGD("[Audio] Inserting initial buffering silence: %" PRIu32
|
|
||||||
" samples", out_samples);
|
" samples", out_samples);
|
||||||
#endif
|
|
||||||
// Delay playback starting to reach the target buffering. Fill the
|
// Delay playback starting to reach the target buffering. Fill the
|
||||||
// whole buffer with silence (len is small compared to the
|
// whole buffer with silence (len is small compared to the
|
||||||
// arbitrary margin value).
|
// arbitrary margin value).
|
||||||
|
@ -100,10 +94,8 @@ sc_audio_regulator_pull(struct sc_audio_regulator *ar, uint8_t *out,
|
||||||
// dropped to keep the latency minimal. However, this would cause very
|
// dropped to keep the latency minimal. However, this would cause very
|
||||||
// audible glitches, so let the clock compensation restore the target
|
// audible glitches, so let the clock compensation restore the target
|
||||||
// latency.
|
// latency.
|
||||||
#ifdef SC_AUDIO_REGULATOR_DEBUG
|
|
||||||
LOGD("[Audio] Buffer underflow, inserting silence: %" PRIu32 " samples",
|
LOGD("[Audio] Buffer underflow, inserting silence: %" PRIu32 " samples",
|
||||||
silence);
|
silence);
|
||||||
#endif
|
|
||||||
memset(out + TO_BYTES(read), 0, TO_BYTES(silence));
|
memset(out + TO_BYTES(read), 0, TO_BYTES(silence));
|
||||||
|
|
||||||
bool received = atomic_load_explicit(&ar->received,
|
bool received = atomic_load_explicit(&ar->received,
|
||||||
|
@ -141,36 +133,6 @@ bool
|
||||||
sc_audio_regulator_push(struct sc_audio_regulator *ar, const AVFrame *frame) {
|
sc_audio_regulator_push(struct sc_audio_regulator *ar, const AVFrame *frame) {
|
||||||
SwrContext *swr_ctx = ar->swr_ctx;
|
SwrContext *swr_ctx = ar->swr_ctx;
|
||||||
|
|
||||||
uint32_t input_samples = frame->nb_samples;
|
|
||||||
|
|
||||||
assert(frame->pts >= 0);
|
|
||||||
int64_t pts = frame->pts;
|
|
||||||
if (ar->next_expected_pts && pts - ar->next_expected_pts > 100000) {
|
|
||||||
LOGV("[Audio] Discontinuity detected: %" PRIi64 "µs",
|
|
||||||
pts - ar->next_expected_pts);
|
|
||||||
// More than 100ms: consider it as a discontinuity
|
|
||||||
// (typically because silence packets were not captured)
|
|
||||||
uint32_t can_read = sc_audiobuf_can_read(&ar->buf);
|
|
||||||
if (input_samples + can_read < ar->target_buffering) {
|
|
||||||
// Adjust buffering to the target value directly
|
|
||||||
uint32_t silence = ar->target_buffering - can_read - input_samples;
|
|
||||||
sc_audiobuf_write_silence(&ar->buf, silence);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset state
|
|
||||||
ar->avg_buffering.avg = ar->target_buffering;
|
|
||||||
int ret = swr_set_compensation(swr_ctx, 0, 0);
|
|
||||||
(void) ret;
|
|
||||||
assert(!ret); // disabling compensation should never fail
|
|
||||||
ar->compensation_active = false;
|
|
||||||
ar->samples_since_resync = 0;
|
|
||||||
atomic_store_explicit(&ar->underflow, 0, memory_order_relaxed);
|
|
||||||
}
|
|
||||||
|
|
||||||
int64_t packet_duration = input_samples * INT64_C(1000000)
|
|
||||||
/ ar->sample_rate;
|
|
||||||
ar->next_expected_pts = pts + packet_duration;
|
|
||||||
|
|
||||||
int64_t swr_delay = swr_get_delay(swr_ctx, ar->sample_rate);
|
int64_t swr_delay = swr_get_delay(swr_ctx, ar->sample_rate);
|
||||||
// No need to av_rescale_rnd(), input and output sample rates are the same.
|
// No need to av_rescale_rnd(), input and output sample rates are the same.
|
||||||
// Add more space (256) for clock compensation.
|
// Add more space (256) for clock compensation.
|
||||||
|
@ -243,7 +205,6 @@ sc_audio_regulator_push(struct sc_audio_regulator *ar, const AVFrame *frame) {
|
||||||
if (played) {
|
if (played) {
|
||||||
underflow = atomic_exchange_explicit(&ar->underflow, 0,
|
underflow = atomic_exchange_explicit(&ar->underflow, 0,
|
||||||
memory_order_relaxed);
|
memory_order_relaxed);
|
||||||
ar->underflow_report += underflow;
|
|
||||||
|
|
||||||
max_buffered_samples = ar->target_buffering * 11 / 10
|
max_buffered_samples = ar->target_buffering * 11 / 10
|
||||||
+ 60 * ar->sample_rate / 1000 /* 60 ms */;
|
+ 60 * ar->sample_rate / 1000 /* 60 ms */;
|
||||||
|
@ -290,7 +251,7 @@ sc_audio_regulator_push(struct sc_audio_regulator *ar, const AVFrame *frame) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Number of samples added (or removed, if negative) for compensation
|
// Number of samples added (or removed, if negative) for compensation
|
||||||
int32_t instant_compensation = (int32_t) written - input_samples;
|
int32_t instant_compensation = (int32_t) written - frame->nb_samples;
|
||||||
// Inserting silence instantly increases buffering
|
// Inserting silence instantly increases buffering
|
||||||
int32_t inserted_silence = (int32_t) underflow;
|
int32_t inserted_silence = (int32_t) underflow;
|
||||||
// Dropping input samples instantly decreases buffering
|
// Dropping input samples instantly decreases buffering
|
||||||
|
@ -346,9 +307,7 @@ sc_audio_regulator_push(struct sc_audio_regulator *ar, const AVFrame *frame) {
|
||||||
int abs_max_diff = distance / 50;
|
int abs_max_diff = distance / 50;
|
||||||
diff = CLAMP(diff, -abs_max_diff, abs_max_diff);
|
diff = CLAMP(diff, -abs_max_diff, abs_max_diff);
|
||||||
LOGV("[Audio] Buffering: target=%" PRIu32 " avg=%f cur=%" PRIu32
|
LOGV("[Audio] Buffering: target=%" PRIu32 " avg=%f cur=%" PRIu32
|
||||||
" compensation=%d (underflow=%" PRIu32 ")",
|
" compensation=%d", ar->target_buffering, avg, can_read, diff);
|
||||||
ar->target_buffering, avg, can_read, diff, ar->underflow_report);
|
|
||||||
ar->underflow_report = 0;
|
|
||||||
|
|
||||||
int ret = swr_set_compensation(swr_ctx, diff, distance);
|
int ret = swr_set_compensation(swr_ctx, diff, distance);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -431,9 +390,7 @@ sc_audio_regulator_init(struct sc_audio_regulator *ar, size_t sample_size,
|
||||||
atomic_init(&ar->played, false);
|
atomic_init(&ar->played, false);
|
||||||
atomic_init(&ar->received, false);
|
atomic_init(&ar->received, false);
|
||||||
atomic_init(&ar->underflow, 0);
|
atomic_init(&ar->underflow, 0);
|
||||||
ar->underflow_report = 0;
|
|
||||||
ar->compensation_active = false;
|
ar->compensation_active = false;
|
||||||
ar->next_expected_pts = 0;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libswresample/swresample.h>
|
#include <libswresample/swresample.h>
|
||||||
#include "util/audiobuf.h"
|
#include "util/audiobuf.h"
|
||||||
|
@ -46,9 +44,6 @@ struct sc_audio_regulator {
|
||||||
// Number of silence samples inserted since the last received packet
|
// Number of silence samples inserted since the last received packet
|
||||||
atomic_uint_least32_t underflow;
|
atomic_uint_least32_t underflow;
|
||||||
|
|
||||||
// Number of silence samples inserted since the last log
|
|
||||||
uint32_t underflow_report;
|
|
||||||
|
|
||||||
// Non-zero compensation applied (only used by the receiver thread)
|
// Non-zero compensation applied (only used by the receiver thread)
|
||||||
bool compensation_active;
|
bool compensation_active;
|
||||||
|
|
||||||
|
@ -57,9 +52,6 @@ struct sc_audio_regulator {
|
||||||
|
|
||||||
// Set to true the first time samples are pulled by the player
|
// Set to true the first time samples are pulled by the player
|
||||||
atomic_bool played;
|
atomic_bool played;
|
||||||
|
|
||||||
// PTS of the next expected packet (useful to detect discontinuities)
|
|
||||||
int64_t next_expected_pts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
137
app/src/cli.c
137
app/src/cli.c
|
@ -5,7 +5,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -14,7 +13,6 @@
|
||||||
#include "util/str.h"
|
#include "util/str.h"
|
||||||
#include "util/strbuf.h"
|
#include "util/strbuf.h"
|
||||||
#include "util/term.h"
|
#include "util/term.h"
|
||||||
#include "util/tick.h"
|
|
||||||
|
|
||||||
#define STR_IMPL_(x) #x
|
#define STR_IMPL_(x) #x
|
||||||
#define STR(x) STR_IMPL_(x)
|
#define STR(x) STR_IMPL_(x)
|
||||||
|
@ -113,7 +111,6 @@ enum {
|
||||||
OPT_ANGLE,
|
OPT_ANGLE,
|
||||||
OPT_NO_VD_SYSTEM_DECORATIONS,
|
OPT_NO_VD_SYSTEM_DECORATIONS,
|
||||||
OPT_NO_VD_DESTROY_CONTENT,
|
OPT_NO_VD_DESTROY_CONTENT,
|
||||||
OPT_DISPLAY_IME_POLICY,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sc_option {
|
struct sc_option {
|
||||||
|
@ -217,31 +214,13 @@ static const struct sc_option options[] = {
|
||||||
.longopt_id = OPT_AUDIO_SOURCE,
|
.longopt_id = OPT_AUDIO_SOURCE,
|
||||||
.longopt = "audio-source",
|
.longopt = "audio-source",
|
||||||
.argdesc = "source",
|
.argdesc = "source",
|
||||||
.text = "Select the audio source. Possible values are:\n"
|
.text = "Select the audio source (output, mic or playback).\n"
|
||||||
" - \"output\": forwards the whole audio output, and disables "
|
"The \"output\" source forwards the whole audio output, and "
|
||||||
"playback on the device.\n"
|
"disables playback on the device.\n"
|
||||||
" - \"playback\": captures the audio playback (Android apps "
|
"The \"playback\" source captures the audio playback (Android "
|
||||||
"can opt-out, so the whole output is not necessarily "
|
"apps can opt-out, so the whole output is not necessarily "
|
||||||
"captured).\n"
|
"captured).\n"
|
||||||
" - \"mic\": captures the microphone.\n"
|
"The \"mic\" source captures the microphone.\n"
|
||||||
" - \"mic-unprocessed\": captures the microphone unprocessed "
|
|
||||||
"(raw) sound.\n"
|
|
||||||
" - \"mic-camcorder\": captures the microphone tuned for video "
|
|
||||||
"recording, with the same orientation as the camera if "
|
|
||||||
"available.\n"
|
|
||||||
" - \"mic-voice-recognition\": captures the microphone tuned "
|
|
||||||
"for voice recognition.\n"
|
|
||||||
" - \"mic-voice-communication\": captures the microphone tuned "
|
|
||||||
"for voice communications (it will for instance take advantage "
|
|
||||||
"of echo cancellation or automatic gain control if "
|
|
||||||
"available).\n"
|
|
||||||
" - \"voice-call\": captures voice call.\n"
|
|
||||||
" - \"voice-call-uplink\": captures voice call uplink only.\n"
|
|
||||||
" - \"voice-call-downlink\": captures voice call downlink "
|
|
||||||
"only.\n"
|
|
||||||
" - \"voice-performance\": captures audio meant to be "
|
|
||||||
"processed for live performance (karaoke), includes both the "
|
|
||||||
"microphone and the device playback.\n"
|
|
||||||
"Default is output.",
|
"Default is output.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -385,19 +364,6 @@ static const struct sc_option options[] = {
|
||||||
" scrcpy --list-displays\n"
|
" scrcpy --list-displays\n"
|
||||||
"Default is 0.",
|
"Default is 0.",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.longopt_id = OPT_DISPLAY_IME_POLICY,
|
|
||||||
.longopt = "display-ime-policy",
|
|
||||||
.argdesc = "value",
|
|
||||||
.text = "Set the policy for selecting where the IME should be "
|
|
||||||
"displayed.\n"
|
|
||||||
"Possible values are \"local\", \"fallback\" and \"hide\".\n"
|
|
||||||
"\"local\" means that the IME should appear on the local "
|
|
||||||
"display.\n"
|
|
||||||
"\"fallback\" means that the IME should appear on a fallback "
|
|
||||||
"display (the default display).\n"
|
|
||||||
"\"hide\" means that the IME should be hidden.",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_DISPLAY_ORIENTATION,
|
.longopt_id = OPT_DISPLAY_ORIENTATION,
|
||||||
.longopt = "display-orientation",
|
.longopt = "display-orientation",
|
||||||
|
@ -721,7 +687,8 @@ static const struct sc_option options[] = {
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_NO_WINDOW,
|
.longopt_id = OPT_NO_WINDOW,
|
||||||
.longopt = "no-window",
|
.longopt = "no-window",
|
||||||
.text = "Disable scrcpy window. Implies --no-video-playback.",
|
.text = "Disable scrcpy window. Implies --no-video-playback and "
|
||||||
|
"--no-control.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.longopt_id = OPT_ORIENTATION,
|
.longopt_id = OPT_ORIENTATION,
|
||||||
|
@ -1646,25 +1613,6 @@ parse_audio_output_buffer(const char *s, sc_tick *tick) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
|
||||||
parse_display_ime_policy(const char *s, enum sc_display_ime_policy *policy) {
|
|
||||||
if (!strcmp(s, "local")) {
|
|
||||||
*policy = SC_DISPLAY_IME_POLICY_LOCAL;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!strcmp(s, "fallback")) {
|
|
||||||
*policy = SC_DISPLAY_IME_POLICY_FALLBACK;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!strcmp(s, "hide")) {
|
|
||||||
*policy = SC_DISPLAY_IME_POLICY_HIDE;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
LOGE("Unsupported display IME policy: %s (expected local, fallback or "
|
|
||||||
"hide)", s);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
parse_orientation(const char *s, enum sc_orientation *orientation) {
|
parse_orientation(const char *s, enum sc_orientation *orientation) {
|
||||||
if (!strcmp(s, "0")) {
|
if (!strcmp(s, "0")) {
|
||||||
|
@ -2054,50 +2002,8 @@ parse_audio_source(const char *optarg, enum sc_audio_source *source) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(optarg, "mic-unprocessed")) {
|
LOGE("Unsupported audio source: %s (expected output, mic or playback)",
|
||||||
*source = SC_AUDIO_SOURCE_MIC_UNPROCESSED;
|
optarg);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(optarg, "mic-camcorder")) {
|
|
||||||
*source = SC_AUDIO_SOURCE_MIC_CAMCORDER;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(optarg, "mic-voice-recognition")) {
|
|
||||||
*source = SC_AUDIO_SOURCE_MIC_VOICE_RECOGNITION;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(optarg, "mic-voice-communication")) {
|
|
||||||
*source = SC_AUDIO_SOURCE_MIC_VOICE_COMMUNICATION;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(optarg, "voice-call")) {
|
|
||||||
*source = SC_AUDIO_SOURCE_VOICE_CALL;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(optarg, "voice-call-uplink")) {
|
|
||||||
*source = SC_AUDIO_SOURCE_VOICE_CALL_UPLINK;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(optarg, "voice-call-downlink")) {
|
|
||||||
*source = SC_AUDIO_SOURCE_VOICE_CALL_DOWNLINK;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmp(optarg, "voice-performance")) {
|
|
||||||
*source = SC_AUDIO_SOURCE_VOICE_PERFORMANCE;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOGE("Unsupported audio source: %s (expected output, mic, playback, "
|
|
||||||
"mic-unprocessed, mic-camcorder, mic-voice-recognition, "
|
|
||||||
"mic-voice-communication, voice-call, voice-call-uplink, "
|
|
||||||
"voice-call-downlink, voice-performance)", optarg);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2815,12 +2721,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
case OPT_NO_VD_SYSTEM_DECORATIONS:
|
case OPT_NO_VD_SYSTEM_DECORATIONS:
|
||||||
opts->vd_system_decorations = false;
|
opts->vd_system_decorations = false;
|
||||||
break;
|
break;
|
||||||
case OPT_DISPLAY_IME_POLICY:
|
|
||||||
if (!parse_display_ime_policy(optarg,
|
|
||||||
&opts->display_ime_policy)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
// getopt prints the error message on stderr
|
// getopt prints the error message on stderr
|
||||||
return false;
|
return false;
|
||||||
|
@ -2859,10 +2759,9 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!opts->window) {
|
if (!opts->window) {
|
||||||
// Without window, there cannot be any video playback
|
// Without window, there cannot be any video playback or control
|
||||||
opts->video_playback = false;
|
opts->video_playback = false;
|
||||||
// Controls are still possible, allowing for options like
|
opts->control = false;
|
||||||
// --turn-screen-off
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!opts->video) {
|
if (!opts->video) {
|
||||||
|
@ -3077,12 +2976,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts->display_ime_policy != SC_DISPLAY_IME_POLICY_UNDEFINED) {
|
|
||||||
LOGE("--display-ime-policy is only available with "
|
|
||||||
"--video-source=display");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts->camera_id && opts->camera_facing != SC_CAMERA_FACING_ANY) {
|
if (opts->camera_id && opts->camera_facing != SC_CAMERA_FACING_ANY) {
|
||||||
LOGE("Cannot specify both --camera-id and --camera-facing");
|
LOGE("Cannot specify both --camera-id and --camera-facing");
|
||||||
return false;
|
return false;
|
||||||
|
@ -3124,12 +3017,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts->display_ime_policy != SC_DISPLAY_IME_POLICY_UNDEFINED
|
|
||||||
&& opts->display_id == 0 && !opts->new_display) {
|
|
||||||
LOGE("--display-ime-policy is only supported on a secondary display");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (opts->audio && opts->audio_source == SC_AUDIO_SOURCE_AUTO) {
|
if (opts->audio && opts->audio_source == SC_AUDIO_SOURCE_AUTO) {
|
||||||
// Select the audio source according to the video source
|
// Select the audio source according to the video source
|
||||||
if (opts->video_source == SC_VIDEO_SOURCE_DISPLAY) {
|
if (opts->video_source == SC_VIDEO_SOURCE_DISPLAY) {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#include "decoder.h"
|
#include "decoder.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavcodec/packet.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavutil/avutil.h>
|
#include <libavutil/channel_layout.h>
|
||||||
|
|
||||||
|
#include "events.h"
|
||||||
|
#include "trait/frame_sink.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
/** Downcast packet_sink to decoder */
|
/** Downcast packet_sink to decoder */
|
||||||
|
|
|
@ -3,11 +3,13 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
|
|
||||||
#include "trait/frame_source.h"
|
#include "trait/frame_source.h"
|
||||||
#include "trait/packet_sink.h"
|
#include "trait/packet_sink.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
struct sc_decoder {
|
struct sc_decoder {
|
||||||
struct sc_packet_sink packet_sink; // packet sink trait
|
struct sc_packet_sink packet_sink; // packet sink trait
|
||||||
struct sc_frame_source frame_source; // frame source trait
|
struct sc_frame_source frame_source; // frame source trait
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
|
#include <libavutil/avutil.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <libavutil/frame.h>
|
|
||||||
|
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
#include "trait/frame_source.h"
|
#include "trait/frame_source.h"
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#include "demuxer.h"
|
#include "demuxer.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
#include <libavutil/channel_layout.h>
|
#include <libavutil/channel_layout.h>
|
||||||
|
#include <libavutil/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "decoder.h"
|
||||||
|
#include "events.h"
|
||||||
#include "packet_merger.h"
|
#include "packet_merger.h"
|
||||||
|
#include "recorder.h"
|
||||||
#include "util/binary.h"
|
#include "util/binary.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,12 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
#include "trait/packet_source.h"
|
#include "trait/packet_source.h"
|
||||||
|
#include "trait/packet_sink.h"
|
||||||
#include "util/net.h"
|
#include "util/net.h"
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define DEVICE_MSG_MAX_SIZE (1 << 18) // 256k
|
#define DEVICE_MSG_MAX_SIZE (1 << 18) // 256k
|
||||||
// type: 1 byte; length: 4 bytes
|
// type: 1 byte; length: 4 bytes
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <libavutil/pixfmt.h>
|
#include <libavutil/pixfmt.h>
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavutil/frame.h>
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "file_pusher.h"
|
#include "file_pusher.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "adb/adb.h"
|
#include "adb/adb.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
#include "util/process_intr.h"
|
||||||
|
|
||||||
#define DEFAULT_PUSH_TARGET "/sdcard/Download/"
|
#define DEFAULT_PUSH_TARGET "/sdcard/Download/"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "fps_counter.h"
|
#include "fps_counter.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
|
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
#include "util/tick.h"
|
|
||||||
|
|
||||||
struct sc_fps_counter {
|
struct sc_fps_counter {
|
||||||
sc_thread thread;
|
sc_thread thread;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include "frame_buffer.h"
|
#include "frame_buffer.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <libavutil/avutil.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <libavutil/frame.h>
|
|
||||||
|
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define SC_HID_MAX_SIZE 15
|
#define SC_HID_MAX_SIZE 15
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "util/binary.h"
|
#include "util/binary.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "hid/hid_event.h"
|
#include "hid/hid_event.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#include "hid_keyboard.h"
|
#include "hid_keyboard.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "hid/hid_event.h"
|
#include "hid/hid_event.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "hid_mouse.h"
|
#include "hid_mouse.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position,
|
// 1 byte for buttons + padding, 1 byte for X position, 1 byte for Y position,
|
||||||
// 1 byte for wheel motion
|
// 1 byte for wheel motion
|
||||||
#define SC_HID_MOUSE_INPUT_SIZE 4
|
#define SC_HID_MOUSE_INPUT_SIZE 4
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "hid/hid_event.h"
|
#include "hid/hid_event.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
||||||
|
|
|
@ -2,22 +2,17 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavutil/avutil.h>
|
|
||||||
#include <libavutil/pixdesc.h>
|
#include <libavutil/pixdesc.h>
|
||||||
#include <libavutil/pixfmt.h>
|
#include <libavutil/pixfmt.h>
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "compat.h"
|
||||||
#include "util/env.h"
|
#include "util/env.h"
|
||||||
#ifdef PORTABLE
|
#include "util/file.h"
|
||||||
# include "util/file.h"
|
|
||||||
#endif
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
#include "util/str.h"
|
||||||
|
|
||||||
#define SCRCPY_PORTABLE_ICON_FILENAME "icon.png"
|
#define SCRCPY_PORTABLE_ICON_FILENAME "icon.png"
|
||||||
#define SCRCPY_DEFAULT_ICON_PATH \
|
#define SCRCPY_DEFAULT_ICON_PATH \
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <SDL2/SDL_surface.h>
|
#include <stdbool.h>
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
SDL_Surface *
|
SDL_Surface *
|
||||||
scrcpy_icon_load(void);
|
scrcpy_icon_load(void);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <SDL2/SDL_events.h>
|
#include <SDL2/SDL_events.h>
|
||||||
|
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
/* The representation of input events in scrcpy is very close to the SDL API,
|
/* The representation of input events in scrcpy is very close to the SDL API,
|
||||||
* for simplicity.
|
* for simplicity.
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
#include "input_manager.h"
|
#include "input_manager.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <SDL2/SDL_keycode.h>
|
||||||
#include <string.h>
|
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
|
|
||||||
#include "android/input.h"
|
|
||||||
#include "android/keycodes.h"
|
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "shortcut_mod.h"
|
#include "shortcut_mod.h"
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <SDL2/SDL_events.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <SDL2/SDL_keycode.h>
|
|
||||||
|
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "file_pusher.h"
|
#include "file_pusher.h"
|
||||||
|
#include "fps_counter.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "trait/gamepad_processor.h"
|
#include "trait/gamepad_processor.h"
|
||||||
#include "trait/key_processor.h"
|
#include "trait/key_processor.h"
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
#include "keyboard_sdk.h"
|
#include "keyboard_sdk.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "android/input.h"
|
#include "android/input.h"
|
||||||
#include "android/keycodes.h"
|
|
||||||
#include "control_msg.h"
|
#include "control_msg.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
# include <libavdevice/avdevice.h>
|
# include <libavdevice/avdevice.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#include "mouse_sdk.h"
|
#include "mouse_sdk.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "android/input.h"
|
#include "android/input.h"
|
||||||
#include "control_msg.h"
|
#include "control_msg.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
#include "util/intmap.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
/** Downcast mouse processor to sc_mouse_sdk */
|
/** Downcast mouse processor to sc_mouse_sdk */
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
|
#include "screen.h"
|
||||||
#include "trait/mouse_processor.h"
|
#include "trait/mouse_processor.h"
|
||||||
|
|
||||||
struct sc_mouse_sdk {
|
struct sc_mouse_sdk {
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include "SDL2/SDL.h"
|
||||||
#include <SDL2/SDL.h>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sc_opengl_init(struct sc_opengl *gl) {
|
sc_opengl_init(struct sc_opengl *gl) {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
const struct scrcpy_options scrcpy_options_default = {
|
const struct scrcpy_options scrcpy_options_default = {
|
||||||
.serial = NULL,
|
.serial = NULL,
|
||||||
.crop = NULL,
|
.crop = NULL,
|
||||||
|
@ -56,7 +54,6 @@ const struct scrcpy_options scrcpy_options_default = {
|
||||||
.capture_orientation_lock = SC_ORIENTATION_UNLOCKED,
|
.capture_orientation_lock = SC_ORIENTATION_UNLOCKED,
|
||||||
.display_orientation = SC_ORIENTATION_0,
|
.display_orientation = SC_ORIENTATION_0,
|
||||||
.record_orientation = SC_ORIENTATION_0,
|
.record_orientation = SC_ORIENTATION_0,
|
||||||
.display_ime_policy = SC_DISPLAY_IME_POLICY_UNDEFINED,
|
|
||||||
.window_x = SC_WINDOW_POSITION_UNDEFINED,
|
.window_x = SC_WINDOW_POSITION_UNDEFINED,
|
||||||
.window_y = SC_WINDOW_POSITION_UNDEFINED,
|
.window_y = SC_WINDOW_POSITION_UNDEFINED,
|
||||||
.window_width = 0,
|
.window_width = 0,
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "util/tick.h"
|
#include "util/tick.h"
|
||||||
|
@ -59,14 +60,6 @@ enum sc_audio_source {
|
||||||
SC_AUDIO_SOURCE_OUTPUT,
|
SC_AUDIO_SOURCE_OUTPUT,
|
||||||
SC_AUDIO_SOURCE_MIC,
|
SC_AUDIO_SOURCE_MIC,
|
||||||
SC_AUDIO_SOURCE_PLAYBACK,
|
SC_AUDIO_SOURCE_PLAYBACK,
|
||||||
SC_AUDIO_SOURCE_MIC_UNPROCESSED,
|
|
||||||
SC_AUDIO_SOURCE_MIC_CAMCORDER,
|
|
||||||
SC_AUDIO_SOURCE_MIC_VOICE_RECOGNITION,
|
|
||||||
SC_AUDIO_SOURCE_MIC_VOICE_COMMUNICATION,
|
|
||||||
SC_AUDIO_SOURCE_VOICE_CALL,
|
|
||||||
SC_AUDIO_SOURCE_VOICE_CALL_UPLINK,
|
|
||||||
SC_AUDIO_SOURCE_VOICE_CALL_DOWNLINK,
|
|
||||||
SC_AUDIO_SOURCE_VOICE_PERFORMANCE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sc_camera_facing {
|
enum sc_camera_facing {
|
||||||
|
@ -97,13 +90,6 @@ enum sc_orientation_lock {
|
||||||
SC_ORIENTATION_LOCKED_INITIAL, // lock to initial device orientation
|
SC_ORIENTATION_LOCKED_INITIAL, // lock to initial device orientation
|
||||||
};
|
};
|
||||||
|
|
||||||
enum sc_display_ime_policy {
|
|
||||||
SC_DISPLAY_IME_POLICY_UNDEFINED,
|
|
||||||
SC_DISPLAY_IME_POLICY_LOCAL,
|
|
||||||
SC_DISPLAY_IME_POLICY_FALLBACK,
|
|
||||||
SC_DISPLAY_IME_POLICY_HIDE,
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
sc_orientation_is_mirror(enum sc_orientation orientation) {
|
sc_orientation_is_mirror(enum sc_orientation orientation) {
|
||||||
assert(!(orientation & ~7));
|
assert(!(orientation & ~7));
|
||||||
|
@ -266,7 +252,6 @@ struct scrcpy_options {
|
||||||
enum sc_orientation_lock capture_orientation_lock;
|
enum sc_orientation_lock capture_orientation_lock;
|
||||||
enum sc_orientation display_orientation;
|
enum sc_orientation display_orientation;
|
||||||
enum sc_orientation record_orientation;
|
enum sc_orientation record_orientation;
|
||||||
enum sc_display_ime_policy display_ime_policy;
|
|
||||||
int16_t window_x; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
int16_t window_x; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
||||||
int16_t window_y; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
int16_t window_y; // SC_WINDOW_POSITION_UNDEFINED for "auto"
|
||||||
uint16_t window_width;
|
uint16_t window_width;
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#include "packet_merger.h"
|
#include "packet_merger.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <libavutil/avutil.h>
|
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <libavcodec/packet.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Config packets (containing the SPS/PPS) are sent in-band. A new config
|
* Config packets (containing the SPS/PPS) are sent in-band. A new config
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <SDL2/SDL_clipboard.h>
|
#include <SDL2/SDL_clipboard.h>
|
||||||
|
|
||||||
#include "device_msg.h"
|
#include "device_msg.h"
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
#include "recorder.h"
|
#include "recorder.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavutil/time.h>
|
#include <libavutil/time.h>
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <libavcodec/packet.h>
|
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
|
|
||||||
|
#include "coords.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "trait/packet_sink.h"
|
#include "trait/packet_sink.h"
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#include "scrcpy.h"
|
#include "scrcpy.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -38,9 +37,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include "util/acksync.h"
|
#include "util/acksync.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
#include "util/net.h"
|
||||||
#include "util/rand.h"
|
#include "util/rand.h"
|
||||||
#include "util/timeout.h"
|
#include "util/timeout.h"
|
||||||
#include "util/tick.h"
|
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
# include "v4l2_sink.h"
|
# include "v4l2_sink.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -436,7 +435,6 @@ scrcpy(struct scrcpy_options *options) {
|
||||||
.control = options->control,
|
.control = options->control,
|
||||||
.display_id = options->display_id,
|
.display_id = options->display_id,
|
||||||
.new_display = options->new_display,
|
.new_display = options->new_display,
|
||||||
.display_ime_policy = options->display_ime_policy,
|
|
||||||
.video = options->video,
|
.video = options->video,
|
||||||
.audio = options->audio,
|
.audio = options->audio,
|
||||||
.audio_dup = options->audio_dup,
|
.audio_dup = options->audio_dup,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
enum scrcpy_exit_code {
|
enum scrcpy_exit_code {
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
#ifndef SC_SCREEN_H
|
#ifndef SCREEN_H
|
||||||
#define SC_SCREEN_H
|
#define SCREEN_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavutil/frame.h>
|
|
||||||
#include <libavutil/pixfmt.h>
|
|
||||||
|
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "coords.h"
|
#include "coords.h"
|
||||||
|
@ -17,6 +14,7 @@
|
||||||
#include "frame_buffer.h"
|
#include "frame_buffer.h"
|
||||||
#include "input_manager.h"
|
#include "input_manager.h"
|
||||||
#include "mouse_capture.h"
|
#include "mouse_capture.h"
|
||||||
|
#include "opengl.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "trait/key_processor.h"
|
#include "trait/key_processor.h"
|
||||||
#include "trait/frame_sink.h"
|
#include "trait/frame_sink.h"
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <SDL2/SDL_timer.h>
|
||||||
#include <string.h>
|
#include <SDL2/SDL_platform.h>
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "adb/adb.h"
|
#include "adb/adb.h"
|
||||||
|
#include "util/binary.h"
|
||||||
#include "util/env.h"
|
#include "util/env.h"
|
||||||
#include "util/file.h"
|
#include "util/file.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/net_intr.h"
|
#include "util/net_intr.h"
|
||||||
#include "util/process.h"
|
#include "util/process_intr.h"
|
||||||
#include "util/str.h"
|
#include "util/str.h"
|
||||||
|
|
||||||
#define SC_SERVER_FILENAME "scrcpy-server"
|
#define SC_SERVER_FILENAME "scrcpy-server"
|
||||||
|
@ -149,43 +150,12 @@ sc_server_get_audio_source_name(enum sc_audio_source audio_source) {
|
||||||
return "mic";
|
return "mic";
|
||||||
case SC_AUDIO_SOURCE_PLAYBACK:
|
case SC_AUDIO_SOURCE_PLAYBACK:
|
||||||
return "playback";
|
return "playback";
|
||||||
case SC_AUDIO_SOURCE_MIC_UNPROCESSED:
|
|
||||||
return "mic-unprocessed";
|
|
||||||
case SC_AUDIO_SOURCE_MIC_CAMCORDER:
|
|
||||||
return "mic-camcorder";
|
|
||||||
case SC_AUDIO_SOURCE_MIC_VOICE_RECOGNITION:
|
|
||||||
return "mic-voice-recognition";
|
|
||||||
case SC_AUDIO_SOURCE_MIC_VOICE_COMMUNICATION:
|
|
||||||
return "mic-voice-communication";
|
|
||||||
case SC_AUDIO_SOURCE_VOICE_CALL:
|
|
||||||
return "voice-call";
|
|
||||||
case SC_AUDIO_SOURCE_VOICE_CALL_UPLINK:
|
|
||||||
return "voice-call-uplink";
|
|
||||||
case SC_AUDIO_SOURCE_VOICE_CALL_DOWNLINK:
|
|
||||||
return "voice-call-downlink";
|
|
||||||
case SC_AUDIO_SOURCE_VOICE_PERFORMANCE:
|
|
||||||
return "voice-performance";
|
|
||||||
default:
|
default:
|
||||||
assert(!"unexpected audio source");
|
assert(!"unexpected audio source");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
|
||||||
sc_server_get_display_ime_policy_name(enum sc_display_ime_policy policy) {
|
|
||||||
switch (policy) {
|
|
||||||
case SC_DISPLAY_IME_POLICY_LOCAL:
|
|
||||||
return "local";
|
|
||||||
case SC_DISPLAY_IME_POLICY_FALLBACK:
|
|
||||||
return "fallback";
|
|
||||||
case SC_DISPLAY_IME_POLICY_HIDE:
|
|
||||||
return "hide";
|
|
||||||
default:
|
|
||||||
assert(!"unexpected display IME policy");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
validate_string(const char *s) {
|
validate_string(const char *s) {
|
||||||
// The parameters values are passed as command line arguments to adb, so
|
// The parameters values are passed as command line arguments to adb, so
|
||||||
|
@ -407,10 +377,6 @@ execute_server(struct sc_server *server,
|
||||||
VALIDATE_STRING(params->new_display);
|
VALIDATE_STRING(params->new_display);
|
||||||
ADD_PARAM("new_display=%s", params->new_display);
|
ADD_PARAM("new_display=%s", params->new_display);
|
||||||
}
|
}
|
||||||
if (params->display_ime_policy != SC_DISPLAY_IME_POLICY_UNDEFINED) {
|
|
||||||
ADD_PARAM("display_ime_policy=%s",
|
|
||||||
sc_server_get_display_ime_policy_name(params->display_ime_policy));
|
|
||||||
}
|
|
||||||
if (!params->vd_destroy_content) {
|
if (!params->vd_destroy_content) {
|
||||||
ADD_PARAM("vd_destroy_content=false");
|
ADD_PARAM("vd_destroy_content=false");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,19 @@
|
||||||
#ifndef SC_SERVER_H
|
#ifndef SERVER_H
|
||||||
#define SC_SERVER_H
|
#define SERVER_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdatomic.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "adb/adb_tunnel.h"
|
#include "adb/adb_tunnel.h"
|
||||||
|
#include "coords.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "util/intr.h"
|
#include "util/intr.h"
|
||||||
|
#include "util/log.h"
|
||||||
#include "util/net.h"
|
#include "util/net.h"
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
#include "util/tick.h"
|
|
||||||
|
|
||||||
#define SC_DEVICE_NAME_FIELD_LENGTH 64
|
#define SC_DEVICE_NAME_FIELD_LENGTH 64
|
||||||
struct sc_server_info {
|
struct sc_server_info {
|
||||||
|
@ -50,7 +52,6 @@ struct sc_server_params {
|
||||||
bool control;
|
bool control;
|
||||||
uint32_t display_id;
|
uint32_t display_id;
|
||||||
const char *new_display;
|
const char *new_display;
|
||||||
enum sc_display_ime_policy display_ime_policy;
|
|
||||||
bool video;
|
bool video;
|
||||||
bool audio;
|
bool audio;
|
||||||
bool audio_dup;
|
bool audio_dup;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <SDL2/SDL_keycode.h>
|
#include <SDL2/SDL_keycode.h>
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
#include "util/file.h"
|
#include "util/file.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
# include <mach-o/dyld.h> // for _NSGetExecutablePath()
|
# include <mach-o/dyld.h> // for _NSGetExecutablePath()
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "frame_source.h"
|
#include "frame_source.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sc_frame_source_init(struct sc_frame_source *source) {
|
sc_frame_source_init(struct sc_frame_source *source) {
|
||||||
source->sink_count = 0;
|
source->sink_count = 0;
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include "frame_sink.h"
|
||||||
|
|
||||||
#include "trait/frame_sink.h"
|
|
||||||
|
|
||||||
#define SC_FRAME_SOURCE_MAX_SINKS 2
|
#define SC_FRAME_SOURCE_MAX_SINKS 2
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "packet_source.h"
|
#include "packet_source.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
void
|
void
|
||||||
sc_packet_source_init(struct sc_packet_source *source) {
|
sc_packet_source_init(struct sc_packet_source *source) {
|
||||||
source->sink_count = 0;
|
source->sink_count = 0;
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include "packet_sink.h"
|
||||||
|
|
||||||
#include "trait/packet_sink.h"
|
|
||||||
|
|
||||||
#define SC_PACKET_SOURCE_MAX_SINKS 2
|
#define SC_PACKET_SOURCE_MAX_SINKS 2
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
#include "gamepad_uhid.h"
|
#include "gamepad_uhid.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <SDL2/SDL_gamecontroller.h>
|
|
||||||
|
|
||||||
#include "hid/hid_gamepad.h"
|
#include "hid/hid_gamepad.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "hid/hid_gamepad.h"
|
#include "hid/hid_gamepad.h"
|
||||||
#include "trait/gamepad_processor.h"
|
#include "trait/gamepad_processor.h"
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
#include "keyboard_uhid.h"
|
#include "keyboard_uhid.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <SDL2/SDL_keyboard.h>
|
|
||||||
#include <SDL2/SDL_keycode.h>
|
|
||||||
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/thread.h"
|
|
||||||
|
|
||||||
/** Downcast key processor to keyboard_uhid */
|
/** Downcast key processor to keyboard_uhid */
|
||||||
#define DOWNCAST(KP) container_of(KP, struct sc_keyboard_uhid, key_processor)
|
#define DOWNCAST(KP) container_of(KP, struct sc_keyboard_uhid, key_processor)
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
#include "mouse_uhid.h"
|
#include "mouse_uhid.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "hid/hid_mouse.h"
|
#include "hid/hid_mouse.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "uhid_output.h"
|
#include "uhid_output.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
#include "uhid/keyboard_uhid.h"
|
#include "uhid/keyboard_uhid.h"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,16 +1,13 @@
|
||||||
#include "aoa_hid.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <libusb-1.0/libusb.h>
|
|
||||||
|
|
||||||
|
#include "aoa_hid.h"
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
#include "util/str.h"
|
#include "util/str.h"
|
||||||
#include "util/tick.h"
|
|
||||||
#include "util/vector.h"
|
#include "util/vector.h"
|
||||||
|
|
||||||
// See <https://source.android.com/devices/accessories/aoa2#hid-support>.
|
// See <https://source.android.com/devices/accessories/aoa2#hid-support>.
|
||||||
|
|
|
@ -3,13 +3,16 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <libusb-1.0/libusb.h>
|
||||||
|
|
||||||
#include "hid/hid_event.h"
|
#include "hid/hid_event.h"
|
||||||
#include "usb/usb.h"
|
#include "usb.h"
|
||||||
#include "util/acksync.h"
|
#include "util/acksync.h"
|
||||||
#include "util/thread.h"
|
#include "util/thread.h"
|
||||||
|
#include "util/tick.h"
|
||||||
#include "util/vecdeque.h"
|
#include "util/vecdeque.h"
|
||||||
|
|
||||||
enum sc_aoa_event_type {
|
enum sc_aoa_event_type {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "gamepad_aoa.h"
|
#include "gamepad_aoa.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "aoa_hid.h"
|
||||||
#include "hid/hid_gamepad.h"
|
#include "hid/hid_gamepad.h"
|
||||||
#include "usb/aoa_hid.h"
|
|
||||||
#include "trait/gamepad_processor.h"
|
#include "trait/gamepad_processor.h"
|
||||||
|
|
||||||
struct sc_gamepad_aoa {
|
struct sc_gamepad_aoa {
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "aoa_hid.h"
|
||||||
#include "hid/hid_keyboard.h"
|
#include "hid/hid_keyboard.h"
|
||||||
#include "usb/aoa_hid.h"
|
|
||||||
#include "trait/key_processor.h"
|
#include "trait/key_processor.h"
|
||||||
|
|
||||||
struct sc_keyboard_aoa {
|
struct sc_keyboard_aoa {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "mouse_aoa.h"
|
#include "mouse_aoa.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "hid/hid_mouse.h"
|
#include "hid/hid_mouse.h"
|
||||||
#include "input_events.h"
|
#include "input_events.h"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "usb/aoa_hid.h"
|
#include "aoa_hid.h"
|
||||||
#include "trait/mouse_processor.h"
|
#include "trait/mouse_processor.h"
|
||||||
|
|
||||||
struct sc_mouse_aoa {
|
struct sc_mouse_aoa {
|
||||||
|
|
|
@ -1,19 +1,10 @@
|
||||||
#include "scrcpy_otg.h"
|
#include "scrcpy_otg.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#include "adb/adb.h"
|
||||||
# include "adb/adb.h"
|
|
||||||
#endif
|
|
||||||
#include "events.h"
|
#include "events.h"
|
||||||
#include "usb/screen_otg.h"
|
#include "screen_otg.h"
|
||||||
#include "usb/aoa_hid.h"
|
|
||||||
#include "usb/gamepad_aoa.h"
|
|
||||||
#include "usb/keyboard_aoa.h"
|
|
||||||
#include "usb/mouse_aoa.h"
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
struct scrcpy_otg {
|
struct scrcpy_otg {
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
#include "screen_otg.h"
|
#include "screen_otg.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#include "icon.h"
|
#include "icon.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "util/acksync.h"
|
|
||||||
#include "util/log.h"
|
#include "util/log.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -4,13 +4,12 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
|
#include "keyboard_aoa.h"
|
||||||
|
#include "mouse_aoa.h"
|
||||||
#include "mouse_capture.h"
|
#include "mouse_capture.h"
|
||||||
#include "usb/gamepad_aoa.h"
|
#include "gamepad_aoa.h"
|
||||||
#include "usb/keyboard_aoa.h"
|
|
||||||
#include "usb/mouse_aoa.h"
|
|
||||||
|
|
||||||
struct sc_screen_otg {
|
struct sc_screen_otg {
|
||||||
struct sc_keyboard_aoa *keyboard;
|
struct sc_keyboard_aoa *keyboard;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "acksync.h"
|
#include "acksync.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include "util/log.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
sc_acksync_init(struct sc_acksync *as) {
|
sc_acksync_init(struct sc_acksync *as) {
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include "thread.h"
|
||||||
#include <stdint.h>
|
|
||||||
#include "util/thread.h"
|
|
||||||
#include "util/tick.h"
|
|
||||||
|
|
||||||
#define SC_SEQUENCE_INVALID 0
|
#define SC_SEQUENCE_INVALID 0
|
||||||
|
|
||||||
|
|
|
@ -116,38 +116,3 @@ sc_audiobuf_write(struct sc_audiobuf *buf, const void *from_,
|
||||||
|
|
||||||
return samples_count;
|
return samples_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
|
||||||
sc_audiobuf_write_silence(struct sc_audiobuf *buf, uint32_t samples_count) {
|
|
||||||
// Only the writer thread can write head, so memory_order_relaxed is
|
|
||||||
// sufficient
|
|
||||||
uint32_t head = atomic_load_explicit(&buf->head, memory_order_relaxed);
|
|
||||||
|
|
||||||
// The tail cursor is updated after the data is consumed by the reader
|
|
||||||
uint32_t tail = atomic_load_explicit(&buf->tail, memory_order_acquire);
|
|
||||||
|
|
||||||
uint32_t can_write = (buf->alloc_size + tail - head - 1) % buf->alloc_size;
|
|
||||||
if (!can_write) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (samples_count > can_write) {
|
|
||||||
samples_count = can_write;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t right_count = buf->alloc_size - head;
|
|
||||||
if (right_count > samples_count) {
|
|
||||||
right_count = samples_count;
|
|
||||||
}
|
|
||||||
memset(buf->data + (head * buf->sample_size), 0,
|
|
||||||
right_count * buf->sample_size);
|
|
||||||
|
|
||||||
if (samples_count > right_count) {
|
|
||||||
uint32_t left_count = samples_count - right_count;
|
|
||||||
memset(buf->data, 0, left_count * buf->sample_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t new_head = (head + samples_count) % buf->alloc_size;
|
|
||||||
atomic_store_explicit(&buf->head, new_head, memory_order_release);
|
|
||||||
|
|
||||||
return samples_count;
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdatomic.h>
|
#include <stdatomic.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,9 +49,6 @@ uint32_t
|
||||||
sc_audiobuf_write(struct sc_audiobuf *buf, const void *from,
|
sc_audiobuf_write(struct sc_audiobuf *buf, const void *from,
|
||||||
uint32_t samples_count);
|
uint32_t samples_count);
|
||||||
|
|
||||||
uint32_t
|
|
||||||
sc_audiobuf_write_silence(struct sc_audiobuf *buf, uint32_t samples);
|
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
sc_audiobuf_capacity(struct sc_audiobuf *buf) {
|
sc_audiobuf_capacity(struct sc_audiobuf *buf) {
|
||||||
assert(buf->alloc_size);
|
assert(buf->alloc_size);
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
struct sc_average {
|
struct sc_average {
|
||||||
// Current average value
|
// Current average value
|
||||||
float avg;
|
float avg;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue