Compare commits

..

1 Commits

Author SHA1 Message Date
548d2c755f Log gamepad added/removed
Add a log when a gamepad is added or removed.
2024-12-08 17:07:03 +01:00
136 changed files with 222 additions and 430 deletions

View File

@ -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

View File

@ -2,7 +2,7 @@
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.1) # scrcpy (v3.0.2)
<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" />

View File

@ -1,68 +0,0 @@
#!/usr/bin/env bash
set -ex
DEPS_DIR=$(dirname ${BASH_SOURCE[0]})
cd "$DEPS_DIR"
. common
process_args "$@"
VERSION=1.5.0
FILENAME=dav1d-$VERSION.tar.gz
PROJECT_DIR=dav1d-$VERSION
SHA256SUM=78b15d9954b513ea92d27f39362535ded2243e1b0924fde39f37a31ebed5f76b
cd "$SOURCES_DIR"
if [[ -d "$PROJECT_DIR" ]]
then
echo "$PWD/$PROJECT_DIR" found
else
get_file "https://code.videolan.org/videolan/dav1d/-/archive/$VERSION/$FILENAME" "$FILENAME" "$SHA256SUM"
tar xf "$FILENAME" # First level directory is "$PROJECT_DIR"
fi
mkdir -p "$BUILD_DIR/$PROJECT_DIR"
cd "$BUILD_DIR/$PROJECT_DIR"
if [[ -d "$DIRNAME" ]]
then
echo "'$PWD/$DIRNAME' already exists, not reconfigured"
cd "$DIRNAME"
else
mkdir "$DIRNAME"
cd "$DIRNAME"
conf=(
--prefix="$INSTALL_DIR/$DIRNAME"
--libdir=lib
-Denable_tests=false
-Denable_tools=false
# Always build dav1d statically
--default-library=static
)
if [[ "$BUILD_TYPE" == cross ]]
then
case "$HOST" in
win32)
conf+=(
--cross-file="$SOURCES_DIR/$PROJECT_DIR/package/crossfiles/i686-w64-mingw32.meson"
)
;;
win64)
conf+=(
--cross-file="$SOURCES_DIR/$PROJECT_DIR/package/crossfiles/x86_64-w64-mingw32.meson"
)
;;
*)
echo "Unsupported host: $HOST" >&2
exit 1
esac
fi
meson setup . "$SOURCES_DIR/$PROJECT_DIR" "${conf[@]}"
fi
ninja
ninja install

View File

@ -40,14 +40,16 @@ else
export LDFLAGS='-static-libgcc -static' export LDFLAGS='-static-libgcc -static'
elif [[ "$HOST" == "macos" ]] elif [[ "$HOST" == "macos" ]]
then then
export LDFLAGS="$LDFLAGS -L/opt/homebrew/opt/zlib/lib"
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/zlib/include"
export LDFLAGS="$LDFLAGS-L/opt/homebrew/opt/libiconv/lib"
export CPPFLAGS="$CPPFLAGS -I/opt/homebrew/opt/libiconv/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig" export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig"
fi fi
export PKG_CONFIG_PATH="$INSTALL_DIR/$DIRNAME/lib/pkgconfig:$PKG_CONFIG_PATH"
conf=( conf=(
--prefix="$INSTALL_DIR/$DIRNAME" --prefix="$INSTALL_DIR/$DIRNAME"
--pkg-config-flags="--static"
--extra-cflags="-O2 -fPIC" --extra-cflags="-O2 -fPIC"
--disable-programs --disable-programs
--disable-doc --disable-doc
@ -60,11 +62,9 @@ else
--disable-vaapi --disable-vaapi
--disable-vdpau --disable-vdpau
--enable-swresample --enable-swresample
--enable-libdav1d
--enable-decoder=h264 --enable-decoder=h264
--enable-decoder=hevc --enable-decoder=hevc
--enable-decoder=av1 --enable-decoder=av1
--enable-decoder=libdav1d
--enable-decoder=pcm_s16le --enable-decoder=pcm_s16le
--enable-decoder=opus --enable-decoder=opus
--enable-decoder=aac --enable-decoder=aac

View File

@ -5,10 +5,10 @@ cd "$DEPS_DIR"
. common . common
process_args "$@" process_args "$@"
VERSION=2.30.10 VERSION=2.30.9
FILENAME=SDL-$VERSION.tar.gz FILENAME=SDL-$VERSION.tar.gz
PROJECT_DIR=SDL-release-$VERSION PROJECT_DIR=SDL-release-$VERSION
SHA256SUM=35a8b9c4f3635d85762b904ac60ca4e0806bff89faeb269caafbe80860d67168 SHA256SUM=682a055004081e37d81a7d4ce546c3ee3ef2e0e6a675ed2651e430ccd14eb407
cd "$SOURCES_DIR" cd "$SOURCES_DIR"

View File

@ -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

View File

@ -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.1" VALUE "ProductVersion", "3.0.2"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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"

View File

@ -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`

View File

@ -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) {

View File

@ -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"

View File

@ -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>

View File

@ -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"

View File

@ -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)

View File

@ -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 */

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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/"

View File

@ -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"

View File

@ -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;

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"

View File

@ -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 \

View File

@ -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);

View File

@ -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.

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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 */

View File

@ -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 {

View File

@ -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) {

View File

@ -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,

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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>

View File

@ -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"

View File

@ -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

View File

@ -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 {

View File

@ -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"

View File

@ -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"

View File

@ -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 {

View File

@ -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>

View File

@ -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()

View File

@ -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>

View File

@ -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>

View File

@ -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;

View File

@ -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

View File

@ -3,6 +3,9 @@
#include "common.h" #include "common.h"
#include <assert.h>
#include <stdbool.h>
#include "input_events.h" #include "input_events.h"
/** /**

View File

@ -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"

View File

@ -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"

View File

@ -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>

View File

@ -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;

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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)

View File

@ -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"

View File

@ -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"

View File

@ -3,7 +3,7 @@
#include "common.h" #include "common.h"
#include <stddef.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
/** /**

View File

@ -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>.

View File

@ -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 {

View File

@ -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"

View File

@ -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 {

View File

@ -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 {

View File

@ -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"

View File

@ -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 {

View File

@ -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 {

View File

@ -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

View File

@ -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;

View File

@ -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) {

View File

@ -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

View File

@ -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>
/** /**

View File

@ -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;

View File

@ -4,6 +4,7 @@
#include "common.h" #include "common.h"
#include <assert.h> #include <assert.h>
#include <stdbool.h>
#include <stdint.h> #include <stdint.h>
static inline void static inline void

View File

@ -2,9 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef _WIN32 #include "util/str.h"
# include "util/str.h"
#endif
char * char *
sc_get_env(const char *varname) { sc_get_env(const char *varname) {

View File

@ -3,7 +3,6 @@
#include "common.h" #include "common.h"
#include <stddef.h>
#include <stdint.h> #include <stdint.h>
struct sc_intmap_entry { struct sc_intmap_entry {

View File

@ -1,9 +1,9 @@
#include "intr.h" #include "intr.h"
#include <assert.h>
#include "util/log.h" #include "util/log.h"
#include <assert.h>
bool bool
sc_intr_init(struct sc_intr *intr) { sc_intr_init(struct sc_intr *intr) {
bool ok = sc_mutex_init(&intr->mutex); bool ok = sc_mutex_init(&intr->mutex);

View File

@ -6,9 +6,9 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include "util/net.h" #include "net.h"
#include "util/process.h" #include "process.h"
#include "util/thread.h" #include "thread.h"
/** /**
* Interruptor to wake up a blocking call from another thread * Interruptor to wake up a blocking call from another thread

View File

@ -4,10 +4,7 @@
# include <windows.h> # include <windows.h>
#endif #endif
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <libavformat/avformat.h>
#include <stdio.h>
#include <stdlib.h>
#include <libavutil/log.h>
static SDL_LogPriority static SDL_LogPriority
log_level_sc_to_sdl(enum sc_log_level level) { log_level_sc_to_sdl(enum sc_log_level level) {

View File

@ -1,27 +1,28 @@
#include "net.h" #include "net.h"
#include <assert.h> #include <assert.h>
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include "log.h"
#ifdef _WIN32 #ifdef _WIN32
# include <ws2tcpip.h> # include <ws2tcpip.h>
typedef int socklen_t; typedef int socklen_t;
#else #else
# include <arpa/inet.h> # include <sys/types.h>
# include <fcntl.h> # include <sys/socket.h>
# include <netinet/in.h> # include <netinet/in.h>
# include <netinet/tcp.h> # include <netinet/tcp.h>
# include <arpa/inet.h>
# include <unistd.h> # include <unistd.h>
# include <sys/socket.h> # include <fcntl.h>
# include <sys/types.h>
# define SOCKET_ERROR -1 # define SOCKET_ERROR -1
typedef struct sockaddr_in SOCKADDR_IN; typedef struct sockaddr_in SOCKADDR_IN;
typedef struct sockaddr SOCKADDR; typedef struct sockaddr SOCKADDR;
typedef struct in_addr IN_ADDR; typedef struct in_addr IN_ADDR;
#endif #endif
#include "util/log.h"
bool bool
net_init(void) { net_init(void) {
#ifdef _WIN32 #ifdef _WIN32

Some files were not shown because too many files have changed in this diff Show More