mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Compare commits
124 Commits
v0.22.0
...
feat/new-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3888ec8da0 | ||
|
|
7fb8c76590 | ||
|
|
9288775351 | ||
|
|
067efc7912 | ||
|
|
68c0f53bfc | ||
|
|
dc22e24744 | ||
|
|
8eead6597e | ||
|
|
6c0b01737f | ||
|
|
b4e6873649 | ||
|
|
24597178c7 | ||
|
|
05416bb9c2 | ||
|
|
15386f386a | ||
|
|
38fa794009 | ||
|
|
75fce21761 | ||
|
|
abe256144a | ||
|
|
ad2483416d | ||
|
|
87def6db85 | ||
|
|
9e0182be9c | ||
|
|
50a02dbce5 | ||
|
|
69191cafe9 | ||
|
|
c896dabb82 | ||
|
|
ec8170cb40 | ||
|
|
5db8af8a3f | ||
|
|
76d08eb883 | ||
|
|
fb4d4f50ec | ||
|
|
358bb30c3c | ||
|
|
25d8e2b478 | ||
|
|
a4d9ee3fa4 | ||
|
|
f87bc86b4a | ||
|
|
fcd4c07bd0 | ||
|
|
5c1bad7155 | ||
|
|
d14323244e | ||
|
|
6a01e58f61 | ||
|
|
ad66fcb243 | ||
|
|
ad5b816261 | ||
|
|
7602fa110c | ||
|
|
7e26d2fd30 | ||
|
|
116e59292a | ||
|
|
1a48244a0a | ||
|
|
33ba03c679 | ||
|
|
93e622342c | ||
|
|
7f795f0e19 | ||
|
|
b7aa8119f1 | ||
|
|
3c13027a61 | ||
|
|
1e77d0a509 | ||
|
|
59ce8deb97 | ||
|
|
1ed22ab3b2 | ||
|
|
42b4192a04 | ||
|
|
4fe3848d32 | ||
|
|
89207a13f2 | ||
|
|
cd465652f0 | ||
|
|
699b2c160e | ||
|
|
e1588787f0 | ||
|
|
73fe31dbd2 | ||
|
|
2da6fb050a | ||
|
|
a1edc246f5 | ||
|
|
bb7c2d50ef | ||
|
|
6d1805b3fa | ||
|
|
9020c2c229 | ||
|
|
b4739b05c6 | ||
|
|
1329c510b1 | ||
|
|
991fab9370 | ||
|
|
376a2822bd | ||
|
|
2b059c6797 | ||
|
|
ae71a6ad83 | ||
|
|
2af0ce364d | ||
|
|
3b6a59af05 | ||
|
|
526121d81d | ||
|
|
e5ef0375f3 | ||
|
|
de97eacd30 | ||
|
|
1bd75bbeb0 | ||
|
|
8f1692a5ac | ||
|
|
8eb3ea4fa3 | ||
|
|
13aea3cbd8 | ||
|
|
89e8b9628c | ||
|
|
934f81182a | ||
|
|
87774333f3 | ||
|
|
8ba64ffa32 | ||
|
|
968b7963ee | ||
|
|
61df838356 | ||
|
|
d1845df0ea | ||
|
|
9ef63ca829 | ||
|
|
8316f44e10 | ||
|
|
7534fa1023 | ||
|
|
bd5c50041c | ||
|
|
15c5e76ed4 | ||
|
|
8c9e14e335 | ||
|
|
aa1985dec8 | ||
|
|
f66a7d5da6 | ||
|
|
b523945f48 | ||
|
|
476141d740 | ||
|
|
c43dd2489f | ||
|
|
22736c4ce9 | ||
|
|
3e49e25c63 | ||
|
|
0bfad20d4c | ||
|
|
1859e23cd5 | ||
|
|
c13a30db78 | ||
|
|
d8877982ff | ||
|
|
e383ab9956 | ||
|
|
97467ea355 | ||
|
|
3181d91edf | ||
|
|
3117fa57ec | ||
|
|
91744960c1 | ||
|
|
a2785baf0a | ||
|
|
bc0a4786f4 | ||
|
|
cb4bfaa2f4 | ||
|
|
74ce047a4b | ||
|
|
278567f72d | ||
|
|
9d5b01727e | ||
|
|
33e99e1feb | ||
|
|
ce3b625983 | ||
|
|
7cdd156bce | ||
|
|
f5dd0d4eaf | ||
|
|
06c0ed1d1c | ||
|
|
972e5d2b14 | ||
|
|
6aeaaf5ec9 | ||
|
|
3b3e6818f3 | ||
|
|
c86a4e112b | ||
|
|
9e299c295d | ||
|
|
3f215968ad | ||
|
|
b99a9e92be | ||
|
|
4ebc7b5cef | ||
|
|
9f94eebd32 | ||
|
|
cacadc4df4 |
@@ -1,4 +1,5 @@
|
||||
# install dependencies for C++ analysis
|
||||
set -e
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
@@ -54,3 +55,12 @@ sudo wget \
|
||||
sudo chmod a+x /root/cuda.run
|
||||
sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm
|
||||
sudo rm /root/cuda.run
|
||||
|
||||
# build
|
||||
mkdir -p build
|
||||
cd build || exit 1
|
||||
cmake -G "Unix Makefiles" ..
|
||||
make -j"$(nproc)"
|
||||
|
||||
# skip autobuild
|
||||
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
|
||||
34
.codeql-prebuild-cpp-Windows.sh
Normal file
34
.codeql-prebuild-cpp-Windows.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
# install dependencies for C++ analysis
|
||||
set -e
|
||||
|
||||
# update pacman
|
||||
pacman --noconfirm -Suy
|
||||
|
||||
# install dependencies
|
||||
pacman --noconfirm -S \
|
||||
base-devel \
|
||||
diffutils \
|
||||
gcc \
|
||||
git \
|
||||
make \
|
||||
mingw-w64-x86_64-binutils \
|
||||
mingw-w64-x86_64-boost \
|
||||
mingw-w64-x86_64-cmake \
|
||||
mingw-w64-x86_64-curl \
|
||||
mingw-w64-x86_64-miniupnpc \
|
||||
mingw-w64-x86_64-nlohmann-json \
|
||||
mingw-w64-x86_64-nodejs \
|
||||
mingw-w64-x86_64-onevpl \
|
||||
mingw-w64-x86_64-openssl \
|
||||
mingw-w64-x86_64-opus \
|
||||
mingw-w64-x86_64-rust \
|
||||
mingw-w64-x86_64-toolchain
|
||||
|
||||
# build
|
||||
mkdir -p build
|
||||
cd build || exit 1
|
||||
cmake -G "MinGW Makefiles" ..
|
||||
mingw32-make -j"$(nproc)"
|
||||
|
||||
# skip autobuild
|
||||
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
|
||||
20
.codeql-prebuild-cpp-macOS.sh
Normal file
20
.codeql-prebuild-cpp-macOS.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
# install dependencies for C++ analysis
|
||||
set -e
|
||||
|
||||
# install dependencies
|
||||
brew install \
|
||||
boost \
|
||||
cmake \
|
||||
miniupnpc \
|
||||
node \
|
||||
opus \
|
||||
pkg-config
|
||||
|
||||
# build
|
||||
mkdir -p build
|
||||
cd build || exit 1
|
||||
cmake -G "Unix Makefiles" ..
|
||||
make -j"$(sysctl -n hw.logicalcpu)"
|
||||
|
||||
# skip autobuild
|
||||
echo "skip_autobuild=true" >> "$GITHUB_OUTPUT"
|
||||
@@ -4,8 +4,11 @@
|
||||
# do not ignore .git, needed for versioning
|
||||
!/.git
|
||||
|
||||
# do not ignore .rstcheck.cfg, needed to test building docs
|
||||
!/.rstcheck.cfg
|
||||
|
||||
# ignore repo directories and files
|
||||
docs/
|
||||
docker/
|
||||
gh-pages-template/
|
||||
scripts/
|
||||
tools/
|
||||
@@ -13,6 +16,7 @@ crowdin.yml
|
||||
|
||||
# ignore dev directories
|
||||
build/
|
||||
cmake-*/
|
||||
venv/
|
||||
|
||||
# ignore artifacts
|
||||
|
||||
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# ensure dockerfiles are checked out with LF line endings
|
||||
Dockerfile text eol=lf
|
||||
*.dockerfile text eol=lf
|
||||
632
.github/workflows/CI.yml
vendored
632
.github/workflows/CI.yml
vendored
@@ -165,16 +165,12 @@ jobs:
|
||||
remove-android: 'true'
|
||||
remove-haskell: 'true'
|
||||
remove-codeql: 'true'
|
||||
remove-docker-images: 'false'
|
||||
remove-docker-images: 'true'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout Flathub Shared Modules
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: flathub/shared-modules
|
||||
path: build/shared-modules
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Dependencies Linux Flatpak
|
||||
run: |
|
||||
@@ -185,8 +181,10 @@ jobs:
|
||||
cmake \
|
||||
flatpak \
|
||||
qemu-user-static
|
||||
|
||||
sudo su $(whoami) -c "flatpak --user remote-add --if-not-exists flathub \
|
||||
https://flathub.org/repo/flathub.flatpakrepo"
|
||||
|
||||
sudo su $(whoami) -c "flatpak --user install -y flathub \
|
||||
org.flatpak.Builder \
|
||||
org.freedesktop.Platform/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
@@ -213,6 +211,7 @@ jobs:
|
||||
then
|
||||
echo "This is a PUSH event"
|
||||
branch=${{ github.ref_name }}
|
||||
build_version=${{ needs.check_changelog.outputs.next_version }}
|
||||
commit=${{ github.sha }}
|
||||
clone_url=${{ github.event.repository.clone_url }}
|
||||
else
|
||||
@@ -229,6 +228,7 @@ jobs:
|
||||
|
||||
cd build
|
||||
cmake -DGITHUB_CLONE_URL=${clone_url} \
|
||||
-DBUILD_VERSION=${build_version} \
|
||||
-DGITHUB_BRANCH=${branch} \
|
||||
-DGITHUB_COMMIT=${commit} \
|
||||
-DSUNSHINE_CONFIGURE_FLATPAK_MAN=ON \
|
||||
@@ -280,7 +280,7 @@ jobs:
|
||||
include: # package these differently
|
||||
- type: AppImage
|
||||
EXTRA_ARGS: '-DSUNSHINE_BUILD_APPIMAGE=ON'
|
||||
dist: 20.04
|
||||
dist: 22.04
|
||||
|
||||
steps:
|
||||
- name: Maximize build space
|
||||
@@ -291,65 +291,57 @@ jobs:
|
||||
remove-android: 'true'
|
||||
remove-haskell: 'true'
|
||||
remove-codeql: 'true'
|
||||
remove-docker-images: 'false'
|
||||
remove-docker-images: 'true'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Dependencies Linux
|
||||
- name: Install wget
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
wget
|
||||
|
||||
- name: Install CUDA
|
||||
env:
|
||||
CUDA_VERSION: 11.8.0
|
||||
CUDA_BUILD: 520.61.05
|
||||
timeout-minutes: 4
|
||||
run: |
|
||||
url_base="https://developer.download.nvidia.com/compute/cuda/${CUDA_VERSION}/local_installers"
|
||||
url="${url_base}/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux.run"
|
||||
sudo wget -q -O /root/cuda.run ${url}
|
||||
sudo chmod a+x /root/cuda.run
|
||||
sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr/local/cuda --no-opengl-libs --no-man-page --no-drm
|
||||
sudo rm /root/cuda.run
|
||||
|
||||
- name: Setup Dependencies Linux
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
# allow newer gcc
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
|
||||
if [[ ${{ matrix.dist }} == "18.04" ]]; then
|
||||
# Ubuntu 18.04 packages
|
||||
sudo add-apt-repository ppa:savoury1/boost-defaults-1.71 -y
|
||||
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
libboost-filesystem1.71-dev \
|
||||
libboost-locale1.71-dev \
|
||||
libboost-log1.71-dev \
|
||||
libboost-regex1.71-dev \
|
||||
libboost-program-options1.71-dev
|
||||
|
||||
# Install cmake
|
||||
wget https://cmake.org/files/v3.22/cmake-3.22.2-linux-x86_64.sh
|
||||
chmod +x cmake-3.22.2-linux-x86_64.sh
|
||||
mkdir /opt/cmake
|
||||
./cmake-3.22.2-linux-x86_64.sh --prefix=/opt/cmake --skip-license
|
||||
ln --force --symbolic /opt/cmake/bin/cmake /usr/local/bin/cmake
|
||||
cmake --version
|
||||
|
||||
# install newer tar from focal... appimagelint fails on 18.04 without this
|
||||
echo "original tar version"
|
||||
tar --version
|
||||
wget -O tar.deb http://security.ubuntu.com/ubuntu/pool/main/t/tar/tar_1.30+dfsg-7ubuntu0.20.04.3_amd64.deb
|
||||
sudo apt-get -y install -f ./tar.deb
|
||||
echo "new tar version"
|
||||
tar --version
|
||||
else
|
||||
# Ubuntu 20.04+ packages
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
cmake \
|
||||
libboost-filesystem-dev \
|
||||
libboost-locale-dev \
|
||||
libboost-log-dev \
|
||||
libboost-program-options-dev
|
||||
fi
|
||||
# allow libfuse2 for appimage on 22.04
|
||||
sudo add-apt-repository universe
|
||||
|
||||
sudo apt-get install -y \
|
||||
build-essential \
|
||||
cmake \
|
||||
gcc-10 \
|
||||
g++-10 \
|
||||
libayatana-appindicator3-dev \
|
||||
libavdevice-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-locale-dev \
|
||||
libboost-log-dev \
|
||||
libboost-program-options-dev \
|
||||
libcap-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdrm-dev \
|
||||
libevdev-dev \
|
||||
libfuse2 \
|
||||
libminiupnpc-dev \
|
||||
libmfx-dev \
|
||||
libnotify-dev \
|
||||
@@ -367,7 +359,7 @@ jobs:
|
||||
libxfixes-dev \
|
||||
libxrandr-dev \
|
||||
libxtst-dev \
|
||||
wget
|
||||
python3
|
||||
|
||||
# clean apt cache
|
||||
sudo apt-get clean
|
||||
@@ -382,20 +374,21 @@ jobs:
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10
|
||||
|
||||
# Install CUDA
|
||||
sudo wget \
|
||||
https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run \
|
||||
--progress=bar:force:noscroll -q --show-progress -O /root/cuda.run
|
||||
sudo chmod a+x /root/cuda.run
|
||||
sudo /root/cuda.run --silent --toolkit --toolkitpath=/usr --no-opengl-libs --no-man-page --no-drm
|
||||
sudo rm /root/cuda.run
|
||||
- name: Setup python
|
||||
id: python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Build Linux
|
||||
env:
|
||||
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
|
||||
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version }}
|
||||
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
timeout-minutes: 5
|
||||
run: |
|
||||
echo "nproc: $(nproc)"
|
||||
|
||||
mkdir -p build
|
||||
mkdir -p artifacts
|
||||
|
||||
@@ -403,6 +396,7 @@ jobs:
|
||||
cmake \
|
||||
-DBUILD_WERROR=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_CUDA_COMPILER:PATH=/usr/local/cuda/bin/nvcc \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DSUNSHINE_ASSETS_DIR=share/sunshine \
|
||||
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
|
||||
@@ -412,20 +406,7 @@ jobs:
|
||||
-DSUNSHINE_ENABLE_CUDA=ON \
|
||||
${{ matrix.EXTRA_ARGS }} \
|
||||
..
|
||||
make -j ${nproc}
|
||||
|
||||
- name: Package Linux - CPACK
|
||||
# todo - this is no longer used
|
||||
if: ${{ matrix.type == 'cpack' }}
|
||||
working-directory: build
|
||||
run: |
|
||||
cpack -G DEB
|
||||
mv ./cpack_artifacts/Sunshine.deb ../artifacts/sunshine-${{ matrix.dist }}.deb
|
||||
|
||||
if [[ ${{ matrix.dist }} == "20.04" ]]; then
|
||||
cpack -G RPM
|
||||
mv ./cpack_artifacts/Sunshine.rpm ../artifacts/sunshine.rpm
|
||||
fi
|
||||
make -j $(expr $(nproc) - 1) # use all but one core
|
||||
|
||||
- name: Set AppImage Version
|
||||
if: |
|
||||
@@ -452,12 +433,12 @@ jobs:
|
||||
|
||||
# AppImage
|
||||
# https://docs.appimage.org/packaging-guide/index.html
|
||||
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||||
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||||
chmod +x linuxdeploy-x86_64.AppImage
|
||||
|
||||
# https://github.com/linuxdeploy/linuxdeploy-plugin-gtk
|
||||
sudo apt-get install libgtk-3-dev librsvg2-dev -y
|
||||
wget https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
|
||||
wget -q https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
|
||||
chmod +x linuxdeploy-plugin-gtk.sh
|
||||
export DEPLOY_GTK_VERSION=3
|
||||
|
||||
@@ -475,14 +456,17 @@ jobs:
|
||||
# permissions
|
||||
chmod +x ../artifacts/sunshine.AppImage
|
||||
|
||||
- name: Delete cuda
|
||||
# free up space on the runner
|
||||
run: |
|
||||
sudo rm -rf /usr/local/cuda
|
||||
|
||||
- name: Verify AppImage
|
||||
if: ${{ matrix.type == 'AppImage' }}
|
||||
run: |
|
||||
wget https://github.com/TheAssassin/appimagelint/releases/download/continuous/appimagelint-x86_64.AppImage
|
||||
chmod +x appimagelint-x86_64.AppImage
|
||||
|
||||
# rm -rf ~/.cache/appimagelint/
|
||||
|
||||
./appimagelint-x86_64.AppImage ./artifacts/sunshine.AppImage
|
||||
|
||||
- name: Upload Artifacts
|
||||
@@ -491,6 +475,56 @@ jobs:
|
||||
name: sunshine-linux-${{ matrix.type }}-${{ matrix.dist }}
|
||||
path: artifacts/
|
||||
|
||||
- name: Install test deps
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y \
|
||||
doxygen \
|
||||
graphviz \
|
||||
python3-venv \
|
||||
x11-xserver-utils \
|
||||
xvfb
|
||||
|
||||
# clean apt cache
|
||||
sudo apt-get clean
|
||||
sudo rm -rf /var/lib/apt/lists/*
|
||||
|
||||
- name: Run tests
|
||||
id: test
|
||||
working-directory: build/tests
|
||||
run: |
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
|
||||
./test_sunshine --gtest_color=yes
|
||||
|
||||
- name: Generate gcov report
|
||||
# any except canceled or skipped
|
||||
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
||||
id: test_report
|
||||
working-directory: build
|
||||
run: |
|
||||
${{ steps.python.outputs.python-path }} -m pip install gcovr
|
||||
${{ steps.python.outputs.python-path }} -m gcovr -r .. \
|
||||
--exclude '.*tests/.*' \
|
||||
--exclude '.*tests/.*' \
|
||||
--xml-pretty \
|
||||
-o coverage.xml
|
||||
|
||||
- name: Upload coverage
|
||||
# any except canceled or skipped
|
||||
if: >-
|
||||
always() &&
|
||||
(steps.test_report.outcome == 'success') &&
|
||||
startsWith(github.repository, 'LizardByte/')
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
disable_search: true
|
||||
fail_ci_if_error: true
|
||||
files: ./build/coverage.xml
|
||||
flags: ${{ runner.os }}
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Create/Update GitHub Release
|
||||
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
|
||||
uses: ncipollo/release-action@v1
|
||||
@@ -505,124 +539,119 @@ jobs:
|
||||
discussionCategory: announcements
|
||||
prerelease: ${{ needs.setup_release.outputs.pre_release }}
|
||||
|
||||
build_mac:
|
||||
name: MacOS
|
||||
runs-on: macos-11
|
||||
build_mac_brew:
|
||||
needs: [check_changelog, setup_release]
|
||||
env:
|
||||
BOOST_VERSION: 1.83.0
|
||||
strategy:
|
||||
fail-fast: false # false to test all, true to fail entire job if any fail
|
||||
matrix:
|
||||
include:
|
||||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
|
||||
# while GitHub has larger macOS runners, they are not available for our repos :(
|
||||
- os_version: "12"
|
||||
release: true
|
||||
- os_version: "13"
|
||||
- os_version: "14"
|
||||
name: Homebrew (macOS-${{ matrix.os_version }})
|
||||
runs-on: macos-${{ matrix.os_version }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Dependencies MacOS
|
||||
- name: Setup Dependencies Homebrew
|
||||
run: |
|
||||
# install dependencies using homebrew
|
||||
brew install cmake curl miniupnpc node openssl opus pkg-config
|
||||
brew install cmake
|
||||
|
||||
# fix openssl header not found
|
||||
# ln -sf /usr/local/opt/openssl/include/openssl /usr/local/include/openssl
|
||||
|
||||
# by installing boost from source, several headers cannot be found...
|
||||
# the above commented out link only works if boost is installed from homebrew... does not make sense
|
||||
ln -sf $(find /usr/local/Cellar -type d -name "openssl" -path "*/openssl@3/*/include" | head -n 1) \
|
||||
/usr/local/include/openssl
|
||||
|
||||
# fix opus header not found
|
||||
ln -sf $(find /usr/local/Cellar -type d -name "opus" -path "*/opus/*/include" | head -n 1) \
|
||||
/usr/local/include/opus
|
||||
|
||||
# fix miniupnpc header not found
|
||||
ln -sf $(find /usr/local/Cellar -type d -name "miniupnpc" -path "*/miniupnpc/*/include" | head -n 1) \
|
||||
/usr/local/include/miniupnpc
|
||||
|
||||
- name: Install Boost
|
||||
# installing boost from homebrew takes 30 minutes in a GitHub runner
|
||||
- name: Configure formula
|
||||
run: |
|
||||
export BOOST_ROOT=${HOME}/boost-${BOOST_VERSION}
|
||||
# variables for formula
|
||||
branch=${GITHUB_HEAD_REF}
|
||||
|
||||
# install boost
|
||||
wget \
|
||||
https://github.com/boostorg/boost/releases/download/boost-${BOOST_VERSION}/boost-${BOOST_VERSION}.tar.gz \
|
||||
--progress=bar:force:noscroll -q --show-progress
|
||||
tar xf boost-${BOOST_VERSION}.tar.gz
|
||||
cd boost-${BOOST_VERSION}
|
||||
# check the branch variable
|
||||
if [ -z "$branch" ]
|
||||
then
|
||||
echo "This is a PUSH event"
|
||||
build_version=${{ needs.check_changelog.outputs.next_version }}
|
||||
clone_url=${{ github.event.repository.clone_url }}
|
||||
branch="${{ github.ref_name }}"
|
||||
commit=${{ github.sha }}
|
||||
default_branch="${{ github.event.repository.default_branch }}"
|
||||
else
|
||||
echo "This is a PR event"
|
||||
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
|
||||
branch="${{ github.event.pull_request.head.ref }}"
|
||||
commit=${{ github.event.pull_request.head.sha }}
|
||||
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
|
||||
fi
|
||||
echo "Branch: ${branch}"
|
||||
echo "Clone URL: ${clone_url}"
|
||||
|
||||
# libdir should be set by --prefix but isn't
|
||||
./bootstrap.sh \
|
||||
--prefix=${BOOST_ROOT} \
|
||||
--libdir=${BOOST_ROOT}/lib \
|
||||
--with-libraries=locale,log,program_options,system,thread
|
||||
./b2 headers
|
||||
./b2 install \
|
||||
--prefix=${BOOST_ROOT} \
|
||||
--libdir=${BOOST_ROOT}/lib \
|
||||
-j$(sysctl -n hw.ncpu) \
|
||||
link=shared,static \
|
||||
variant=release \
|
||||
cxxflags=-std=c++14 \
|
||||
cxxflags=-stdlib=libc++ \
|
||||
linkflags=-stdlib=libc++
|
||||
|
||||
# put boost in cmake prefix path
|
||||
echo "BOOST_ROOT=${BOOST_ROOT}" >> ${GITHUB_ENV}
|
||||
|
||||
- name: Build MacOS
|
||||
env:
|
||||
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
|
||||
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake \
|
||||
-DBUILD_WERROR=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DSUNSHINE_ASSETS_DIR=local/sunshine/assets \
|
||||
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
|
||||
-DBUILD_VERSION="${build_version}" \
|
||||
-DGITHUB_BRANCH="${branch}" \
|
||||
-DGITHUB_COMMIT="${commit}" \
|
||||
-DGITHUB_CLONE_URL="${clone_url}" \
|
||||
-DGITHUB_DEFAULT_BRANCH="${default_branch}" \
|
||||
-DSUNSHINE_CONFIGURE_HOMEBREW=ON \
|
||||
-DSUNSHINE_CONFIGURE_ONLY=ON \
|
||||
..
|
||||
make -j $(sysctl -n hw.ncpu)
|
||||
cd ..
|
||||
|
||||
- name: Package MacOS
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
cd build
|
||||
# copy formula to artifacts
|
||||
mkdir -p homebrew
|
||||
cp -f ./build/sunshine.rb ./homebrew/sunshine.rb
|
||||
|
||||
# package
|
||||
cpack -G DragNDrop
|
||||
mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine.dmg
|
||||
|
||||
# cpack -G Bundle
|
||||
# mv ./cpack_artifacts/Sunshine.dmg ../artifacts/sunshine-bundle.dmg
|
||||
# testing
|
||||
cat ./homebrew/sunshine.rb
|
||||
|
||||
- name: Upload Artifacts
|
||||
if: ${{ matrix.release }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sunshine-macos
|
||||
path: artifacts/
|
||||
name: sunshine-homebrew
|
||||
path: homebrew/
|
||||
|
||||
- name: Create/Update GitHub Release
|
||||
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
|
||||
uses: ncipollo/release-action@v1
|
||||
- name: Should Publish Homebrew Formula
|
||||
id: homebrew_publish
|
||||
run: |
|
||||
PUBLISH=false
|
||||
if [[ \
|
||||
"${{ matrix.release }}" == "true" && \
|
||||
"${{ github.repository_owner }}" == "LizardByte" && \
|
||||
"${{ needs.setup_release.outputs.create_release }}" == "true" && \
|
||||
"${{ github.ref }}" == "refs/heads/master" \
|
||||
]]; then
|
||||
PUBLISH=true
|
||||
fi
|
||||
|
||||
echo "publish=${PUBLISH}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Validate and Publish Homebrew Formula
|
||||
uses: LizardByte/homebrew-release-action@v2024.417.220943
|
||||
with:
|
||||
name: ${{ needs.setup_release.outputs.release_name }}
|
||||
tag: ${{ needs.setup_release.outputs.release_tag }}
|
||||
commit: ${{ needs.setup_release.outputs.release_commit }}
|
||||
artifacts: "*artifacts/*"
|
||||
formula_file: ${{ github.workspace }}/homebrew/sunshine.rb
|
||||
git_email: ${{ secrets.GH_BOT_EMAIL }}
|
||||
git_username: ${{ secrets.GH_BOT_NAME }}
|
||||
publish: ${{ steps.homebrew_publish.outputs.publish }}
|
||||
token: ${{ secrets.GH_BOT_TOKEN }}
|
||||
allowUpdates: true
|
||||
body: ${{ needs.setup_release.outputs.release_body }}
|
||||
discussionCategory: announcements
|
||||
prerelease: ${{ needs.setup_release.outputs.pre_release }}
|
||||
|
||||
build_mac_port:
|
||||
name: Macports
|
||||
needs: [check_changelog, setup_release]
|
||||
runs-on: macos-11
|
||||
strategy:
|
||||
fail-fast: false # false to test all, true to fail entire job if any fail
|
||||
matrix:
|
||||
include:
|
||||
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
|
||||
# while GitHub has larger macOS runners, they are not available for our repos :(
|
||||
- os_version: "12"
|
||||
release: true
|
||||
- os_version: "13"
|
||||
- os_version: "14"
|
||||
name: Macports (macOS-${{ matrix.os_version }})
|
||||
runs-on: macos-${{ matrix.os_version }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -646,6 +675,12 @@ jobs:
|
||||
# install dependencies using homebrew
|
||||
brew install cmake
|
||||
|
||||
- name: Setup python
|
||||
id: python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Configure Portfile
|
||||
run: |
|
||||
# variables for Portfile
|
||||
@@ -655,6 +690,8 @@ jobs:
|
||||
if [ -z "$branch" ]
|
||||
then
|
||||
echo "This is a PUSH event"
|
||||
branch="${{ github.ref_name }}"
|
||||
build_version=${{ needs.check_changelog.outputs.next_version }}
|
||||
commit=${{ github.sha }}
|
||||
clone_url=${{ github.event.repository.clone_url }}
|
||||
else
|
||||
@@ -668,6 +705,8 @@ jobs:
|
||||
mkdir build
|
||||
cd build
|
||||
cmake \
|
||||
-DBUILD_VERSION=${build_version} \
|
||||
-DGITHUB_BRANCH=${branch} \
|
||||
-DGITHUB_COMMIT=${commit} \
|
||||
-DGITHUB_CLONE_URL=${clone_url} \
|
||||
-DSUNSHINE_CONFIGURE_PORTFILE=ON \
|
||||
@@ -703,6 +742,7 @@ jobs:
|
||||
- name: Build port
|
||||
env:
|
||||
subportlist: ${{ steps.subportlist.outputs.subportlist }}
|
||||
id: build
|
||||
run: |
|
||||
subport="Sunshine"
|
||||
|
||||
@@ -724,14 +764,107 @@ jobs:
|
||||
"$subport"
|
||||
echo "::endgroup::"
|
||||
|
||||
- name: Build Logs
|
||||
if: always()
|
||||
run: |
|
||||
logfile="/opt/local/var/macports/logs/_Users_runner_work_Sunshine_Sunshine_ports_multimedia_Sunshine/Sunshine/main.log"
|
||||
cat "$logfile"
|
||||
sudo mv "${logfile}" "${logfile}.bak"
|
||||
|
||||
- name: Upload Artifacts
|
||||
if: ${{ matrix.release }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: sunshine-macports
|
||||
path: artifacts/
|
||||
|
||||
- name: Fix screen capture permissions
|
||||
if: ${{ matrix.os_version != 12 }} # macOS-12 is okay
|
||||
# can be removed if the following is fixed in the runner image
|
||||
# https://github.com/actions/runner-images/issues/9529
|
||||
# https://github.com/actions/runner-images/pull/9530
|
||||
run: |
|
||||
# https://apple.stackexchange.com/questions/362865/macos-list-apps-authorized-for-full-disk-access
|
||||
|
||||
# permissions for screen capture
|
||||
values="'kTCCServiceScreenCapture','/opt/off/opt/runner/provisioner/provisioner',1,2,4,1,NULL,NULL,0,'UNUSED',NULL,0,1687786159"
|
||||
if [[ "${{ matrix.os_version }}" == "14" ]]; then
|
||||
# TCC access table in Sonoma has extra 4 columns: pid, pid_version, boot_uuid, last_reminded
|
||||
values="${values},NULL,NULL,'UNUSED',${values##*,}"
|
||||
fi
|
||||
|
||||
# system and user databases
|
||||
dbPaths=(
|
||||
"/Library/Application Support/com.apple.TCC/TCC.db"
|
||||
"$HOME/Library/Application Support/com.apple.TCC/TCC.db"
|
||||
)
|
||||
|
||||
sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
||||
|
||||
for dbPath in "${dbPaths[@]}"; do
|
||||
echo "Column names for $dbPath"
|
||||
echo "-------------------"
|
||||
sudo sqlite3 "$dbPath" "PRAGMA table_info(access);"
|
||||
echo "Current permissions for $dbPath"
|
||||
echo "-------------------"
|
||||
sudo sqlite3 "$dbPath" "SELECT * FROM access WHERE service='kTCCServiceScreenCapture';"
|
||||
sudo sqlite3 "$dbPath" "$sqlQuery"
|
||||
echo "Updated permissions for $dbPath"
|
||||
echo "-------------------"
|
||||
sudo sqlite3 "$dbPath" "SELECT * FROM access WHERE service='kTCCServiceScreenCapture';"
|
||||
done
|
||||
|
||||
- name: Run tests
|
||||
id: test
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
sudo port test "Sunshine"
|
||||
|
||||
- name: Test Logs
|
||||
if: always()
|
||||
run: |
|
||||
logfile="/opt/local/var/macports/logs/_Users_runner_work_Sunshine_Sunshine_ports_multimedia_Sunshine/Sunshine/main.log"
|
||||
cat "$logfile"
|
||||
|
||||
- name: Generate gcov report
|
||||
# any except canceled or skipped
|
||||
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
||||
id: test_report
|
||||
working-directory:
|
||||
/opt/local/var/macports/build/_Users_runner_work_Sunshine_Sunshine_ports_multimedia_Sunshine/Sunshine/work
|
||||
run: |
|
||||
base_dir=$(pwd)
|
||||
build_dir=${base_dir}/build
|
||||
|
||||
# get the directory name that starts with Sunshine-*
|
||||
dir=$(ls -d Sunshine-*)
|
||||
|
||||
cd ${build_dir}
|
||||
${{ steps.python.outputs.python-path }} -m pip install gcovr
|
||||
sudo ${{ steps.python.outputs.python-path }} -m gcovr -r ../${dir} \
|
||||
--exclude '.*${dir}/tests/.*' \
|
||||
--exclude '.*${dir}/third-party/.*' \
|
||||
--gcov-object-directory $(pwd) \
|
||||
--verbose \
|
||||
--xml-pretty \
|
||||
-o ${{ github.workspace }}/build/coverage.xml
|
||||
|
||||
- name: Upload coverage
|
||||
# any except canceled or skipped
|
||||
if: >-
|
||||
always() &&
|
||||
(steps.test_report.outcome == 'success') &&
|
||||
startsWith(github.repository, 'LizardByte/')
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
disable_search: true
|
||||
fail_ci_if_error: false # todo: re-enable this when action is fixed
|
||||
files: ./build/coverage.xml
|
||||
flags: ${{ runner.os }}-${{ matrix.os_version }}
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Create/Update GitHub Release
|
||||
if: ${{ needs.setup_release.outputs.create_release == 'true' }}
|
||||
if: ${{ needs.setup_release.outputs.create_release == 'true' && matrix.release }}
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
name: ${{ needs.setup_release.outputs.release_name }}
|
||||
@@ -755,6 +888,110 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Prepare tests
|
||||
id: prepare-tests
|
||||
if: false # todo: DirectX11 is not available, so even software encoder fails
|
||||
run: |
|
||||
# function to download and extract a zip file
|
||||
function DownloadAndExtract {
|
||||
param (
|
||||
[string]$Uri,
|
||||
[string]$OutFile
|
||||
)
|
||||
|
||||
$maxRetries = 5
|
||||
$retryCount = 0
|
||||
$success = $false
|
||||
|
||||
while (-not $success -and $retryCount -lt $maxRetries) {
|
||||
$retryCount++
|
||||
Write-Host "Downloading $Uri to $OutFile, attempt $retryCount of $maxRetries"
|
||||
try {
|
||||
Invoke-WebRequest -Uri $Uri -OutFile $OutFile
|
||||
$success = $true
|
||||
} catch {
|
||||
Write-Host "Attempt $retryCount of $maxRetries failed with error: $($_.Exception.Message). Retrying..."
|
||||
Start-Sleep -Seconds 5
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $success) {
|
||||
Write-Host "Failed to download the file after $maxRetries attempts."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# use .NET to get the base name of the file
|
||||
$baseName = (Get-Item $OutFile).BaseName
|
||||
|
||||
# Extract the zip file
|
||||
Expand-Archive -Path $OutFile -DestinationPath $baseName
|
||||
}
|
||||
|
||||
# virtual display driver
|
||||
DownloadAndExtract `
|
||||
-Uri "https://www.amyuni.com/downloads/usbmmidd_v2.zip" `
|
||||
-OutFile "usbmmidd_v2.zip"
|
||||
|
||||
# install
|
||||
Set-Location -Path usbmmidd_v2/usbmmidd_v2
|
||||
./deviceinstaller64 install usbmmidd.inf usbmmidd
|
||||
|
||||
# create the virtual display
|
||||
./deviceinstaller64 enableidd 1
|
||||
|
||||
# move up a directory
|
||||
Set-Location -Path ../..
|
||||
|
||||
# install devcon
|
||||
DownloadAndExtract `
|
||||
-Uri "https://github.com/Drawbackz/DevCon-Installer/releases/download/1.4-rc/Devcon.Installer.zip" `
|
||||
-OutFile "Devcon.Installer.zip"
|
||||
Set-Location -Path Devcon.Installer
|
||||
# hash needs to match OS version
|
||||
# https://github.com/Drawbackz/DevCon-Installer/blob/master/devcon_sources.json
|
||||
Start-Process -FilePath "./Devcon Installer.exe" -Wait -ArgumentList `
|
||||
'install', `
|
||||
'-hash', '54004C83EE34F6A55380528A8B29F4C400E61FBB947A19E0AB9E5A193D7D961E', `
|
||||
'-addpath', `
|
||||
'-update', `
|
||||
'-dir', 'C:\Windows\System32'
|
||||
|
||||
# disable Hyper-V Video
|
||||
# https://stackoverflow.com/a/59490940
|
||||
C:\Windows\System32\devcon.exe disable "VMBUS\{da0a7802-e377-4aac-8e77-0558eb1073f8}"
|
||||
|
||||
# move up a directory
|
||||
Set-Location -Path ..
|
||||
|
||||
# multi monitor tool
|
||||
DownloadAndExtract `
|
||||
-Uri "http://www.nirsoft.net/utils/multimonitortool-x64.zip" `
|
||||
-OutFile "multimonitortool.zip"
|
||||
|
||||
# enable the virtual display
|
||||
# http://www.nirsoft.net/utils/multi_monitor_tool.html
|
||||
Set-Location -Path multimonitortool
|
||||
|
||||
# Original Hyper-V is \\.\DISPLAY1, it will recreate itself as \\.\DISPLAY6 (or something higher than 2)
|
||||
# USB Mobile Monitor Virtual Display is \\.\DISPLAY2
|
||||
|
||||
# these don't seem to work if not using runAs
|
||||
# todo: do they work if not using runAs?
|
||||
Start-Process powershell -Verb runAs -ArgumentList '-Command ./MultiMonitorTool.exe /enable \\.\DISPLAY2'
|
||||
Start-Process powershell -Verb runAs -ArgumentList '-Command ./MultiMonitorTool.exe /SetPrimary \\.\DISPLAY2'
|
||||
|
||||
# wait a few seconds
|
||||
Start-Sleep -s 5
|
||||
|
||||
# list monitors
|
||||
./MultiMonitorTool.exe /stext monitor_list.txt
|
||||
|
||||
# wait a few seconds
|
||||
Start-Sleep -s 5
|
||||
|
||||
# print the monitor list
|
||||
Get-Content -Path monitor_list.txt
|
||||
|
||||
- name: Setup Dependencies Windows
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
@@ -762,12 +999,14 @@ jobs:
|
||||
install: >-
|
||||
base-devel
|
||||
diffutils
|
||||
doxygen
|
||||
git
|
||||
make
|
||||
mingw-w64-x86_64-binutils
|
||||
mingw-w64-x86_64-boost
|
||||
mingw-w64-x86_64-cmake
|
||||
mingw-w64-x86_64-curl
|
||||
mingw-w64-x86_64-graphviz
|
||||
mingw-w64-x86_64-miniupnpc
|
||||
mingw-w64-x86_64-nlohmann-json
|
||||
mingw-w64-x86_64-nodejs
|
||||
@@ -780,11 +1019,29 @@ jobs:
|
||||
wget
|
||||
yasm
|
||||
|
||||
- name: Setup python
|
||||
# use this instead of msys2 python due to known issues using wheels, https://www.msys2.org/docs/python/
|
||||
id: setup-python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Python Path
|
||||
id: python-path
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
# replace backslashes with double backslashes
|
||||
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g')
|
||||
|
||||
# step output
|
||||
echo "python-path=${python_path}"
|
||||
echo "python-path=${python_path}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build Windows
|
||||
shell: msys2 {0}
|
||||
env:
|
||||
BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version_bare }}
|
||||
BUILD_VERSION: ${{ needs.check_changelog.outputs.next_version }}
|
||||
COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
|
||||
run: |
|
||||
mkdir build
|
||||
@@ -793,6 +1050,8 @@ jobs:
|
||||
-DBUILD_WERROR=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DSUNSHINE_ASSETS_DIR=assets \
|
||||
-DTESTS_PYTHON_EXECUTABLE='${{ steps.python-path.outputs.python-path }}' \
|
||||
-DTESTS_SOFTWARE_ENCODER_UNAVAILABLE='skip' \
|
||||
-G "MinGW Makefiles" \
|
||||
..
|
||||
mingw32-make -j$(nproc)
|
||||
@@ -811,14 +1070,53 @@ jobs:
|
||||
mv ./cpack_artifacts/Sunshine.exe ../artifacts/sunshine-windows-installer.exe
|
||||
mv ./cpack_artifacts/Sunshine.zip ../artifacts/sunshine-windows-portable.zip
|
||||
|
||||
- name: Run tests
|
||||
id: test
|
||||
shell: msys2 {0}
|
||||
working-directory: build/tests
|
||||
run: |
|
||||
./test_sunshine.exe --gtest_color=yes
|
||||
|
||||
- name: Generate gcov report
|
||||
# any except canceled or skipped
|
||||
if: always() && (steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
||||
id: test_report
|
||||
shell: msys2 {0}
|
||||
working-directory: build
|
||||
run: |
|
||||
${{ steps.python-path.outputs.python-path }} -m pip install gcovr
|
||||
${{ steps.python-path.outputs.python-path }} -m gcovr -r .. \
|
||||
--exclude '.*tests/.*' \
|
||||
--exclude '.*tests/.*' \
|
||||
--xml-pretty \
|
||||
-o coverage.xml
|
||||
|
||||
- name: Upload coverage
|
||||
# any except canceled or skipped
|
||||
if: >-
|
||||
always() &&
|
||||
(steps.test_report.outcome == 'success') &&
|
||||
startsWith(github.repository, 'LizardByte/')
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
disable_search: true
|
||||
fail_ci_if_error: true
|
||||
files: ./build/coverage.xml
|
||||
flags: ${{ runner.os }}
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Package Windows Debug Info
|
||||
working-directory: build
|
||||
run: |
|
||||
# save the original binaries with debug info
|
||||
# use .dbg file extension for binaries to avoid confusion with real packages
|
||||
Get-ChildItem -File -Recurse | `
|
||||
% { Rename-Item -Path $_.PSPath -NewName $_.Name.Replace(".exe",".dbg") }
|
||||
|
||||
# save the binaries with debug info
|
||||
7z -r `
|
||||
"-xr!CMakeFiles" `
|
||||
"-xr!cpack_artifacts" `
|
||||
a "../artifacts/sunshine-debuginfo-win32.zip" "*.exe"
|
||||
a "../artifacts/sunshine-win32-debuginfo.7z" "*.dbg"
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
4
.github/workflows/automerge.yml
vendored
4
.github/workflows/automerge.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Autoapproving
|
||||
uses: hmarr/auto-approve-action@v3
|
||||
uses: hmarr/auto-approve-action@v4
|
||||
with:
|
||||
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Automerging
|
||||
uses: pascalgn/automerge-action@v0.15.6
|
||||
uses: pascalgn/automerge-action@v0.16.3
|
||||
env:
|
||||
BASE_BRANCHES: nightly
|
||||
GITHUB_TOKEN: ${{ secrets.GH_BOT_TOKEN }}
|
||||
|
||||
51
.github/workflows/codeql.yml
vendored
51
.github/workflows/codeql.yml
vendored
@@ -16,7 +16,7 @@ on:
|
||||
- cron: '00 12 * * 0' # every Sunday at 12:00 UTC
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
@@ -57,10 +57,25 @@ jobs:
|
||||
console.log(`Remapping language: ${key} to ${remap_languages[key.toLowerCase()]}`)
|
||||
key = remap_languages[key.toLowerCase()]
|
||||
}
|
||||
if (supported_languages.includes(key.toLowerCase()) &&
|
||||
!matrix['include'].includes({"language": key.toLowerCase()})) {
|
||||
if (supported_languages.includes(key.toLowerCase())) {
|
||||
console.log(`Found supported language: ${key}`)
|
||||
matrix['include'].push({"language": key.toLowerCase()})
|
||||
let osList = ['ubuntu-latest'];
|
||||
if (key.toLowerCase() === 'swift') {
|
||||
osList = ['macos-latest'];
|
||||
} else if (key.toLowerCase() === 'cpp') {
|
||||
osList = ['macos-latest', 'ubuntu-latest', 'windows-latest'];
|
||||
}
|
||||
for (let os of osList) {
|
||||
// set name for matrix
|
||||
if (osList.length == 1) {
|
||||
name = key.toLowerCase()
|
||||
} else {
|
||||
name = `${key.toLowerCase()}, ${os}`
|
||||
}
|
||||
|
||||
// add to matrix
|
||||
matrix['include'].push({"language": key.toLowerCase(), "os": os, "name": name})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,10 +99,15 @@ jobs:
|
||||
}
|
||||
|
||||
analyze:
|
||||
name: Analyze
|
||||
name: Analyze (${{ matrix.name }})
|
||||
if: ${{ needs.languages.outputs.continue == 'true' }}
|
||||
defaults:
|
||||
run:
|
||||
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
|
||||
env:
|
||||
GITHUB_CODEQL_BUILD: true
|
||||
needs: [languages]
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
|
||||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
||||
permissions:
|
||||
actions: read
|
||||
@@ -100,6 +120,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Maximize build space
|
||||
if: runner.os == 'Linux'
|
||||
uses: easimon/maximize-build-space@v8
|
||||
with:
|
||||
root-reserve-mb: 20480
|
||||
@@ -114,6 +135,12 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup msys2
|
||||
if: runner.os == 'Windows'
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
@@ -129,16 +156,20 @@ jobs:
|
||||
|
||||
# Pre autobuild
|
||||
# create a file named .codeql-prebuild-${{ matrix.language }}.sh in the root of your repository
|
||||
# create a file named .codeql-build-${{ matrix.language }}.sh in the root of your repository
|
||||
- name: Prebuild
|
||||
id: prebuild
|
||||
run: |
|
||||
# check if .qodeql-prebuild-${{ matrix.language }}.sh exists
|
||||
if [ -f "./.codeql-prebuild-${{ matrix.language }}.sh" ]; then
|
||||
echo "Running .codeql-prebuild-${{ matrix.language }}.sh"
|
||||
./.codeql-prebuild-${{ matrix.language }}.sh
|
||||
# check if prebuild script exists
|
||||
filename=".codeql-prebuild-${{ matrix.language }}-${{ runner.os }}.sh"
|
||||
if [ -f "./${filename}" ]; then
|
||||
echo "Running prebuild script: ${filename}"
|
||||
./${filename}
|
||||
fi
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||
- name: Autobuild
|
||||
if: steps.prebuild.outputs.skip_autobuild != 'true'
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
|
||||
2
.github/workflows/cpp-lint.yml
vendored
2
.github/workflows/cpp-lint.yml
vendored
@@ -55,7 +55,7 @@ jobs:
|
||||
|
||||
- name: Clang format lint
|
||||
if: ${{ steps.find_files.outputs.found_files }}
|
||||
uses: DoozyX/clang-format-lint-action@v0.16.2
|
||||
uses: DoozyX/clang-format-lint-action@v0.17
|
||||
with:
|
||||
source: ${{ steps.find_files.outputs.found_files }}
|
||||
extensions: 'cpp,h,m,mm'
|
||||
|
||||
2
.github/workflows/update-pages.yml
vendored
2
.github/workflows/update-pages.yml
vendored
@@ -51,7 +51,7 @@ jobs:
|
||||
if: >-
|
||||
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
|
||||
(github.event_name == 'workflow_dispatch')
|
||||
uses: actions-js/push@v1.4
|
||||
uses: actions-js/push@v1.5
|
||||
with:
|
||||
github_token: ${{ secrets.GH_BOT_TOKEN }}
|
||||
author_email: ${{ secrets.GH_BOT_EMAIL }}
|
||||
|
||||
50
.gitignore
vendored
50
.gitignore
vendored
@@ -1,13 +1,45 @@
|
||||
build
|
||||
cmake-build*
|
||||
.DS_Store
|
||||
.vscode
|
||||
.vs
|
||||
*.swp
|
||||
*.kdev4
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
.cache
|
||||
.idea
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# JetBrains IDE
|
||||
.idea/
|
||||
|
||||
# VSCode IDE
|
||||
.vscode/
|
||||
|
||||
# build directories
|
||||
build/
|
||||
cmake-*/
|
||||
|
||||
# npm
|
||||
node_modules/
|
||||
|
||||
16
.gitmodules
vendored
16
.gitmodules
vendored
@@ -1,7 +1,23 @@
|
||||
[submodule "packaging/linux/flatpak/deps/org.flatpak.Builder.BaseApp"]
|
||||
path = packaging/linux/flatpak/deps/org.flatpak.Builder.BaseApp
|
||||
url = https://github.com/flathub/org.flatpak.Builder.BaseApp
|
||||
branch = branch/23.08
|
||||
[submodule "packaging/linux/flatpak/deps/shared-modules"]
|
||||
path = packaging/linux/flatpak/deps/shared-modules
|
||||
url = https://github.com/flathub/shared-modules
|
||||
branch = master
|
||||
[submodule "third-party/build-deps"]
|
||||
path = third-party/build-deps
|
||||
url = https://github.com/LizardByte/build-deps.git
|
||||
branch = dist
|
||||
[submodule "third-party/googletest"]
|
||||
path = third-party/googletest
|
||||
url = https://github.com/google/googletest/
|
||||
branch = v1.14.x
|
||||
[submodule "third-party/jwt-cpp"]
|
||||
path = third-party/jwt-cpp
|
||||
url = https://github.com/Thalhammer/jwt-cpp.git
|
||||
branch = master
|
||||
[submodule "third-party/moonlight-common-c"]
|
||||
path = third-party/moonlight-common-c
|
||||
url = https://github.com/moonlight-stream/moonlight-common-c.git
|
||||
|
||||
102
CHANGELOG.md
102
CHANGELOG.md
@@ -1,5 +1,103 @@
|
||||
# Changelog
|
||||
|
||||
## [0.23.1] - 2024-04-20
|
||||
**Fixed**
|
||||
- (Capture/Windows) Disable HRD and CBR encoding options by default for AMD GPUs due to video quality regressions in v0.23.0
|
||||
- (UI) Fix incorrect strings for QuickSync 'fast' and 'faster' presets
|
||||
- (UI/Linux) Fix update prompt appearing even when running the latest version
|
||||
- (Input) Fix crash when absolute input events are received prior to the display viewport being set
|
||||
- (Input/Linux) Fix missing clamping of rumble intensity to valid range
|
||||
- (Build/Tests) Fix error when attempting to disable compilation of tests
|
||||
- (Build/Linux) Fix some compilation errors when using Musl libc
|
||||
- (Logging) Fix broken debug messages for codec capability flags
|
||||
- (Logging/Linux) Fix log messages to include the correct setcap command for resolving KMS permission errors
|
||||
|
||||
**Added**
|
||||
- (Capture/Linux) Improve frame time consistency for all capture backends
|
||||
- (UI) Set focus to the PIN textbox when navigating to the PIN tab
|
||||
|
||||
**Dependencies**
|
||||
- Remove libavdevice dependency
|
||||
|
||||
**Misc**
|
||||
- (Linux) Prefer ayatana-appindicator3 over appindicator3 if both are available
|
||||
|
||||
## [0.23.0] - 2024-04-06
|
||||
Attention, this release contains critical security fixes. Please update as soon as possible.
|
||||
|
||||
**Breaking**
|
||||
- (Linux) Drop support for Ubuntu 20.04
|
||||
- (Linux) No longer provide arm64 rpm packages, due to extreme compile time on GitHub hosted runners
|
||||
|
||||
**Fixed**
|
||||
- (Network) Ensure unpairing takes effect without restart
|
||||
- (Capture/Linux) Fix logical comparison of texture size
|
||||
- (Service/Windows) Quote the path to sunshinesvc.exe when launching the termination helper
|
||||
|
||||
**Added**
|
||||
- (WebUI) Localization support
|
||||
- (Capture/Linux) Populate host latency for kmx/x11 grab
|
||||
- (Capture/Windows) AMF rate control improvements
|
||||
- (Linux) Add support for Ubuntu 24.04 (x86_64 only)
|
||||
|
||||
**Dependencies**
|
||||
- Bump rstcheck from 6.2.0 to 6.2.1
|
||||
- Bump org.flatpak.Builder.BaseApp from 644487f to 6e295e6
|
||||
- Bump ffmpeg
|
||||
- Bump @fortawesome/fontawesome-free from 6.5.1 to 6.5.2
|
||||
|
||||
**Misc**
|
||||
- (Style) Refactored video encoder declarations
|
||||
- (CI) Refactored Linux build in CI
|
||||
- (CI) Added unit testing and code coverage
|
||||
- (Docs/macOS) Update curl command for Portfile install
|
||||
- (Style) Refactor logging initialization
|
||||
|
||||
|
||||
## [0.22.2] - 2024-03-15
|
||||
**Fixed**
|
||||
- (Tray/Windows) Fix broken system tray icon on some systems
|
||||
- (Linux) Fix crash when XDG_CONFIG_HOME or CONFIGURATION_DIRECTORY are set
|
||||
- (Linux) Fix config migration across filesystems and with non-existent parent directories
|
||||
|
||||
## [0.22.1] - 2024-03-13
|
||||
**Breaking**
|
||||
- (ArchLinux) Drop support for standalone PKGBUILD files. Use the binary Arch package or install via AUR instead.
|
||||
- (macOS) Drop support for experimental dmg package. Use Homebrew or MacPorts instead.
|
||||
|
||||
**Added**
|
||||
- (macOS) Added Homebrew support
|
||||
|
||||
**Changed**
|
||||
- (Process/Windows) The working directory is now searched first when the command contains a relative path
|
||||
- (ArchLinux) The kmsgrab capture backend is now compiled by default to support Wayland capture on non-wlroots-based compositors
|
||||
- (Capture/Linux) X11 capture is now preferred over kmsgrab for cards that lack atomic modesetting support to ensure cursor capture works
|
||||
- (Capture/Linux) Kmsgrab will only choose NVENC by default if the display is connected to the Nvidia GPU to avoid possible EGL import failures
|
||||
|
||||
**Fixed**
|
||||
- (Config) Fix unsupported resolution error with some Moonlight clients
|
||||
- (Capture/Windows) Fix crash when streaming Ryujinx, Red Alert 2, and other apps that use unusually sized monochrome cursors
|
||||
- (Capture/Linux) Fix crash in KMS cursor capture when running on Arch-based distros
|
||||
- (Capture/Linux) Fix crash if CUDA GPU has a PCI ID with hexadecimal digits greater than 9
|
||||
- (Process/Windows) Fix starting apps when the working directory is enclosed in quotes
|
||||
- (Process/Windows) Fix process tree tracking when the app is launched via a cmd.exe trampoline
|
||||
- (Installer/Windows) Fix slow operation during ViGEmBus installation that may cause the installer to appear stuck
|
||||
- (Build/macOS) Fix issues building on macOS 13 and 14
|
||||
- (Build/Linux) Fix missing install script in the Arch binary package
|
||||
- (Build/Linux) Fix missing optional dependencies in the Arch binary package
|
||||
- (Build/Linux) Ensure correct Arch pkg is published to GitHub releases
|
||||
- (Capture/Linux) Fix mismatched case and unhandled exception in CUDA device lookup
|
||||
- (Config) Add missing resolution to default config ui
|
||||
- (Linux) Fix udev rules for uinput access not working until after reboot
|
||||
- (Linux) Fix wrong path in desktop files
|
||||
- (Tray) Cache icons to avoid possible DRM issues
|
||||
- (Tray) Fix attempt to update tray icon after it was destroyed
|
||||
- (Linux) Migrate old config files to new location if env SUNSHINE_MIGRATE_CONFIG=1 is set (automatically set for Flatpak)
|
||||
- (Linux/Fedora) Re-enable CUDA support and bump to 12.4.0
|
||||
|
||||
**Misc**
|
||||
- (Build/Windows) Adjust Windows debuginfo artifact to reduce confusion with real release binaries
|
||||
|
||||
## [0.22.0] - 2024-03-03
|
||||
**Breaking**
|
||||
- (Network) Clients must now be paired with the host before they can use Wake-on-LAN
|
||||
@@ -720,3 +818,7 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
[0.20.0]: https://github.com/LizardByte/Sunshine/releases/tag/v0.20.0
|
||||
[0.21.0]: https://github.com/LizardByte/Sunshine/releases/tag/v0.21.0
|
||||
[0.22.0]: https://github.com/LizardByte/Sunshine/releases/tag/v0.22.0
|
||||
[0.22.1]: https://github.com/LizardByte/Sunshine/releases/tag/v0.22.1
|
||||
[0.22.2]: https://github.com/LizardByte/Sunshine/releases/tag/v0.22.2
|
||||
[0.23.0]: https://github.com/LizardByte/Sunshine/releases/tag/v0.23.0
|
||||
[0.23.1]: https://github.com/LizardByte/Sunshine/releases/tag/v0.23.1
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.18)
|
||||
# `CMAKE_CUDA_ARCHITECTURES` requires 3.18
|
||||
# set_source_files_properties requires 3.18
|
||||
# todo - set this conditionally
|
||||
|
||||
# todo - set version to 0.0.0 once confident in automated versioning
|
||||
project(Sunshine VERSION 0.22.0
|
||||
DESCRIPTION "Sunshine is a self-hosted game stream host for Moonlight."
|
||||
project(Sunshine VERSION 0.23.1
|
||||
DESCRIPTION "Self-hosted game stream host for Moonlight"
|
||||
HOMEPAGE_URL "https://app.lizardbyte.dev/Sunshine")
|
||||
|
||||
set(PROJECT_LICENSE "GPL-3.0")
|
||||
@@ -28,6 +29,9 @@ include(${CMAKE_MODULE_PATH}/prep/build_version.cmake)
|
||||
# cmake build flags
|
||||
include(${CMAKE_MODULE_PATH}/prep/options.cmake)
|
||||
|
||||
# initial prep
|
||||
include(${CMAKE_MODULE_PATH}/prep/init.cmake)
|
||||
|
||||
# configure special package files, such as sunshine.desktop, Flatpak manifest, Portfile , etc.
|
||||
include(${CMAKE_MODULE_PATH}/prep/special_package_configuration.cmake)
|
||||
|
||||
|
||||
101
README.rst
101
README.rst
@@ -17,69 +17,48 @@ System Requirements
|
||||
|
||||
**Minimum Requirements**
|
||||
|
||||
+------------+------------------------------------------------------------+
|
||||
| GPU | AMD: VCE 1.0 or higher, see `obs-amd hardware support`_ |
|
||||
| +------------------------------------------------------------+
|
||||
| | Intel: VAAPI-compatible, see: `VAAPI hardware support`_ |
|
||||
| +------------------------------------------------------------+
|
||||
| | Nvidia: NVENC enabled cards, see `nvenc support matrix`_ |
|
||||
+------------+------------------------------------------------------------+
|
||||
| CPU | AMD: Ryzen 3 or higher |
|
||||
| +------------------------------------------------------------+
|
||||
| | Intel: Core i3 or higher |
|
||||
+------------+------------------------------------------------------------+
|
||||
| RAM | 4GB or more |
|
||||
+------------+------------------------------------------------------------+
|
||||
| OS | Windows: 10+ (Windows Server not supported) |
|
||||
| +------------------------------------------------------------+
|
||||
| | macOS: 11.7+ |
|
||||
| +------------------------------------------------------------+
|
||||
| | Linux/Debian: 11 (bullseye) |
|
||||
| +------------------------------------------------------------+
|
||||
| | Linux/Fedora: 37+ |
|
||||
| +------------------------------------------------------------+
|
||||
| | Linux/Ubuntu: 20.04+ (focal) |
|
||||
+------------+------------------------------------------------------------+
|
||||
| Network | Host: 5GHz, 802.11ac |
|
||||
| +------------------------------------------------------------+
|
||||
| | Client: 5GHz, 802.11ac |
|
||||
+------------+------------------------------------------------------------+
|
||||
.. csv-table::
|
||||
:widths: 15, 60
|
||||
|
||||
"GPU", "AMD: VCE 1.0 or higher, see: `obs-amd hardware support <https://github.com/obsproject/obs-amd-encoder/wiki/Hardware-Support>`_"
|
||||
"", "Intel: VAAPI-compatible, see: `VAAPI hardware support <https://www.intel.com/content/www/us/en/developer/articles/technical/linuxmedia-vaapi.html>`_"
|
||||
"", "Nvidia: NVENC enabled cards, see: `nvenc support matrix <https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new>`_"
|
||||
"CPU", "AMD: Ryzen 3 or higher"
|
||||
"", "Intel: Core i3 or higher"
|
||||
"RAM", "4GB or more"
|
||||
"OS", "Windows: 10+ (Windows Server does not support virtual gamepads)"
|
||||
"", "macOS: 12+"
|
||||
"", "Linux/Debian: 11 (bullseye)"
|
||||
"", "Linux/Fedora: 38+"
|
||||
"", "Linux/Ubuntu: 22.04+ (jammy)"
|
||||
"Network", "Host: 5GHz, 802.11ac"
|
||||
"", "Client: 5GHz, 802.11ac"
|
||||
|
||||
**4k Suggestions**
|
||||
|
||||
+------------+------------------------------------------------------------+
|
||||
| GPU | AMD: Video Coding Engine 3.1 or higher |
|
||||
| +------------------------------------------------------------+
|
||||
| | Intel: HD Graphics 510 or higher |
|
||||
| +------------------------------------------------------------+
|
||||
| | Nvidia: GeForce GTX 1080 or higher |
|
||||
+------------+------------------------------------------------------------+
|
||||
| CPU | AMD: Ryzen 5 or higher |
|
||||
| +------------------------------------------------------------+
|
||||
| | Intel: Core i5 or higher |
|
||||
+------------+------------------------------------------------------------+
|
||||
| Network | Host: CAT5e ethernet or better |
|
||||
| +------------------------------------------------------------+
|
||||
| | Client: CAT5e ethernet or better |
|
||||
+------------+------------------------------------------------------------+
|
||||
.. csv-table::
|
||||
:widths: 15, 60
|
||||
|
||||
"GPU", "AMD: Video Coding Engine 3.1 or higher"
|
||||
"", "Intel: HD Graphics 510 or higher"
|
||||
"", "Nvidia: GeForce GTX 1080 or higher"
|
||||
"CPU", "AMD: Ryzen 5 or higher"
|
||||
"", "Intel: Core i5 or higher"
|
||||
"Network", "Host: CAT5e ethernet or better"
|
||||
"", "Client: CAT5e ethernet or better"
|
||||
|
||||
**HDR Suggestions**
|
||||
|
||||
+------------+------------------------------------------------------------+
|
||||
| GPU | AMD: Video Coding Engine 3.4 or higher |
|
||||
| +------------------------------------------------------------+
|
||||
| | Intel: UHD Graphics 730 or higher |
|
||||
| +------------------------------------------------------------+
|
||||
| | Nvidia: Pascal-based GPU (GTX 10-series) or higher |
|
||||
+------------+------------------------------------------------------------+
|
||||
| CPU | AMD: todo |
|
||||
| +------------------------------------------------------------+
|
||||
| | Intel: todo |
|
||||
+------------+------------------------------------------------------------+
|
||||
| Network | Host: CAT5e ethernet or better |
|
||||
| +------------------------------------------------------------+
|
||||
| | Client: CAT5e ethernet or better |
|
||||
+------------+------------------------------------------------------------+
|
||||
.. csv-table::
|
||||
:widths: 15, 60
|
||||
|
||||
"GPU", "AMD: Video Coding Engine 3.4 or higher"
|
||||
"", "Intel: UHD Graphics 730 or higher"
|
||||
"", "Nvidia: Pascal-based GPU (GTX 10-series) or higher"
|
||||
"CPU", "AMD: todo"
|
||||
"", "Intel: todo"
|
||||
"Network", "Host: CAT5e ethernet or better"
|
||||
"", "Client: CAT5e ethernet or better"
|
||||
|
||||
Integrations
|
||||
------------
|
||||
@@ -96,6 +75,10 @@ Integrations
|
||||
:alt: Read the Docs
|
||||
:target: http://sunshinestream.readthedocs.io/
|
||||
|
||||
.. image:: https://img.shields.io/codecov/c/gh/LizardByte/Sunshine?token=SMGXQ5NVMJ&style=for-the-badge&logo=codecov&label=codecov
|
||||
:alt: Codecov
|
||||
:target: https://codecov.io/gh/LizardByte/Sunshine
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
@@ -122,7 +105,3 @@ Stats
|
||||
.. image:: https://img.shields.io/github/stars/lizardbyte/sunshine.svg?logo=github&style=for-the-badge
|
||||
:alt: GitHub stars
|
||||
:target: https://github.com/LizardByte/Sunshine
|
||||
|
||||
.. _nvenc support matrix: https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new
|
||||
.. _obs-amd hardware support: https://github.com/obsproject/obs-amd-encoder/wiki/Hardware-Support
|
||||
.. _VAAPI hardware support: https://www.intel.com/content/www/us/en/developer/articles/technical/linuxmedia-vaapi.html
|
||||
|
||||
@@ -110,11 +110,6 @@ set(SUNSHINE_TARGET_FILES
|
||||
"${CMAKE_SOURCE_DIR}/src/stat_trackers.cpp"
|
||||
${PLATFORM_TARGET_FILES})
|
||||
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/upnp.cpp" PROPERTIES COMPILE_FLAGS -Wno-pedantic)
|
||||
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/nanors/rs.c"
|
||||
PROPERTIES COMPILE_FLAGS "-include deps/obl/autoshim.h -ftree-vectorize")
|
||||
|
||||
if(NOT SUNSHINE_ASSETS_DIR_DEF)
|
||||
set(SUNSHINE_ASSETS_DIR_DEF "${SUNSHINE_ASSETS_DIR}")
|
||||
endif()
|
||||
@@ -130,19 +125,11 @@ include_directories(
|
||||
"${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/enet/include"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/nanors"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/nanors/deps/obl"
|
||||
"${CMAKE_SOURCE_DIR}/third-party/jwt-cpp/include"
|
||||
${FFMPEG_INCLUDE_DIRS}
|
||||
${PLATFORM_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
|
||||
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
|
||||
if(WIN32)
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp" PROPERTIES COMPILE_FLAGS -O2)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
${MINIUPNP_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
|
||||
@@ -8,10 +8,6 @@ if(${SUNSHINE_BUILD_APPIMAGE})
|
||||
string(REPLACE "${CMAKE_INSTALL_PREFIX}" ".${CMAKE_INSTALL_PREFIX}" SUNSHINE_ASSETS_DIR_DEF ${SUNSHINE_ASSETS_DIR})
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED SUNSHINE_EXECUTABLE_PATH)
|
||||
set(SUNSHINE_EXECUTABLE_PATH "sunshine")
|
||||
endif()
|
||||
|
||||
# cuda
|
||||
set(CUDA_FOUND OFF)
|
||||
if(${SUNSHINE_ENABLE_CUDA})
|
||||
@@ -203,13 +199,13 @@ endif()
|
||||
|
||||
# tray icon
|
||||
if(${SUNSHINE_ENABLE_TRAY})
|
||||
pkg_check_modules(APPINDICATOR appindicator3-0.1)
|
||||
pkg_check_modules(APPINDICATOR ayatana-appindicator3-0.1)
|
||||
if(APPINDICATOR_FOUND)
|
||||
list(APPEND SUNSHINE_DEFINITIONS TRAY_LEGACY_APPINDICATOR=1)
|
||||
list(APPEND SUNSHINE_DEFINITIONS TRAY_AYATANA_APPINDICATOR=1)
|
||||
else()
|
||||
pkg_check_modules(APPINDICATOR ayatana-appindicator3-0.1)
|
||||
pkg_check_modules(APPINDICATOR appindicator3-0.1)
|
||||
if(APPINDICATOR_FOUND)
|
||||
list(APPEND SUNSHINE_DEFINITIONS TRAY_AYATANA_APPINDICATOR=1)
|
||||
list(APPEND SUNSHINE_DEFINITIONS TRAY_LEGACY_APPINDICATOR=1)
|
||||
endif ()
|
||||
endif()
|
||||
pkg_check_modules(LIBNOTIFY libnotify)
|
||||
|
||||
@@ -8,12 +8,13 @@ link_directories(/opt/homebrew/lib)
|
||||
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
|
||||
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
${APP_KIT_LIBRARY}
|
||||
${APP_SERVICES_LIBRARY}
|
||||
${AV_FOUNDATION_LIBRARY}
|
||||
${CORE_MEDIA_LIBRARY}
|
||||
${CORE_VIDEO_LIBRARY}
|
||||
${VIDEO_TOOLBOX_LIBRARY}
|
||||
${FOUNDATION_LIBRARY})
|
||||
${FOUNDATION_LIBRARY}
|
||||
${VIDEO_TOOLBOX_LIBRARY})
|
||||
|
||||
set(PLATFORM_INCLUDE_DIRS
|
||||
${Boost_INCLUDE_DIR})
|
||||
|
||||
@@ -29,16 +29,6 @@ file(GLOB NVPREFS_FILES CONFIGURE_DEPENDS
|
||||
|
||||
# vigem
|
||||
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/third-party/ViGEmClient/include")
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/ViGEmClient/src/ViGEmClient.cpp"
|
||||
PROPERTIES COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650")
|
||||
set(VIGEM_COMPILE_FLAGS "")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-unknown-pragmas ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-misleading-indentation ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-class-memaccess ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-unused-function ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-unused-variable ")
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/ViGEmClient/src/ViGEmClient.cpp"
|
||||
PROPERTIES COMPILE_FLAGS ${VIGEM_COMPILE_FLAGS})
|
||||
|
||||
# sunshine icon
|
||||
if(NOT DEFINED SUNSHINE_ICON_PATH)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# macos specific dependencies
|
||||
|
||||
FIND_LIBRARY(APP_KIT_LIBRARY AppKit)
|
||||
FIND_LIBRARY(APP_SERVICES_LIBRARY ApplicationServices)
|
||||
FIND_LIBRARY(AV_FOUNDATION_LIBRARY AVFoundation)
|
||||
FIND_LIBRARY(CORE_MEDIA_LIBRARY CoreMedia)
|
||||
|
||||
@@ -12,10 +12,18 @@ set(CPACK_PACKAGE_ICON ${PROJECT_SOURCE_DIR}/sunshine.png)
|
||||
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}")
|
||||
set(CPACK_STRIP_FILES YES)
|
||||
|
||||
#install common assets
|
||||
# install common assets
|
||||
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}"
|
||||
PATTERN "web" EXCLUDE)
|
||||
# copy assets to build directory, for running without install
|
||||
file(GLOB_RECURSE ALL_ASSETS
|
||||
RELATIVE "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/*")
|
||||
list(FILTER ALL_ASSETS EXCLUDE REGEX "^web/.*$") # Filter out the web directory
|
||||
foreach(asset ${ALL_ASSETS}) # Copy assets to build directory, excluding the web directory
|
||||
file(COPY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/${asset}"
|
||||
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/assets")
|
||||
endforeach()
|
||||
|
||||
# install built vite assets
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/assets/web"
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
||||
# copy assets to build directory, for running without install
|
||||
file(COPY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/assets")
|
||||
if(${SUNSHINE_BUILD_APPIMAGE} OR ${SUNSHINE_BUILD_FLATPAK})
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules"
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.rules"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}/udev/rules.d")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}/systemd/user")
|
||||
@@ -11,7 +14,7 @@ else()
|
||||
find_package(Systemd)
|
||||
find_package(Udev)
|
||||
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules"
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/60-sunshine.rules"
|
||||
DESTINATION "${UDEV_RULES_INSTALL_DIR}")
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service"
|
||||
DESTINATION "${SYSTEMD_USER_UNIT_INSTALL_DIR}")
|
||||
|
||||
@@ -10,15 +10,16 @@ if(SUNSHINE_PACKAGE_MACOS) # todo
|
||||
set(MAC_PREFIX "${CMAKE_PROJECT_NAME}.app/Contents")
|
||||
set(INSTALL_RUNTIME_DIR "${MAC_PREFIX}/MacOS")
|
||||
|
||||
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
||||
|
||||
install(TARGETS sunshine
|
||||
BUNDLE DESTINATION . COMPONENT Runtime
|
||||
RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} COMPONENT Runtime)
|
||||
else()
|
||||
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
||||
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/misc/uninstall_pkg.sh"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}")
|
||||
# copy assets to build directory, for running without install
|
||||
file(COPY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/assets")
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# unix specific packaging
|
||||
# put anything here that applies to both linux and macos
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# return here if building a macos package
|
||||
if(SUNSHINE_PACKAGE_MACOS)
|
||||
return()
|
||||
|
||||
@@ -39,6 +39,9 @@ install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/gamepad/"
|
||||
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/"
|
||||
DESTINATION "${SUNSHINE_ASSETS_DIR}"
|
||||
COMPONENT assets)
|
||||
# copy assets to build directory, for running without install
|
||||
file(COPY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/"
|
||||
DESTINATION "${CMAKE_BINARY_DIR}/assets")
|
||||
|
||||
# set(CPACK_NSIS_MUI_HEADERIMAGE "") # TODO: image should be 150x57 bmp
|
||||
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\sunshine.ico")
|
||||
|
||||
9
cmake/prep/init.cmake
Normal file
9
cmake/prep/init.cmake
Normal file
@@ -0,0 +1,9 @@
|
||||
if (WIN32)
|
||||
elseif (APPLE)
|
||||
elseif (UNIX)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(NOT DEFINED SUNSHINE_EXECUTABLE_PATH)
|
||||
set(SUNSHINE_EXECUTABLE_PATH "sunshine")
|
||||
endif()
|
||||
endif ()
|
||||
@@ -1,3 +1,10 @@
|
||||
option(BUILD_TESTS "Build tests" ON)
|
||||
option(TESTS_ENABLE_PYTHON_TESTS "Enable Python tests" ON)
|
||||
|
||||
# DirectX11 is not available in GitHub runners, so even software encoding fails
|
||||
set(TESTS_SOFTWARE_ENCODER_UNAVAILABLE "fail"
|
||||
CACHE STRING "How to handle unavailable software encoders in tests. 'fail/skip'")
|
||||
|
||||
option(BUILD_WERROR "Enable -Werror flag." OFF)
|
||||
|
||||
# if this option is set, the build will exit after configuring special package configuration files
|
||||
@@ -12,7 +19,15 @@ option(CUDA_INHERIT_COMPILE_OPTIONS
|
||||
"When building CUDA code, inherit compile options from the the main project. You may want to disable this if
|
||||
your IDE throws errors about unknown flags after running cmake." ON)
|
||||
|
||||
if(UNIX)
|
||||
# technically, the homebrew build could be on linux as well... no idea if it would actually work
|
||||
option(SUNSHINE_BUILD_HOMEBREW
|
||||
"Enable a Homebrew build." OFF)
|
||||
endif ()
|
||||
|
||||
if(APPLE)
|
||||
option(SUNSHINE_CONFIGURE_HOMEBREW
|
||||
"Configure macOS Homebrew formula. Recommended to use with SUNSHINE_CONFIGURE_ONLY" OFF)
|
||||
option(SUNSHINE_CONFIGURE_PORTFILE
|
||||
"Configure macOS Portfile. Recommended to use with SUNSHINE_CONFIGURE_ONLY" OFF)
|
||||
option(SUNSHINE_PACKAGE_MACOS
|
||||
|
||||
@@ -2,6 +2,9 @@ if (APPLE)
|
||||
if(${SUNSHINE_CONFIGURE_PORTFILE})
|
||||
configure_file(packaging/macos/Portfile Portfile @ONLY)
|
||||
endif()
|
||||
if(${SUNSHINE_CONFIGURE_HOMEBREW})
|
||||
configure_file(packaging/macos/sunshine.rb sunshine.rb @ONLY)
|
||||
endif()
|
||||
elseif (UNIX)
|
||||
# configure the .desktop file
|
||||
if(${SUNSHINE_BUILD_APPIMAGE})
|
||||
@@ -24,11 +27,13 @@ elseif (UNIX)
|
||||
# configure the arch linux pkgbuild
|
||||
if(${SUNSHINE_CONFIGURE_PKGBUILD})
|
||||
configure_file(packaging/linux/Arch/PKGBUILD PKGBUILD @ONLY)
|
||||
configure_file(packaging/linux/Arch/sunshine.install sunshine.install @ONLY)
|
||||
endif()
|
||||
|
||||
# configure the flatpak manifest
|
||||
if(${SUNSHINE_CONFIGURE_FLATPAK_MAN})
|
||||
configure_file(packaging/linux/flatpak/dev.lizardbyte.sunshine.yml dev.lizardbyte.sunshine.yml @ONLY)
|
||||
file(COPY packaging/linux/flatpak/deps/ DESTINATION ${CMAKE_BINARY_DIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
|
||||
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
|
||||
|
||||
# Homebrew build fails the vite build if we set these environment variables
|
||||
# this block must be before the platform specific code
|
||||
if(${SUNSHINE_BUILD_HOMEBREW})
|
||||
set(NPM_SOURCE_ASSETS_DIR "")
|
||||
set(NPM_ASSETS_DIR "")
|
||||
set(NPM_BUILD_HOMEBREW "true")
|
||||
else()
|
||||
set(NPM_SOURCE_ASSETS_DIR ${SUNSHINE_SOURCE_ASSETS_DIR})
|
||||
set(NPM_ASSETS_DIR ${CMAKE_BINARY_DIR})
|
||||
set(NPM_BUILD_HOMEBREW "")
|
||||
endif()
|
||||
|
||||
# platform specific target definitions
|
||||
if(WIN32)
|
||||
include(${CMAKE_MODULE_PATH}/targets/windows.cmake)
|
||||
@@ -24,7 +36,7 @@ endif()
|
||||
|
||||
target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES} ${EXTRA_LIBS})
|
||||
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
|
||||
set_target_properties(sunshine PROPERTIES CXX_STANDARD 17
|
||||
set_target_properties(sunshine PROPERTIES CXX_STANDARD 20
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
@@ -37,8 +49,50 @@ endif()
|
||||
|
||||
target_compile_options(sunshine PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>) # cmake-lint: disable=C0301
|
||||
|
||||
#WebUI build
|
||||
add_custom_target(web-ui ALL
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Installing NPM Dependencies and Building the Web UI"
|
||||
COMMAND bash -c \"npm install && SUNSHINE_SOURCE_ASSETS_DIR=${SUNSHINE_SOURCE_ASSETS_DIR} SUNSHINE_ASSETS_DIR=${CMAKE_BINARY_DIR} npm run build\") # cmake-lint: disable=C0301
|
||||
# tests
|
||||
if(BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
# custom compile flags, must be after adding tests
|
||||
|
||||
if (NOT BUILD_TESTS)
|
||||
set(TEST_DIR "")
|
||||
else()
|
||||
set(TEST_DIR "${CMAKE_SOURCE_DIR}/tests")
|
||||
endif()
|
||||
|
||||
# src/upnp
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/upnp.cpp"
|
||||
DIRECTORY "${CMAKE_SOURCE_DIR}" "${TEST_DIR}"
|
||||
PROPERTIES COMPILE_FLAGS -Wno-pedantic)
|
||||
|
||||
# third-party/nanors
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/nanors/rs.c"
|
||||
DIRECTORY "${CMAKE_SOURCE_DIR}" "${TEST_DIR}"
|
||||
PROPERTIES COMPILE_FLAGS "-include deps/obl/autoshim.h -ftree-vectorize")
|
||||
|
||||
# third-party/ViGEmClient
|
||||
set(VIGEM_COMPILE_FLAGS "")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-unknown-pragmas ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-misleading-indentation ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-class-memaccess ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-unused-function ")
|
||||
string(APPEND VIGEM_COMPILE_FLAGS "-Wno-unused-variable ")
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/third-party/ViGEmClient/src/ViGEmClient.cpp"
|
||||
DIRECTORY "${CMAKE_SOURCE_DIR}" "${TEST_DIR}"
|
||||
PROPERTIES
|
||||
COMPILE_DEFINITIONS "UNICODE=1;ERROR_INVALID_DEVICE_OBJECT_PARAMETER=650"
|
||||
COMPILE_FLAGS ${VIGEM_COMPILE_FLAGS})
|
||||
|
||||
# src/nvhttp
|
||||
string(TOUPPER "x${CMAKE_BUILD_TYPE}" BUILD_TYPE)
|
||||
if("${BUILD_TYPE}" STREQUAL "XDEBUG")
|
||||
if(WIN32)
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/nvhttp.cpp"
|
||||
DIRECTORY "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/tests"
|
||||
PROPERTIES COMPILE_FLAGS -O2)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-DNDEBUG)
|
||||
endif()
|
||||
|
||||
@@ -1,2 +1,8 @@
|
||||
# unix specific target definitions
|
||||
# put anything here that applies to both linux and macos
|
||||
|
||||
#WebUI build
|
||||
add_custom_target(web-ui ALL
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Installing NPM Dependencies and Building the Web UI"
|
||||
COMMAND sh -c \"npm install && SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW} SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR} SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR} npm run build\") # cmake-lint: disable=C0301
|
||||
|
||||
@@ -4,3 +4,9 @@ set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
|
||||
find_library(ZLIB ZLIB1)
|
||||
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
|
||||
Wtsapi32.lib)
|
||||
|
||||
#WebUI build
|
||||
add_custom_target(web-ui ALL
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||
COMMENT "Installing NPM Dependencies and Building the Web UI"
|
||||
COMMAND cmd /C "npm install && set \"SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}\" && set \"SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}\" && npm run build") # cmake-lint: disable=C0301
|
||||
|
||||
19
codecov.yml
Normal file
19
codecov.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
codecov:
|
||||
branch: nightly
|
||||
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
target: auto
|
||||
threshold: 10%
|
||||
|
||||
comment:
|
||||
layout: "diff, flags, files"
|
||||
behavior: default
|
||||
require_changes: false # if true: only post the comment if coverage changes
|
||||
|
||||
ignore:
|
||||
- "tests"
|
||||
- "third-party"
|
||||
12
crowdin.yml
12
crowdin.yml
@@ -1,7 +1,7 @@
|
||||
---
|
||||
"base_path": "."
|
||||
"base_url": "https://api.crowdin.com" # optional (for Crowdin Enterprise only)
|
||||
"preserve_hierarchy": false # flatten tree on crowdin
|
||||
"preserve_hierarchy": true # false will flatten tree on crowdin, but doesn't work with dest option
|
||||
"pull_request_labels": [
|
||||
"crowdin",
|
||||
"l10n"
|
||||
@@ -10,6 +10,7 @@
|
||||
"files": [
|
||||
{
|
||||
"source": "/locale/*.po",
|
||||
"dest": "/%original_file_name%",
|
||||
"translation": "/locale/%two_letters_code%/LC_MESSAGES/%original_file_name%",
|
||||
"languages_mapping": {
|
||||
"two_letters_code": {
|
||||
@@ -17,6 +18,13 @@
|
||||
"en-GB": "en_GB",
|
||||
"en-US": "en_US"
|
||||
}
|
||||
}
|
||||
},
|
||||
"update_option": "update_as_unapproved"
|
||||
},
|
||||
{
|
||||
"source": "/src_assets/common/assets/web/public/assets/locale/en.json",
|
||||
"dest": "/sunshine.json",
|
||||
"translation": "/src_assets/common/assets/web/public/assets/locale/%two_letters_code%.%file_extension%",
|
||||
"update_option": "update_as_unapproved"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -34,7 +34,7 @@ ENV COMMIT=${COMMIT}
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
# install dependencies
|
||||
# cuda, libcap, and libdrm are optional dependencies for PKGBUILD
|
||||
# cuda is an optional build-time dependency for PKGBUILD
|
||||
RUN <<_DEPS
|
||||
#!/bin/bash
|
||||
set -e
|
||||
@@ -43,9 +43,8 @@ pacman -Syu --disable-download-timeout --needed --noconfirm \
|
||||
cmake \
|
||||
cuda \
|
||||
git \
|
||||
libcap \
|
||||
libdrm \
|
||||
namcap
|
||||
namcap \
|
||||
xorg-server-xvfb
|
||||
_DEPS
|
||||
|
||||
# Setup builder user
|
||||
@@ -80,19 +79,22 @@ _MAKE
|
||||
|
||||
WORKDIR /build/sunshine/pkg
|
||||
RUN mv /build/sunshine/build/PKGBUILD .
|
||||
RUN mv /build/sunshine/build/sunshine.install .
|
||||
|
||||
# namcap and build PKGBUILD file
|
||||
RUN <<_PKGBUILD
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
namcap -i PKGBUILD
|
||||
makepkg -si --noconfirm
|
||||
rm -f /build/sunshine/pkg/sunshine-debug*.pkg.tar.zst
|
||||
ls -a
|
||||
_PKGBUILD
|
||||
|
||||
FROM scratch as artifacts
|
||||
|
||||
COPY --link --from=sunshine-build /build/sunshine/pkg/PKGBUILD /PKGBUILD
|
||||
COPY --link --from=sunshine-build /build/sunshine/pkg/sunshine*.pkg.tar.zst /sunshine.pkg.tar.zst
|
||||
|
||||
FROM sunshine-base as sunshine
|
||||
|
||||
@@ -14,6 +14,8 @@ FROM toolchain-base as toolchain
|
||||
ARG TARGETPLATFORM
|
||||
RUN echo "target_platform: ${TARGETPLATFORM}"
|
||||
|
||||
ENV DISPLAY=:0
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
# install dependencies
|
||||
RUN <<_DEPS
|
||||
@@ -24,12 +26,13 @@ apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake=3.22.* \
|
||||
ca-certificates \
|
||||
doxygen \
|
||||
gcc=4:11.2.* \
|
||||
g++=4:11.2.* \
|
||||
gdb \
|
||||
git \
|
||||
graphviz \
|
||||
libayatana-appindicator3-dev \
|
||||
libavdevice-dev \
|
||||
libboost-filesystem-dev=1.74.* \
|
||||
libboost-locale-dev=1.74.* \
|
||||
libboost-log-dev=1.74.* \
|
||||
@@ -54,8 +57,12 @@ apt-get install -y --no-install-recommends \
|
||||
libxfixes-dev \
|
||||
libxrandr-dev \
|
||||
libxtst-dev \
|
||||
python3.10 \
|
||||
python3.10-venv \
|
||||
udev \
|
||||
wget
|
||||
wget \
|
||||
x11-xserver-utils \
|
||||
xvfb
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
apt-get install -y --no-install-recommends \
|
||||
libmfx-dev
|
||||
@@ -98,3 +105,28 @@ chmod a+x ./cuda.run
|
||||
./cuda.run --silent --toolkit --toolkitpath=/usr/local --no-opengl-libs --no-man-page --no-drm
|
||||
rm ./cuda.run
|
||||
_INSTALL_CUDA
|
||||
|
||||
WORKDIR /
|
||||
# Write a shell script that starts Xvfb and then runs a shell
|
||||
RUN <<_ENTRYPOINT
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cat <<EOF > /entrypoint.sh
|
||||
#!/bin/bash
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
if [ "\$#" -eq 0 ]; then
|
||||
exec "/bin/bash"
|
||||
else
|
||||
exec "\$@"
|
||||
fi
|
||||
EOF
|
||||
_ENTRYPOINT
|
||||
|
||||
# Make the script executable
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Note about CLion
|
||||
RUN echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings"
|
||||
|
||||
# Use the shell script as the entrypoint
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
@@ -32,8 +32,9 @@ apt-get update -y
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake=3.25.* \
|
||||
doxygen \
|
||||
git \
|
||||
libavdevice-dev \
|
||||
graphviz \
|
||||
libayatana-appindicator3-dev \
|
||||
libboost-filesystem-dev=1.74.* \
|
||||
libboost-locale-dev=1.74.* \
|
||||
@@ -61,8 +62,12 @@ apt-get install -y --no-install-recommends \
|
||||
libxtst-dev \
|
||||
nodejs \
|
||||
npm \
|
||||
python3.11 \
|
||||
python3.11-venv \
|
||||
udev \
|
||||
wget
|
||||
wget \
|
||||
x11-xserver-utils \
|
||||
xvfb
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
apt-get install -y --no-install-recommends \
|
||||
libmfx-dev
|
||||
@@ -120,6 +125,17 @@ make -j "$(nproc)"
|
||||
cpack -G DEB
|
||||
_MAKE
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
./test_sunshine --gtest_color=yes
|
||||
_TEST
|
||||
|
||||
FROM scratch AS artifacts
|
||||
ARG BASE
|
||||
ARG TAG
|
||||
|
||||
@@ -33,8 +33,9 @@ apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
cmake=3.18.* \
|
||||
doxygen \
|
||||
git \
|
||||
libavdevice-dev \
|
||||
graphviz \
|
||||
libayatana-appindicator3-dev \
|
||||
libboost-filesystem-dev=1.74.* \
|
||||
libboost-locale-dev=1.74.* \
|
||||
@@ -60,8 +61,12 @@ apt-get install -y --no-install-recommends \
|
||||
libxfixes-dev \
|
||||
libxrandr-dev \
|
||||
libxtst-dev \
|
||||
python3.9 \
|
||||
python3.9-venv \
|
||||
udev \
|
||||
wget
|
||||
wget \
|
||||
x11-xserver-utils \
|
||||
xvfb
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
apt-get install -y --no-install-recommends \
|
||||
libmfx-dev
|
||||
@@ -134,6 +139,17 @@ make -j "$(nproc)"
|
||||
cpack -G DEB
|
||||
_MAKE
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
./test_sunshine --gtest_color=yes
|
||||
_TEST
|
||||
|
||||
FROM scratch AS artifacts
|
||||
ARG BASE
|
||||
ARG TAG
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# artifacts: true
|
||||
# platforms: linux/amd64,linux/arm64/v8
|
||||
# platforms: linux/amd64
|
||||
# platforms_pr: linux/amd64
|
||||
# no-cache-filters: sunshine-base,artifacts,sunshine
|
||||
ARG BASE=fedora
|
||||
@@ -32,9 +32,11 @@ dnf -y group install "Development Tools"
|
||||
dnf -y install \
|
||||
boost-devel-1.78.0* \
|
||||
cmake-3.27.* \
|
||||
doxygen \
|
||||
gcc-13.2.* \
|
||||
gcc-c++-13.2.* \
|
||||
git \
|
||||
graphviz \
|
||||
libappindicator-gtk3-devel \
|
||||
libcap-devel \
|
||||
libcurl-devel \
|
||||
@@ -58,9 +60,11 @@ dnf -y install \
|
||||
openssl-devel \
|
||||
opus-devel \
|
||||
pulseaudio-libs-devel \
|
||||
python3.10 \
|
||||
rpm-build \
|
||||
wget \
|
||||
which
|
||||
which \
|
||||
xorg-x11-server-Xvfb
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
dnf -y install intel-mediasdk-devel
|
||||
fi
|
||||
@@ -68,28 +72,27 @@ dnf clean all
|
||||
rm -rf /var/cache/yum
|
||||
_DEPS
|
||||
|
||||
# todo - enable cuda once it's supported for gcc 13 and fedora 38
|
||||
## install cuda
|
||||
#WORKDIR /build/cuda
|
||||
WORKDIR /build/cuda
|
||||
## versions: https://developer.nvidia.com/cuda-toolkit-archive
|
||||
#ENV CUDA_VERSION="12.0.0"
|
||||
#ENV CUDA_BUILD="525.60.13"
|
||||
ENV CUDA_VERSION="12.4.0"
|
||||
ENV CUDA_BUILD="550.54.14"
|
||||
## hadolint ignore=SC3010
|
||||
#RUN <<_INSTALL_CUDA
|
||||
##!/bin/bash
|
||||
#set -e
|
||||
#cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
||||
#cuda_suffix=""
|
||||
#if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
||||
# cuda_suffix="_sbsa"
|
||||
#fi
|
||||
#url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
|
||||
#echo "cuda url: ${url}"
|
||||
#wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
|
||||
#chmod a+x ./cuda.run
|
||||
#./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm
|
||||
#rm ./cuda.run
|
||||
#_INSTALL_CUDA
|
||||
RUN <<_INSTALL_CUDA
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
||||
cuda_suffix=""
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
||||
cuda_suffix="_sbsa"
|
||||
fi
|
||||
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
|
||||
echo "cuda url: ${url}"
|
||||
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
|
||||
chmod a+x ./cuda.run
|
||||
./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm
|
||||
rm ./cuda.run
|
||||
_INSTALL_CUDA
|
||||
|
||||
# copy repository
|
||||
WORKDIR /build/sunshine/
|
||||
@@ -99,12 +102,11 @@ COPY --link .. .
|
||||
WORKDIR /build/sunshine/build
|
||||
|
||||
# cmake and cpack
|
||||
# todo - add cmake argument back in for cuda support "-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \"
|
||||
# todo - re-enable "DSUNSHINE_ENABLE_CUDA"
|
||||
RUN <<_MAKE
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cmake \
|
||||
-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \
|
||||
-DBUILD_WERROR=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
@@ -113,12 +115,23 @@ cmake \
|
||||
-DSUNSHINE_ENABLE_WAYLAND=ON \
|
||||
-DSUNSHINE_ENABLE_X11=ON \
|
||||
-DSUNSHINE_ENABLE_DRM=ON \
|
||||
-DSUNSHINE_ENABLE_CUDA=OFF \
|
||||
-DSUNSHINE_ENABLE_CUDA=ON \
|
||||
/build/sunshine
|
||||
make -j "$(nproc)"
|
||||
cpack -G RPM
|
||||
_MAKE
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
./test_sunshine --gtest_color=yes
|
||||
_TEST
|
||||
|
||||
FROM scratch AS artifacts
|
||||
ARG BASE
|
||||
ARG TAG
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# artifacts: true
|
||||
# platforms: linux/amd64,linux/arm64/v8
|
||||
# platforms: linux/amd64
|
||||
# platforms_pr: linux/amd64
|
||||
# no-cache-filters: sunshine-base,artifacts,sunshine
|
||||
ARG BASE=fedora
|
||||
@@ -32,9 +32,11 @@ dnf -y group install "Development Tools"
|
||||
dnf -y install \
|
||||
boost-devel-1.81.0* \
|
||||
cmake-3.27.* \
|
||||
doxygen \
|
||||
gcc-13.2.* \
|
||||
gcc-c++-13.2.* \
|
||||
git \
|
||||
graphviz \
|
||||
libappindicator-gtk3-devel \
|
||||
libcap-devel \
|
||||
libcurl-devel \
|
||||
@@ -58,9 +60,11 @@ dnf -y install \
|
||||
openssl-devel \
|
||||
opus-devel \
|
||||
pulseaudio-libs-devel \
|
||||
python3.11 \
|
||||
rpm-build \
|
||||
wget \
|
||||
which
|
||||
which \
|
||||
xorg-x11-server-Xvfb
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
dnf -y install intel-mediasdk-devel
|
||||
fi
|
||||
@@ -68,28 +72,34 @@ dnf clean all
|
||||
rm -rf /var/cache/yum
|
||||
_DEPS
|
||||
|
||||
# todo - enable cuda once it's supported for gcc 13 and fedora 39
|
||||
## install cuda
|
||||
#WORKDIR /build/cuda
|
||||
## versions: https://developer.nvidia.com/cuda-toolkit-archive
|
||||
#ENV CUDA_VERSION="12.0.0"
|
||||
#ENV CUDA_BUILD="525.60.13"
|
||||
## hadolint ignore=SC3010
|
||||
#RUN <<_INSTALL_CUDA
|
||||
##!/bin/bash
|
||||
#set -e
|
||||
#cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
||||
#cuda_suffix=""
|
||||
#if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
||||
# cuda_suffix="_sbsa"
|
||||
#fi
|
||||
#url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
|
||||
#echo "cuda url: ${url}"
|
||||
#wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
|
||||
#chmod a+x ./cuda.run
|
||||
#./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm
|
||||
#rm ./cuda.run
|
||||
#_INSTALL_CUDA
|
||||
# install cuda
|
||||
WORKDIR /build/cuda
|
||||
# versions: https://developer.nvidia.com/cuda-toolkit-archive
|
||||
ENV CUDA_VERSION="12.4.0"
|
||||
ENV CUDA_BUILD="550.54.14"
|
||||
# hadolint ignore=SC3010
|
||||
RUN <<_INSTALL_CUDA
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
|
||||
cuda_suffix=""
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
||||
cuda_suffix="_sbsa"
|
||||
|
||||
# patch headers https://bugs.launchpad.net/ubuntu/+source/mumax3/+bug/2032624
|
||||
sed -i 's/__Float32x4_t/int/g' /usr/include/bits/math-vector.h
|
||||
sed -i 's/__Float64x2_t/int/g' /usr/include/bits/math-vector.h
|
||||
sed -i 's/__SVFloat32_t/float/g' /usr/include/bits/math-vector.h
|
||||
sed -i 's/__SVFloat64_t/float/g' /usr/include/bits/math-vector.h
|
||||
sed -i 's/__SVBool_t/int/g' /usr/include/bits/math-vector.h
|
||||
fi
|
||||
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
|
||||
echo "cuda url: ${url}"
|
||||
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
|
||||
chmod a+x ./cuda.run
|
||||
./cuda.run --silent --toolkit --toolkitpath=/build/cuda --no-opengl-libs --no-man-page --no-drm
|
||||
rm ./cuda.run
|
||||
_INSTALL_CUDA
|
||||
|
||||
# copy repository
|
||||
WORKDIR /build/sunshine/
|
||||
@@ -99,12 +109,11 @@ COPY --link .. .
|
||||
WORKDIR /build/sunshine/build
|
||||
|
||||
# cmake and cpack
|
||||
# todo - add cmake argument back in for cuda support "-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \"
|
||||
# todo - re-enable "DSUNSHINE_ENABLE_CUDA"
|
||||
RUN <<_MAKE
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cmake \
|
||||
-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \
|
||||
-DBUILD_WERROR=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
@@ -113,12 +122,23 @@ cmake \
|
||||
-DSUNSHINE_ENABLE_WAYLAND=ON \
|
||||
-DSUNSHINE_ENABLE_X11=ON \
|
||||
-DSUNSHINE_ENABLE_DRM=ON \
|
||||
-DSUNSHINE_ENABLE_CUDA=OFF \
|
||||
-DSUNSHINE_ENABLE_CUDA=ON \
|
||||
/build/sunshine
|
||||
make -j "$(nproc)"
|
||||
cpack -G RPM
|
||||
_MAKE
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
./test_sunshine --gtest_color=yes
|
||||
_TEST
|
||||
|
||||
FROM scratch AS artifacts
|
||||
ARG BASE
|
||||
ARG TAG
|
||||
|
||||
@@ -33,9 +33,10 @@ apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake=3.22.* \
|
||||
ca-certificates \
|
||||
doxygen \
|
||||
git \
|
||||
graphviz \
|
||||
libayatana-appindicator3-dev \
|
||||
libavdevice-dev \
|
||||
libboost-filesystem-dev=1.74.* \
|
||||
libboost-locale-dev=1.74.* \
|
||||
libboost-log-dev=1.74.* \
|
||||
@@ -60,8 +61,12 @@ apt-get install -y --no-install-recommends \
|
||||
libxfixes-dev \
|
||||
libxrandr-dev \
|
||||
libxtst-dev \
|
||||
python3.10 \
|
||||
python3.10-venv \
|
||||
udev \
|
||||
wget
|
||||
wget \
|
||||
x11-xserver-utils \
|
||||
xvfb
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
apt-get install -y --no-install-recommends \
|
||||
libmfx-dev
|
||||
@@ -135,6 +140,17 @@ make -j "$(nproc)"
|
||||
cpack -G DEB
|
||||
_MAKE
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
./test_sunshine --gtest_color=yes
|
||||
_TEST
|
||||
|
||||
FROM scratch AS artifacts
|
||||
ARG BASE
|
||||
ARG TAG
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
# artifacts: true
|
||||
# platforms: linux/amd64,linux/arm64/v8
|
||||
# platforms: linux/amd64
|
||||
# platforms_pr: linux/amd64
|
||||
# no-cache-filters: sunshine-base,artifacts,sunshine
|
||||
ARG BASE=ubuntu
|
||||
ARG TAG=20.04
|
||||
ARG TAG=24.04
|
||||
FROM ${BASE}:${TAG} AS sunshine-base
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
@@ -31,16 +31,18 @@ set -e
|
||||
apt-get update -y
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake=3.28.* \
|
||||
ca-certificates \
|
||||
gcc-10=10.5.* \
|
||||
g++-10=10.5.* \
|
||||
doxygen \
|
||||
gcc-11 \
|
||||
g++-11 \
|
||||
git \
|
||||
graphviz \
|
||||
libayatana-appindicator3-dev \
|
||||
libavdevice-dev \
|
||||
libboost-filesystem-dev=1.71.* \
|
||||
libboost-locale-dev=1.71.* \
|
||||
libboost-log-dev=1.71.* \
|
||||
libboost-program-options-dev=1.71.* \
|
||||
libboost-filesystem-dev=1.83.* \
|
||||
libboost-locale-dev=1.83.* \
|
||||
libboost-log-dev=1.83.* \
|
||||
libboost-program-options-dev=1.83.* \
|
||||
libcap-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libdrm-dev \
|
||||
@@ -61,8 +63,12 @@ apt-get install -y --no-install-recommends \
|
||||
libxfixes-dev \
|
||||
libxrandr-dev \
|
||||
libxtst-dev \
|
||||
python3.12 \
|
||||
python3.12-venv \
|
||||
udev \
|
||||
wget
|
||||
wget \
|
||||
x11-xserver-utils \
|
||||
xvfb
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
apt-get install -y --no-install-recommends \
|
||||
libmfx-dev
|
||||
@@ -71,6 +77,7 @@ apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
_DEPS
|
||||
|
||||
|
||||
#Install Node
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_INSTALL_NODE
|
||||
@@ -88,35 +95,13 @@ RUN <<_GCC_ALIAS
|
||||
#!/bin/bash
|
||||
set -e
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-10 100 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-11 100 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-11 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-11 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11
|
||||
_GCC_ALIAS
|
||||
|
||||
# install cmake
|
||||
# sunshine requires cmake >= 3.18
|
||||
WORKDIR /build/cmake
|
||||
# https://cmake.org/download/
|
||||
ENV CMAKE_VERSION="3.25.1"
|
||||
# hadolint ignore=SC3010
|
||||
RUN <<_INSTALL_CMAKE
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cmake_prefix="https://github.com/Kitware/CMake/releases/download/v"
|
||||
if [[ "${TARGETPLATFORM}" == 'linux/amd64' ]]; then
|
||||
cmake_arch="x86_64"
|
||||
elif [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
||||
cmake_arch="aarch64"
|
||||
fi
|
||||
url="${cmake_prefix}${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-${cmake_arch}.sh"
|
||||
echo "cmake url: ${url}"
|
||||
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cmake.sh
|
||||
sh ./cmake.sh --prefix=/usr/local --skip-license
|
||||
rm ./cmake.sh
|
||||
_INSTALL_CMAKE
|
||||
|
||||
# install cuda
|
||||
WORKDIR /build/cuda
|
||||
# versions: https://developer.nvidia.com/cuda-toolkit-archive
|
||||
@@ -154,6 +139,7 @@ set -e
|
||||
#Set Node version
|
||||
source "$HOME/.nvm/nvm.sh"
|
||||
nvm use 20.9.0
|
||||
#Actually build
|
||||
cmake \
|
||||
-DBUILD_WERROR=ON \
|
||||
-DCMAKE_CUDA_COMPILER:PATH=/build/cuda/bin/nvcc \
|
||||
@@ -170,6 +156,17 @@ make -j "$(nproc)"
|
||||
cpack -G DEB
|
||||
_MAKE
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
./test_sunshine --gtest_color=yes
|
||||
_TEST
|
||||
|
||||
FROM scratch AS artifacts
|
||||
ARG BASE
|
||||
ARG TAG
|
||||
@@ -197,9 +194,9 @@ EXPOSE 48010
|
||||
EXPOSE 47998-48000/udp
|
||||
|
||||
# setup user
|
||||
ARG PGID=1000
|
||||
ARG PGID=1001
|
||||
ENV PGID=${PGID}
|
||||
ARG PUID=1000
|
||||
ARG PUID=1001
|
||||
ENV PUID=${PUID}
|
||||
ENV TZ="UTC"
|
||||
ARG UNAME=lizard
|
||||
247
docs/Doxyfile
247
docs/Doxyfile
@@ -1,4 +1,4 @@
|
||||
# Doxyfile 1.9.6
|
||||
# Doxyfile 1.10.0
|
||||
|
||||
# This file describes the settings to be used by the documentation system
|
||||
# doxygen (www.doxygen.org) for a project.
|
||||
@@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8
|
||||
# title of most generated pages and in a few other places.
|
||||
# The default value is: My Project.
|
||||
|
||||
PROJECT_NAME = "Sunshine"
|
||||
PROJECT_NAME = Sunshine
|
||||
|
||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
@@ -63,6 +63,12 @@ PROJECT_BRIEF = "Sunshine is a Gamestream host for Moonlight."
|
||||
|
||||
PROJECT_LOGO = ../sunshine.png
|
||||
|
||||
# With the PROJECT_ICON tag one can specify an icon that is included in the tabs
|
||||
# when the HTML document is shown. Doxygen will copy the logo to the output
|
||||
# directory.
|
||||
|
||||
PROJECT_ICON =
|
||||
|
||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
|
||||
# into which the generated documentation will be written. If a relative path is
|
||||
# entered, it will be relative to the location where doxygen was started. If
|
||||
@@ -365,6 +371,17 @@ MARKDOWN_SUPPORT = YES
|
||||
|
||||
TOC_INCLUDE_HEADINGS = 5
|
||||
|
||||
# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to
|
||||
# generate identifiers for the Markdown headings. Note: Every identifier is
|
||||
# unique.
|
||||
# Possible values are: DOXYGEN use a fixed 'autotoc_md' string followed by a
|
||||
# sequence number starting at 0 and GITHUB use the lower case version of title
|
||||
# with any whitespace replaced by '-' and punctuation characters removed.
|
||||
# The default value is: DOXYGEN.
|
||||
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
|
||||
|
||||
MARKDOWN_ID_STYLE = DOXYGEN
|
||||
|
||||
# When enabled doxygen tries to link words that correspond to documented
|
||||
# classes, or namespaces to their corresponding documentation. Such a link can
|
||||
# be prevented in individual cases by putting a % sign in front of the word or
|
||||
@@ -489,6 +506,14 @@ LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
NUM_PROC_THREADS = 0
|
||||
|
||||
# If the TIMESTAMP tag is set different from NO then each generated page will
|
||||
# contain the date or date and time when the page was generated. Setting this to
|
||||
# NO can help when comparing the output of multiple runs.
|
||||
# Possible values are: YES, NO, DATETIME and DATE.
|
||||
# The default value is: NO.
|
||||
|
||||
TIMESTAMP = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -874,7 +899,14 @@ WARN_IF_UNDOC_ENUM_VAL = NO
|
||||
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
|
||||
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
|
||||
# at the end of the doxygen process doxygen will return with a non-zero status.
|
||||
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
|
||||
# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves
|
||||
# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not
|
||||
# write the warning messages in between other messages but write them at the end
|
||||
# of a run, in case a WARN_LOGFILE is defined the warning messages will be
|
||||
# besides being in the defined file also be shown at the end of a run, unless
|
||||
# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case
|
||||
# the behavior will remain as with the setting FAIL_ON_WARNINGS.
|
||||
# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT.
|
||||
# The default value is: NO.
|
||||
|
||||
WARN_AS_ERROR = NO
|
||||
@@ -953,12 +985,12 @@ INPUT_FILE_ENCODING =
|
||||
# Note the list of default checked file patterns might differ from the list of
|
||||
# default file extension mappings.
|
||||
#
|
||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
|
||||
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
|
||||
# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
|
||||
# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
|
||||
# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
|
||||
# *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cxxm,
|
||||
# *.cpp, *.cppm, *.ccm, *.c++, *.c++m, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl,
|
||||
# *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, *.h++, *.ixx, *.l, *.cs, *.d,
|
||||
# *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to
|
||||
# be provided as doxygen C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
|
||||
# *.f18, *.f, *.for, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice.
|
||||
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
@@ -1043,9 +1075,6 @@ EXCLUDE_PATTERNS =
|
||||
# output. The symbol name can be a fully qualified name, a word, or if the
|
||||
# wildcard * is used, a substring. Examples: ANamespace, AClass,
|
||||
# ANamespace::AClass, ANamespace::*Test
|
||||
#
|
||||
# Note that the wildcards are matched against the file with absolute path, so to
|
||||
# exclude all test directories use the pattern */test/*
|
||||
|
||||
EXCLUDE_SYMBOLS =
|
||||
|
||||
@@ -1159,7 +1188,8 @@ FORTRAN_COMMENT_AFTER = 72
|
||||
SOURCE_BROWSER = NO
|
||||
|
||||
# Setting the INLINE_SOURCES tag to YES will include the body of functions,
|
||||
# classes and enums directly into the documentation.
|
||||
# multi-line macros, enums or list initialized variables directly into the
|
||||
# documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
INLINE_SOURCES = NO
|
||||
@@ -1428,15 +1458,6 @@ HTML_COLORSTYLE_SAT = 100
|
||||
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
|
||||
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to YES can help to show when doxygen was last run and thus if the
|
||||
# documentation is up to date.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_TIMESTAMP = NO
|
||||
|
||||
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
|
||||
# documentation will contain a main index with vertical navigation menus that
|
||||
# are dynamically created via JavaScript. If disabled, the navigation index will
|
||||
@@ -1456,6 +1477,33 @@ HTML_DYNAMIC_MENUS = YES
|
||||
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
|
||||
# If the HTML_CODE_FOLDING tag is set to YES then classes and functions can be
|
||||
# dynamically folded and expanded in the generated HTML source code.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_CODE_FOLDING = YES
|
||||
|
||||
# If the HTML_COPY_CLIPBOARD tag is set to YES then doxygen will show an icon in
|
||||
# the top right corner of code and text fragments that allows the user to copy
|
||||
# its content to the clipboard. Note this only works if supported by the browser
|
||||
# and the web page is served via a secure context (see:
|
||||
# https://www.w3.org/TR/secure-contexts/), i.e. using the https: or file:
|
||||
# protocol.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_COPY_CLIPBOARD = YES
|
||||
|
||||
# Doxygen stores a couple of settings persistently in the browser (via e.g.
|
||||
# cookies). By default these settings apply to all HTML pages generated by
|
||||
# doxygen across all projects. The HTML_PROJECT_COOKIE tag can be used to store
|
||||
# the settings under a project specific key, such that the user preferences will
|
||||
# be stored separately.
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
HTML_PROJECT_COOKIE =
|
||||
|
||||
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
|
||||
# shown in the various tree structured indices initially; the user can expand
|
||||
# and collapse entries dynamically later on. Doxygen will expand the tree to
|
||||
@@ -1586,6 +1634,16 @@ BINARY_TOC = NO
|
||||
|
||||
TOC_EXPAND = NO
|
||||
|
||||
# The SITEMAP_URL tag is used to specify the full URL of the place where the
|
||||
# generated documentation will be placed on the server by the user during the
|
||||
# deployment of the documentation. The generated sitemap is called sitemap.xml
|
||||
# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL
|
||||
# is specified no sitemap is generated. For information about the sitemap
|
||||
# protocol see https://www.sitemaps.org
|
||||
# This tag requires that the tag GENERATE_HTML is set to YES.
|
||||
|
||||
SITEMAP_URL =
|
||||
|
||||
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
|
||||
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
|
||||
# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
|
||||
@@ -2074,9 +2132,16 @@ PDF_HYPERLINKS = YES
|
||||
|
||||
USE_PDFLATEX = YES
|
||||
|
||||
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
|
||||
# command to the generated LaTeX files. This will instruct LaTeX to keep running
|
||||
# if errors occur, instead of asking the user for help.
|
||||
# The LATEX_BATCHMODE tag signals the behavior of LaTeX in case of an error.
|
||||
# Possible values are: NO same as ERROR_STOP, YES same as BATCH, BATCH In batch
|
||||
# mode nothing is printed on the terminal, errors are scrolled as if <return> is
|
||||
# hit at every error; missing files that TeX tries to input or request from
|
||||
# keyboard input (\read on a not open input stream) cause the job to abort,
|
||||
# NON_STOP In nonstop mode the diagnostic message will appear on the terminal,
|
||||
# but there is no possibility of user interaction just like in batch mode,
|
||||
# SCROLL In scroll mode, TeX will stop only for missing files to input or if
|
||||
# keyboard input is necessary and ERROR_STOP In errorstop mode, TeX will stop at
|
||||
# each error, asking for user intervention.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
@@ -2097,14 +2162,6 @@ LATEX_HIDE_INDICES = NO
|
||||
|
||||
LATEX_BIB_STYLE = plain
|
||||
|
||||
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
|
||||
# page will contain the date and time when the page was generated. Setting this
|
||||
# to NO can help when comparing the output of multiple runs.
|
||||
# The default value is: NO.
|
||||
# This tag requires that the tag GENERATE_LATEX is set to YES.
|
||||
|
||||
LATEX_TIMESTAMP = NO
|
||||
|
||||
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
|
||||
# path from which the emoji images will be read. If a relative path is entered,
|
||||
# it will be relative to the LATEX_OUTPUT directory. If left blank the
|
||||
@@ -2270,13 +2327,39 @@ DOCBOOK_OUTPUT = doxydocbook
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
|
||||
# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
|
||||
# AutoGen Definitions (see https://autogen.sourceforge.net/) file that captures
|
||||
# the structure of the code including all documentation. Note that this feature
|
||||
# is still experimental and incomplete at the moment.
|
||||
# The default value is: NO.
|
||||
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to Sqlite3 output
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# If the GENERATE_SQLITE3 tag is set to YES doxygen will generate a Sqlite3
|
||||
# database with symbols found by doxygen stored in tables.
|
||||
# The default value is: NO.
|
||||
|
||||
GENERATE_SQLITE3 = NO
|
||||
|
||||
# The SQLITE3_OUTPUT tag is used to specify where the Sqlite3 database will be
|
||||
# put. If a relative path is entered the value of OUTPUT_DIRECTORY will be put
|
||||
# in front of it.
|
||||
# The default directory is: sqlite3.
|
||||
# This tag requires that the tag GENERATE_SQLITE3 is set to YES.
|
||||
|
||||
SQLITE3_OUTPUT = sqlite3
|
||||
|
||||
# The SQLITE3_RECREATE_DB tag is set to YES, the existing doxygen_sqlite3.db
|
||||
# database file will be recreated with each doxygen run. If set to NO, doxygen
|
||||
# will warn if a database file is already found and not modify it.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag GENERATE_SQLITE3 is set to YES.
|
||||
|
||||
SQLITE3_RECREATE_DB = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -2419,15 +2502,15 @@ TAGFILES =
|
||||
|
||||
GENERATE_TAGFILE =
|
||||
|
||||
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
|
||||
# the class index. If set to NO, only the inherited external classes will be
|
||||
# listed.
|
||||
# If the ALLEXTERNALS tag is set to YES, all external classes and namespaces
|
||||
# will be listed in the class and namespace index. If set to NO, only the
|
||||
# inherited external classes will be listed.
|
||||
# The default value is: NO.
|
||||
|
||||
ALLEXTERNALS = NO
|
||||
|
||||
# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
|
||||
# in the modules index. If set to NO, only the current project's groups will be
|
||||
# in the topic index. If set to NO, only the current project's groups will be
|
||||
# listed.
|
||||
# The default value is: YES.
|
||||
|
||||
@@ -2441,16 +2524,9 @@ EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
# Configuration options related to diagram generator tools
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
DIA_PATH =
|
||||
|
||||
# If set to YES the inheritance and collaboration graphs will hide inheritance
|
||||
# and usage relations if the target is undocumented or is not a class.
|
||||
# The default value is: YES.
|
||||
@@ -2459,7 +2535,7 @@ HIDE_UNDOC_RELATIONS = YES
|
||||
|
||||
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
|
||||
# available from the path. This tool is part of Graphviz (see:
|
||||
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# https://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
|
||||
# Bell Labs. The other options in this section have no effect if this option is
|
||||
# set to NO
|
||||
# The default value is: NO.
|
||||
@@ -2512,13 +2588,19 @@ DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
|
||||
|
||||
DOT_FONTPATH =
|
||||
|
||||
# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect inheritance
|
||||
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
|
||||
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
|
||||
# to TEXT the direct and indirect inheritance relations will be shown as texts /
|
||||
# links.
|
||||
# Possible values are: NO, YES, TEXT and GRAPH.
|
||||
# If the CLASS_GRAPH tag is set to YES or GRAPH or BUILTIN then doxygen will
|
||||
# generate a graph for each documented class showing the direct and indirect
|
||||
# inheritance relations. In case the CLASS_GRAPH tag is set to YES or GRAPH and
|
||||
# HAVE_DOT is enabled as well, then dot will be used to draw the graph. In case
|
||||
# the CLASS_GRAPH tag is set to YES and HAVE_DOT is disabled or if the
|
||||
# CLASS_GRAPH tag is set to BUILTIN, then the built-in generator will be used.
|
||||
# If the CLASS_GRAPH tag is set to TEXT the direct and indirect inheritance
|
||||
# relations will be shown as texts / links. Explicit enabling an inheritance
|
||||
# graph or choosing a different representation for an inheritance graph of a
|
||||
# specific class, can be accomplished by means of the command \inheritancegraph.
|
||||
# Disabling an inheritance graph can be accomplished by means of the command
|
||||
# \hideinheritancegraph.
|
||||
# Possible values are: NO, YES, TEXT, GRAPH and BUILTIN.
|
||||
# The default value is: YES.
|
||||
|
||||
CLASS_GRAPH = YES
|
||||
@@ -2526,15 +2608,21 @@ CLASS_GRAPH = YES
|
||||
# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
|
||||
# graph for each documented class showing the direct and indirect implementation
|
||||
# dependencies (inheritance, containment, and class references variables) of the
|
||||
# class with other documented classes.
|
||||
# class with other documented classes. Explicit enabling a collaboration graph,
|
||||
# when COLLABORATION_GRAPH is set to NO, can be accomplished by means of the
|
||||
# command \collaborationgraph. Disabling a collaboration graph can be
|
||||
# accomplished by means of the command \hidecollaborationgraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
COLLABORATION_GRAPH = YES
|
||||
|
||||
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
|
||||
# groups, showing the direct groups dependencies. See also the chapter Grouping
|
||||
# in the manual.
|
||||
# groups, showing the direct groups dependencies. Explicit enabling a group
|
||||
# dependency graph, when GROUP_GRAPHS is set to NO, can be accomplished by means
|
||||
# of the command \groupgraph. Disabling a directory graph can be accomplished by
|
||||
# means of the command \hidegroupgraph. See also the chapter Grouping in the
|
||||
# manual.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@@ -2576,8 +2664,8 @@ DOT_UML_DETAILS = NO
|
||||
|
||||
# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
|
||||
# to display on a single line. If the actual line length exceeds this threshold
|
||||
# significantly it will wrapped across multiple lines. Some heuristics are apply
|
||||
# to avoid ugly line breaks.
|
||||
# significantly it will be wrapped across multiple lines. Some heuristics are
|
||||
# applied to avoid ugly line breaks.
|
||||
# Minimum value: 0, maximum value: 1000, default value: 17.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@@ -2594,7 +2682,9 @@ TEMPLATE_RELATIONS = NO
|
||||
# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
|
||||
# YES then doxygen will generate a graph for each documented file showing the
|
||||
# direct and indirect include dependencies of the file with other documented
|
||||
# files.
|
||||
# files. Explicit enabling an include graph, when INCLUDE_GRAPH is is set to NO,
|
||||
# can be accomplished by means of the command \includegraph. Disabling an
|
||||
# include graph can be accomplished by means of the command \hideincludegraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@@ -2603,7 +2693,10 @@ INCLUDE_GRAPH = YES
|
||||
# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
|
||||
# set to YES then doxygen will generate a graph for each documented file showing
|
||||
# the direct and indirect include dependencies of the file with other documented
|
||||
# files.
|
||||
# files. Explicit enabling an included by graph, when INCLUDED_BY_GRAPH is set
|
||||
# to NO, can be accomplished by means of the command \includedbygraph. Disabling
|
||||
# an included by graph can be accomplished by means of the command
|
||||
# \hideincludedbygraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@@ -2643,7 +2736,10 @@ GRAPHICAL_HIERARCHY = YES
|
||||
# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
|
||||
# dependencies a directory has on other directories in a graphical way. The
|
||||
# dependency relations are determined by the #include relations between the
|
||||
# files in the directories.
|
||||
# files in the directories. Explicit enabling a directory graph, when
|
||||
# DIRECTORY_GRAPH is set to NO, can be accomplished by means of the command
|
||||
# \directorygraph. Disabling a directory graph can be accomplished by means of
|
||||
# the command \hidedirectorygraph.
|
||||
# The default value is: YES.
|
||||
# This tag requires that the tag HAVE_DOT is set to YES.
|
||||
|
||||
@@ -2659,7 +2755,7 @@ DIR_GRAPH_MAX_DEPTH = 1
|
||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||
# generated by dot. For an explanation of the image formats see the section
|
||||
# output formats in the documentation of the dot tool (Graphviz (see:
|
||||
# http://www.graphviz.org/)).
|
||||
# https://www.graphviz.org/)).
|
||||
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
|
||||
# to make the SVG files visible in IE 9+ (other browsers do not have this
|
||||
# requirement).
|
||||
@@ -2696,11 +2792,12 @@ DOT_PATH =
|
||||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
# If left empty dia is assumed to be found in the default search path.
|
||||
|
||||
MSCFILE_DIRS =
|
||||
DIA_PATH =
|
||||
|
||||
# The DIAFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain dia files that are included in the documentation (see the \diafile
|
||||
@@ -2777,3 +2874,19 @@ GENERATE_LEGEND = YES
|
||||
# The default value is: YES.
|
||||
|
||||
DOT_CLEANUP = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. If the MSCGEN_TOOL tag is left empty (the default), then doxygen will
|
||||
# use a built-in version of mscgen tool to produce the charts. Alternatively,
|
||||
# the MSCGEN_TOOL tag can also specify the name an external tool. For instance,
|
||||
# specifying prog as the value, doxygen will call the tool as prog -T
|
||||
# <outfile_format> -o <outputfile> <inputfile>. The external tool should support
|
||||
# output file formats "png", "eps", "svg", and "ismap".
|
||||
|
||||
MSCGEN_TOOL =
|
||||
|
||||
# The MSCFILE_DIRS tag can be used to specify one or more directories that
|
||||
# contain msc files that are included in the documentation (see the \mscfile
|
||||
# command).
|
||||
|
||||
MSCFILE_DIRS =
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
# You can set these variables from the command line, and also
|
||||
# from the environment for the first two.
|
||||
SPHINXOPTS ?=
|
||||
SPHINXOPTS ?= -W --keep-going
|
||||
SPHINXBUILD ?= sphinx-build
|
||||
SOURCEDIR = source
|
||||
BUILDDIR = build
|
||||
|
||||
@@ -9,6 +9,7 @@ if "%SPHINXBUILD%" == "" (
|
||||
)
|
||||
set SOURCEDIR=source
|
||||
set BUILDDIR=build
|
||||
set "SPHINXOPTS=-W --keep-going"
|
||||
|
||||
%SPHINXBUILD% >NUL 2>NUL
|
||||
if errorlevel 9009 (
|
||||
@@ -25,11 +26,11 @@ if errorlevel 9009 (
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% || exit /b %ERRORLEVEL%
|
||||
goto end
|
||||
|
||||
:help
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% || exit /b %ERRORLEVEL%
|
||||
|
||||
:end
|
||||
popd
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
breathe==4.35.0
|
||||
furo==2024.1.29
|
||||
m2r2==0.3.3.post2
|
||||
rstcheck[sphinx]==6.2.0
|
||||
rstcheck[sphinx]==6.2.1
|
||||
rstfmt==0.0.14
|
||||
setuptools # required by m2r2, Ubuntu 24.04 doesn't include this
|
||||
Sphinx==7.2.6
|
||||
sphinx-copybutton==0.5.2
|
||||
sphinx_inline_tabs==2023.4.21
|
||||
|
||||
@@ -47,6 +47,42 @@ editing the `conf` file in a text editor. Use the examples as reference.
|
||||
`General <https://localhost:47990/config/#general>`__
|
||||
-----------------------------------------------------
|
||||
|
||||
`locale <https://localhost:47990/config/#locale>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
The locale used for Sunshine's user interface.
|
||||
|
||||
**Choices**
|
||||
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
======= ===========
|
||||
Value Description
|
||||
======= ===========
|
||||
de German
|
||||
en English
|
||||
en_GB English (UK)
|
||||
en_US English (United States)
|
||||
es Spanish
|
||||
fr French
|
||||
it Italian
|
||||
ja Japanese
|
||||
pt Portuguese
|
||||
ru Russian
|
||||
sv Swedish
|
||||
zh Chinese (Simplified)
|
||||
======= ===========
|
||||
|
||||
**Default**
|
||||
``en``
|
||||
|
||||
**Example**
|
||||
.. code-block:: text
|
||||
|
||||
locale = en
|
||||
|
||||
`sunshine_name <https://localhost:47990/config/#sunshine_name>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -540,20 +576,29 @@ keybindings
|
||||
.. tip:: To find the name of the appropriate values follow these instructions.
|
||||
|
||||
**Linux**
|
||||
During Sunshine startup, you should see the list of detected monitors:
|
||||
During Sunshine startup, you should see the list of detected displays:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
Info: Detecting connected monitors
|
||||
Info: Detected monitor 0: DVI-D-0, connected: false
|
||||
Info: Detected monitor 1: HDMI-0, connected: true
|
||||
Info: Detected monitor 2: DP-0, connected: true
|
||||
Info: Detected monitor 3: DP-1, connected: false
|
||||
Info: Detected monitor 4: DVI-D-1, connected: false
|
||||
Info: Detecting displays
|
||||
Info: Detected display: DVI-D-0 (id: 0) connected: false
|
||||
Info: Detected display: HDMI-0 (id: 1) connected: true
|
||||
Info: Detected display: DP-0 (id: 2) connected: true
|
||||
Info: Detected display: DP-1 (id: 3) connected: false
|
||||
Info: Detected display: DVI-D-1 (id: 4) connected: false
|
||||
|
||||
You need to use the value before the colon in the output, e.g. ``1``.
|
||||
You need to use the id value inside the parenthesis, e.g. ``1``.
|
||||
|
||||
.. todo:: macOS
|
||||
**macOS**
|
||||
During Sunshine startup, you should see the list of detected displays:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
Info: Detecting displays
|
||||
Info: Detected display: Monitor-0 (id: 3) connected: true
|
||||
Info: Detected display: Monitor-1 (id: 2) connected: true
|
||||
|
||||
You need to use the id value inside the parenthesis, e.g. ``3``.
|
||||
|
||||
**Windows**
|
||||
.. code-block:: batch
|
||||
@@ -569,7 +614,10 @@ keybindings
|
||||
|
||||
output_name = 0
|
||||
|
||||
.. todo:: macOS
|
||||
**macOS**
|
||||
.. code-block:: text
|
||||
|
||||
output_name = 3
|
||||
|
||||
**Windows**
|
||||
.. code-block:: text
|
||||
@@ -1437,11 +1485,115 @@ keybindings
|
||||
`AMD AMF Encoder <https://localhost:47990/config/#amd-amf-encoder>`__
|
||||
---------------------------------------------------------------------
|
||||
|
||||
`amd_usage <https://localhost:47990/config/#amd_usage>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
The encoder usage profile is used to set the base set of encoding
|
||||
parameters.
|
||||
|
||||
.. note:: This option only applies when using amdvce `encoder`_.
|
||||
|
||||
.. note:: The other AMF options that follow will override a subset
|
||||
of the settings applied by your usage profile, but there are
|
||||
hidden parameters set in usage profiles that cannot be
|
||||
overridden elsewhere.
|
||||
|
||||
**Choices**
|
||||
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
======================= ===========
|
||||
Value Description
|
||||
======================= ===========
|
||||
transcoding transcoding (slowest)
|
||||
webcam webcam (slow)
|
||||
lowlatency_high_quality low latency, high quality (fast)
|
||||
lowlatency low latency (faster)
|
||||
ultralowlatency ultra low latency (fastest)
|
||||
======================= ===========
|
||||
|
||||
**Default**
|
||||
``ultralowlatency``
|
||||
|
||||
**Example**
|
||||
.. code-block:: text
|
||||
|
||||
amd_usage = ultralowlatency
|
||||
|
||||
`amd_rc <https://localhost:47990/config/#amd_rc>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
The encoder rate control.
|
||||
|
||||
.. note:: This option only applies when using amdvce `encoder`_.
|
||||
|
||||
.. warning:: The 'vbr_latency' option generally works best, but
|
||||
some bitrate overshoots may still occur. Enabling HRD allows
|
||||
all bitrate based rate controls to better constrain peak bitrate,
|
||||
but may result in encoding artifacts depending on your card.
|
||||
|
||||
**Choices**
|
||||
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
=========== ===========
|
||||
Value Description
|
||||
=========== ===========
|
||||
cqp constant qp mode
|
||||
cbr constant bitrate
|
||||
vbr_latency variable bitrate, latency constrained
|
||||
vbr_peak variable bitrate, peak constrained
|
||||
=========== ===========
|
||||
|
||||
**Default**
|
||||
``vbr_latency``
|
||||
|
||||
**Example**
|
||||
.. code-block:: text
|
||||
|
||||
amd_rc = vbr_latency
|
||||
|
||||
`amd_enforce_hrd <https://localhost:47990/config/#amd_enforce_hrd>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
Enable Hypothetical Reference Decoder (HRD) enforcement to help constrain the target bitrate.
|
||||
|
||||
.. note:: This option only applies when using amdvce `encoder`_.
|
||||
|
||||
.. warning:: HRD is known to cause encoding artifacts or negatively affect
|
||||
encoding quality on certain cards.
|
||||
|
||||
**Choices**
|
||||
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
======== ===========
|
||||
Value Description
|
||||
======== ===========
|
||||
enabled enable HRD
|
||||
disabled disable HRD
|
||||
======== ===========
|
||||
|
||||
**Default**
|
||||
``disabled``
|
||||
|
||||
**Example**
|
||||
.. code-block:: text
|
||||
|
||||
amd_enforce_hrd = disabled
|
||||
|
||||
`amd_quality <https://localhost:47990/config/#amd_quality>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
The encoder preset to use.
|
||||
The quality profile controls the tradeoff between
|
||||
speed and quality of encoding.
|
||||
|
||||
.. note:: This option only applies when using amdvce `encoder`_.
|
||||
|
||||
@@ -1466,65 +1618,6 @@ keybindings
|
||||
|
||||
amd_quality = balanced
|
||||
|
||||
`amd_rc <https://localhost:47990/config/#amd_rc>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
The encoder rate control.
|
||||
|
||||
.. note:: This option only applies when using amdvce `encoder`_.
|
||||
|
||||
**Choices**
|
||||
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
=========== ===========
|
||||
Value Description
|
||||
=========== ===========
|
||||
cqp constant qp mode
|
||||
cbr constant bitrate
|
||||
vbr_latency variable bitrate, latency constrained
|
||||
vbr_peak variable bitrate, peak constrained
|
||||
=========== ===========
|
||||
|
||||
**Default**
|
||||
``vbr_latency``
|
||||
|
||||
**Example**
|
||||
.. code-block:: text
|
||||
|
||||
amd_rc = vbr_latency
|
||||
|
||||
`amd_usage <https://localhost:47990/config/#amd_usage>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
The encoder usage profile, used to balance latency with encoding quality.
|
||||
|
||||
.. note:: This option only applies when using amdvce `encoder`_.
|
||||
|
||||
**Choices**
|
||||
|
||||
.. table::
|
||||
:widths: auto
|
||||
|
||||
=============== ===========
|
||||
Value Description
|
||||
=============== ===========
|
||||
transcoding transcoding (slowest)
|
||||
webcam webcam (slow)
|
||||
lowlatency low latency (fast)
|
||||
ultralowlatency ultra low latency (fastest)
|
||||
=============== ===========
|
||||
|
||||
**Default**
|
||||
``ultralowlatency``
|
||||
|
||||
**Example**
|
||||
.. code-block:: text
|
||||
|
||||
amd_usage = ultralowlatency
|
||||
|
||||
`amd_preanalysis <https://localhost:47990/config/#amd_preanalysis>`__
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -1546,7 +1639,9 @@ keybindings
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
**Description**
|
||||
Variance Based Adaptive Quantization (VBAQ) can increase subjective visual quality.
|
||||
Variance Based Adaptive Quantization (VBAQ) can increase subjective
|
||||
visual quality by prioritizing allocation of more bits to smooth
|
||||
areas compared to more textured areas.
|
||||
|
||||
.. note:: This option only applies when using amdvce `encoder`_.
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ and applications to Sunshine.
|
||||
.. attention:: Throughout these examples, any fields not shown are left blank. You can enhance your experience by
|
||||
adding an image or a log file (via the ``Output`` field).
|
||||
|
||||
.. note:: When a working directory is not specified, it defaults to the folder where the target application resides.
|
||||
|
||||
Common Examples
|
||||
---------------
|
||||
|
||||
@@ -24,7 +26,7 @@ Steam Big Picture
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. note:: Steam is launched as a detached command because Steam starts with a process that self updates itself and the original
|
||||
process is killed. Since the original process ends it will not work as a regular command.
|
||||
process is killed.
|
||||
|
||||
.. tab:: Linux
|
||||
|
||||
@@ -51,7 +53,7 @@ Steam Big Picture
|
||||
+----------------------+-----------------------------+
|
||||
| Application Name | ``Steam Big Picture`` |
|
||||
+----------------------+-----------------------------+
|
||||
| Detached Commands | ``steam://open/bigpicture`` |
|
||||
| Command | ``steam://open/bigpicture`` |
|
||||
+----------------------+-----------------------------+
|
||||
| Image | ``steam.png`` |
|
||||
+----------------------+-----------------------------+
|
||||
@@ -59,8 +61,7 @@ Steam Big Picture
|
||||
Epic Game Store game
|
||||
^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. note:: Using URI method will be the most consistent between various games, but does not allow a game to be launched
|
||||
using the "Command" and therefore the stream will not end when the game ends.
|
||||
.. note:: Using URI method will be the most consistent between various games.
|
||||
|
||||
URI (Epic)
|
||||
""""""""""
|
||||
@@ -70,7 +71,7 @@ URI (Epic)
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Application Name | ``Surviving Mars`` |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Detached Commands | ``com.epicgames.launcher://apps/d759128018124dcabb1fbee9bb28e178%3A20729b9176c241f0b617c5723e70ec2d%3AOvenbird?action=launch&silent=true`` |
|
||||
| Command | ``com.epicgames.launcher://apps/d759128018124dcabb1fbee9bb28e178%3A20729b9176c241f0b617c5723e70ec2d%3AOvenbird?action=launch&silent=true`` |
|
||||
+----------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
Binary (Epic w/ working directory)
|
||||
@@ -81,7 +82,7 @@ Binary (Epic w/ working directory)
|
||||
+----------------------+-----------------------------------------------+
|
||||
| Application Name | ``Surviving Mars`` |
|
||||
+----------------------+-----------------------------------------------+
|
||||
| Command | ``cmd /c "MarsEpic.exe"`` |
|
||||
| Command | ``MarsEpic.exe`` |
|
||||
+----------------------+-----------------------------------------------+
|
||||
| Working Directory | ``C:\Program Files\Epic Games\SurvivingMars`` |
|
||||
+----------------------+-----------------------------------------------+
|
||||
@@ -100,8 +101,7 @@ Binary (Epic w/o working directory)
|
||||
Steam game
|
||||
^^^^^^^^^^
|
||||
|
||||
.. note:: Using URI method will be the most consistent between various games, but does not allow a game to be launched
|
||||
using the "Command" and therefore the stream will not end when the game ends.
|
||||
.. note:: Using URI method will be the most consistent between various games.
|
||||
|
||||
URI (Steam)
|
||||
"""""""""""
|
||||
@@ -127,7 +127,7 @@ URI (Steam)
|
||||
+----------------------+------------------------------+
|
||||
| Application Name | ``Surviving Mars`` |
|
||||
+----------------------+------------------------------+
|
||||
| Detached Commands | ``steam://rungameid/464920`` |
|
||||
| Command | ``steam://rungameid/464920`` |
|
||||
+----------------------+------------------------------+
|
||||
|
||||
Binary (Steam w/ working directory)
|
||||
|
||||
30
docs/source/about/guides/linux/discord_calls.rst
Normal file
30
docs/source/about/guides/linux/discord_calls.rst
Normal file
@@ -0,0 +1,30 @@
|
||||
How to not stream Discord call audio
|
||||
====================================
|
||||
|
||||
#. Set your normal `Sound Output` volume to 100%
|
||||
|
||||
.. image:: ../../../images/discord_calls_01.png
|
||||
|
||||
#. Start Sunshine
|
||||
|
||||
#. Set `Sound Output` to `sink-sunshine-stereo` (if it isn't automatic)
|
||||
|
||||
.. image:: ../../../images/discord_calls_02.png
|
||||
|
||||
#. In Discord - `Right Click` - `Deafen` - Select your normal `Output Device`
|
||||
|
||||
This is also where you will need to adjust output volume for Discord calls
|
||||
|
||||
.. image:: ../../../images/discord_calls_03.png
|
||||
|
||||
#. Open `qpwgraph`
|
||||
|
||||
.. image:: ../../../images/discord_calls_04.png
|
||||
|
||||
#. Connect `sunshine [sunshine-record]` to your normal `Output Device`
|
||||
|
||||
* Drag `monitor_FL` to `playback_FL`
|
||||
|
||||
* Drag `monitor_FR` to `playback_FR`
|
||||
|
||||
.. image:: ../../../images/discord_calls_05.png
|
||||
@@ -38,20 +38,21 @@ Install
|
||||
=========================================== ============== ============== ================================
|
||||
Package CUDA Version Min Driver CUDA Compute Capabilities
|
||||
=========================================== ============== ============== ================================
|
||||
PKGBUILD User dependent User dependent User dependent
|
||||
sunshine.AppImage 11.8.0 450.80.02 35;50;52;60;61;62;70;75;80;86;90
|
||||
sunshine.pkg.tar.zst 11.8.0 450.80.02 35;50;52;60;61;62;70;75;80;86;90
|
||||
sunshine_{arch}.flatpak 12.0.0 525.60.13 50;52;60;61;62;70;75;80;86;90
|
||||
sunshine-debian-bookworm-{arch}.deb 12.0.0 525.60.13 50;52;60;61;62;70;75;80;86;90
|
||||
sunshine-debian-bullseye-{arch}.deb 11.8.0 450.80.02 35;50;52;60;61;62;70;75;80;86;90
|
||||
sunshine-fedora-38-{arch}.rpm unavailable unavailable none
|
||||
sunshine-fedora-39-{arch}.rpm unavailable unavailable none
|
||||
sunshine-ubuntu-20.04-{arch}.deb 11.8.0 450.80.02 35;50;52;60;61;62;70;75;80;86;90
|
||||
sunshine-fedora-38-{arch}.rpm 12.4.0 525.60.13 50;52;60;61;62;70;75;80;86;90
|
||||
sunshine-fedora-39-{arch}.rpm 12.4.0 525.60.13 50;52;60;61;62;70;75;80;86;90
|
||||
sunshine-ubuntu-22.04-{arch}.deb 11.8.0 450.80.02 35;50;52;60;61;62;70;75;80;86;90
|
||||
sunshine-ubuntu-24.04-{arch}.deb 11.8.0 450.80.02 35;50;52;60;61;62;70;75;80;86;90
|
||||
=========================================== ============== ============== ================================
|
||||
|
||||
.. tab:: AppImage
|
||||
|
||||
.. caution:: Use distro-specific packages instead of the AppImage if they are available.
|
||||
|
||||
According to AppImageLint the supported distro matrix of the AppImage is below.
|
||||
|
||||
- ✔ Debian bullseye
|
||||
@@ -90,21 +91,7 @@ Install
|
||||
|
||||
./sunshine.AppImage --remove
|
||||
|
||||
.. tab:: Archlinux PKGBUILD
|
||||
|
||||
#. Open terminal and run the following code.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
wget https://github.com/LizardByte/Sunshine/releases/latest/download/PKGBUILD
|
||||
makepkg -fi
|
||||
|
||||
Uninstall:
|
||||
.. code-block:: bash
|
||||
|
||||
pacman -R sunshine
|
||||
|
||||
.. tab:: Archlinux pkg
|
||||
.. tab:: Arch Linux Package
|
||||
|
||||
#. Open terminal and run the following code.
|
||||
|
||||
@@ -118,7 +105,7 @@ Install
|
||||
|
||||
pacman -R sunshine
|
||||
|
||||
.. tab:: Debian Package
|
||||
.. tab:: Debian/Ubuntu Package
|
||||
|
||||
#. Download ``sunshine-{distro}-{distro-version}-{arch}.deb`` and run the following code.
|
||||
|
||||
@@ -138,6 +125,8 @@ Install
|
||||
|
||||
.. tab:: Flatpak Package
|
||||
|
||||
.. caution:: Use distro-specific packages instead of the Flatpak if they are available.
|
||||
|
||||
.. important:: The instructions provided here are for the version supplied in the `latest release`_, which does
|
||||
not necessarily match the version in the Flathub repository!
|
||||
|
||||
@@ -205,16 +194,35 @@ Install
|
||||
|
||||
sudo dnf remove sunshine
|
||||
|
||||
The `deb`, `rpm`, `Flatpak` and `AppImage` packages should handle these steps automatically.
|
||||
The `deb`, `rpm`, `zst`, `Flatpak` and `AppImage` packages should handle these steps automatically.
|
||||
Third party packages may not.
|
||||
|
||||
Sunshine needs access to `uinput` to create mouse and gamepad events.
|
||||
|
||||
#. Create `udev` rules.
|
||||
#. Create and reload `udev` rules for uinput.
|
||||
.. code-block:: bash
|
||||
|
||||
echo 'KERNEL=="uinput", SUBSYSTEM=="misc", OPTIONS+="static_node=uinput", TAG+="uaccess"' | \
|
||||
sudo tee /etc/udev/rules.d/85-sunshine.rules
|
||||
sudo tee /etc/udev/rules.d/60-sunshine.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger
|
||||
sudo modprobe uinput
|
||||
|
||||
#. Enable permissions for KMS capture.
|
||||
.. warning:: Capture of most Wayland-based desktop environments will fail unless this step is performed.
|
||||
|
||||
.. note:: ``cap_sys_admin`` may as well be root, except you don't need to be root to run it. It is necessary to
|
||||
allow Sunshine to use KMS capture.
|
||||
|
||||
**Enable**
|
||||
.. code-block:: bash
|
||||
|
||||
sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))
|
||||
|
||||
**Disable (for Xorg/X11 only)**
|
||||
.. code-block:: bash
|
||||
|
||||
sudo setcap -r $(readlink -f $(which sunshine))
|
||||
|
||||
#. Optionally, configure autostart service
|
||||
|
||||
@@ -260,20 +268,6 @@ Install
|
||||
|
||||
systemctl --user enable sunshine
|
||||
|
||||
#. Additional Setup for KMS
|
||||
.. note:: ``cap_sys_admin`` may as well be root, except you don't need to be root to run it. It is necessary to
|
||||
allow Sunshine to use KMS.
|
||||
|
||||
**Enable**
|
||||
.. code-block:: bash
|
||||
|
||||
sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))
|
||||
|
||||
**Disable (for Xorg/X11)**
|
||||
.. code-block:: bash
|
||||
|
||||
sudo setcap -r $(readlink -f $(which sunshine))
|
||||
|
||||
#. Reboot
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -281,20 +275,17 @@ Install
|
||||
|
||||
.. tab:: macOS
|
||||
|
||||
.. important:: Sunshine on macOS is experimental. Gamepads do not work. Other features may not work as expected.
|
||||
.. important:: Sunshine on macOS is experimental. Gamepads do not work.
|
||||
|
||||
.. tab:: dmg
|
||||
.. tab:: Homebrew
|
||||
|
||||
.. warning:: The `dmg` does not include runtime dependencies. This package is not recommended for most users.
|
||||
No support will be provided!
|
||||
#. Install `Homebrew <https://docs.brew.sh/Installation>`__
|
||||
#. Update the Homebrew sources and install Sunshine.
|
||||
|
||||
#. Download the ``sunshine.dmg`` file and install it.
|
||||
|
||||
Uninstall:
|
||||
.. code-block:: bash
|
||||
|
||||
cd /etc/sunshine/assets
|
||||
uninstall_pkg.sh
|
||||
brew tap LizardByte/homebrew
|
||||
brew install sunshine
|
||||
|
||||
.. tab:: Portfile
|
||||
|
||||
@@ -316,7 +307,7 @@ Install
|
||||
|
||||
mkdir -p ~/ports/multimedia/sunshine
|
||||
cd ~/ports/multimedia/sunshine
|
||||
curl -O https://github.com/LizardByte/Sunshine/releases/latest/download/Portfile
|
||||
curl -OL https://github.com/LizardByte/Sunshine/releases/latest/download/Portfile
|
||||
cd ~/ports
|
||||
portindex
|
||||
sudo port install sunshine
|
||||
|
||||
@@ -15,7 +15,6 @@ Install Requirements
|
||||
sudo apt update && sudo apt install \
|
||||
build-essential \
|
||||
cmake \
|
||||
libavdevice-dev \
|
||||
libayatana-appindicator3-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-locale-dev \
|
||||
@@ -88,61 +87,8 @@ Install Requirements
|
||||
wget \ # necessary for cuda install with `run` file
|
||||
which # necessary for cuda install with `run` file
|
||||
|
||||
Ubuntu 20.04
|
||||
^^^^^^^^^^^^
|
||||
End of Life: April 2030
|
||||
|
||||
Install Requirements
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt update && sudo apt install \
|
||||
build-essential \
|
||||
cmake \
|
||||
g++-10 \
|
||||
libayatana-appindicator3-dev \
|
||||
libavdevice-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-locale-dev \
|
||||
libboost-log-dev \
|
||||
libboost-program-options-dev \
|
||||
libcap-dev \ # KMS
|
||||
libcurl4-openssl-dev \
|
||||
libdrm-dev \ # KMS
|
||||
libevdev-dev \
|
||||
libminiupnpc-dev \
|
||||
libmfx-dev \ # x86_64 only
|
||||
libnotify-dev \
|
||||
libnuma-dev \
|
||||
libopus-dev \
|
||||
libpulse-dev \
|
||||
libssl-dev \
|
||||
libva-dev \ # VA-API
|
||||
libvdpau-dev \
|
||||
libwayland-dev \ # Wayland
|
||||
libx11-dev \ # X11
|
||||
libxcb-shm0-dev \ # X11
|
||||
libxcb-xfixes0-dev \ # X11
|
||||
libxcb1-dev \ # X11
|
||||
libxfixes-dev \ # X11
|
||||
libxrandr-dev \ # X11
|
||||
libxtst-dev \ # X11
|
||||
nodejs \
|
||||
npm \
|
||||
wget # necessary for cuda install with `run` file
|
||||
|
||||
Update gcc alias
|
||||
.. code-block:: bash
|
||||
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-10 100 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-10 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-10 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-10 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-10
|
||||
|
||||
Ubuntu 22.04
|
||||
^^^^^^^^^^^^
|
||||
End of Life: April 2027
|
||||
|
||||
Install Requirements
|
||||
.. code-block:: bash
|
||||
@@ -151,7 +97,6 @@ Install Requirements
|
||||
build-essential \
|
||||
cmake \
|
||||
libappindicator3-dev \
|
||||
libavdevice-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-locale-dev \
|
||||
libboost-log-dev \
|
||||
@@ -181,11 +126,63 @@ Install Requirements
|
||||
nvidia-cuda-dev \ # CUDA, NvFBC
|
||||
nvidia-cuda-toolkit # CUDA, NvFBC
|
||||
|
||||
Ubuntu 24.04
|
||||
^^^^^^^^^^^^
|
||||
|
||||
Install Requirements
|
||||
.. code-block:: bash
|
||||
|
||||
sudo apt update && sudo apt install \
|
||||
build-essential \
|
||||
cmake \
|
||||
gcc-11 \
|
||||
g++-11 \
|
||||
libappindicator3-dev \
|
||||
libboost-filesystem-dev \
|
||||
libboost-locale-dev \
|
||||
libboost-log-dev \
|
||||
libboost-program-options-dev \
|
||||
libcap-dev \ # KMS
|
||||
libcurl4-openssl-dev \
|
||||
libdrm-dev \ # KMS
|
||||
libevdev-dev \
|
||||
libminiupnpc-dev \
|
||||
libmfx-dev \ # x86_64 only
|
||||
libnotify-dev \
|
||||
libnuma-dev \
|
||||
libopus-dev \
|
||||
libpulse-dev \
|
||||
libssl-dev \
|
||||
libva-dev \ # VA-API
|
||||
libwayland-dev \ # Wayland
|
||||
libx11-dev \ # X11
|
||||
libxcb-shm0-dev \ # X11
|
||||
libxcb-xfixes0-dev \ # X11
|
||||
libxcb1-dev \ # X11
|
||||
libxfixes-dev \ # X11
|
||||
libxrandr-dev \ # X11
|
||||
libxtst-dev \ # X11
|
||||
nodejs \
|
||||
npm \
|
||||
nvidia-cuda-dev \ # CUDA, NvFBC
|
||||
nvidia-cuda-toolkit # CUDA, NvFBC
|
||||
|
||||
Update gcc alias
|
||||
.. code-block:: bash
|
||||
|
||||
update-alternatives --install \
|
||||
/usr/bin/gcc gcc /usr/bin/gcc-11 100 \
|
||||
--slave /usr/bin/g++ g++ /usr/bin/g++-11 \
|
||||
--slave /usr/bin/gcov gcov /usr/bin/gcov-11 \
|
||||
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \
|
||||
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11
|
||||
|
||||
CUDA
|
||||
----
|
||||
If the version of CUDA available from your distro is not adequate, manually install CUDA.
|
||||
|
||||
.. tip:: The version of CUDA you use will determine compatibility with various GPU generations.
|
||||
At the time of writing, the recommended version to use is CUDA ~11.8.
|
||||
See `CUDA compatibility <https://docs.nvidia.com/deploy/cuda-compatibility/index.html>`__ for more info.
|
||||
|
||||
Select the appropriate run file based on your desired CUDA version and architecture according to
|
||||
|
||||
@@ -12,17 +12,31 @@ MacPorts
|
||||
Install Requirements
|
||||
.. code-block:: bash
|
||||
|
||||
sudo port install avahi boost180 cmake curl libopus miniupnpc npm9 pkgconfig
|
||||
sudo port install avahi boost180 cmake curl doxygen graphviz libopus miniupnpc npm9 pkgconfig python311 py311-pip
|
||||
|
||||
Homebrew
|
||||
""""""""
|
||||
Install Requirements
|
||||
.. code-block:: bash
|
||||
|
||||
brew install boost cmake miniupnpc node opus pkg-config
|
||||
# if there are issues with an SSL header that is not found:
|
||||
cd /usr/local/include
|
||||
ln -s ../opt/openssl/include/openssl .
|
||||
brew install boost cmake doxygen graphviz miniupnpc node opus pkg-config python@3.11
|
||||
|
||||
If there are issues with an SSL header that is not found:
|
||||
.. tab:: Intel
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd /usr/local/include
|
||||
ln -s ../opt/openssl/include/openssl .
|
||||
popd
|
||||
|
||||
.. tab:: Apple Silicon
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd /opt/homebrew/include
|
||||
ln -s ../opt/openssl/include/openssl .
|
||||
popd
|
||||
|
||||
Build
|
||||
-----
|
||||
@@ -31,7 +45,7 @@ Build
|
||||
.. code-block:: bash
|
||||
|
||||
cmake ..
|
||||
make -j ${nproc}
|
||||
make -j $(sysctl -n hw.ncpu)
|
||||
|
||||
cpack -G DragNDrop # optionally, create a macOS dmg package
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ Install dependencies:
|
||||
base-devel \
|
||||
cmake \
|
||||
diffutils \
|
||||
doxygen \
|
||||
gcc \
|
||||
git \
|
||||
make \
|
||||
@@ -25,13 +26,17 @@ Install dependencies:
|
||||
mingw-w64-x86_64-boost \
|
||||
mingw-w64-x86_64-cmake \
|
||||
mingw-w64-x86_64-curl \
|
||||
mingw-w64-x86_64-graphviz \
|
||||
mingw-w64-x86_64-miniupnpc \
|
||||
mingw-w64-x86_64-nlohmann-json \
|
||||
mingw-w64-x86_64-nodejs \
|
||||
mingw-w64-x86_64-onevpl \
|
||||
mingw-w64-x86_64-openssl \
|
||||
mingw-w64-x86_64-opus \
|
||||
mingw-w64-x86_64-toolchain
|
||||
mingw-w64-x86_64-rust \
|
||||
mingw-w64-x86_64-toolchain \
|
||||
python \
|
||||
python-pip
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
# standard imports
|
||||
from datetime import datetime
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
|
||||
@@ -27,16 +26,8 @@ project_copyright = f'{datetime.now ().year}, {project}'
|
||||
author = 'ReenigneArcher'
|
||||
|
||||
# The full version, including alpha/beta/rc tags
|
||||
with open(os.path.join(root_dir, 'CMakeLists.txt'), 'r') as f:
|
||||
version = re.search(r"project\(Sunshine VERSION ((\d+)\.(\d+)\.(\d+))", str(f.read())).group(1)
|
||||
"""
|
||||
To use cmake method for obtaining version instead of regex,
|
||||
1. Within CMakeLists.txt add the following line without backticks:
|
||||
``configure_file(docs/source/conf.py.in "${CMAKE_CURRENT_SOURCE_DIR}/docs/source/conf.py" @ONLY)``
|
||||
2. Rename this file to ``conf.py.in``
|
||||
3. Uncomment the next line
|
||||
"""
|
||||
# version = '@PROJECT_VERSION@' # use this for cmake configure_file method
|
||||
# https://docs.readthedocs.io/en/stable/reference/environment-variables.html#envvar-READTHEDOCS_VERSION
|
||||
version = os.getenv('READTHEDOCS_VERSION', 'dirty')
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
||||
@@ -105,6 +96,17 @@ doxy_proc = subprocess.run('doxygen --version', shell=True, cwd=source_dir, capt
|
||||
doxy_version = doxy_proc.stdout.decode('utf-8').strip()
|
||||
print('doxygen version: ' + doxy_version)
|
||||
|
||||
# create build directories, as doxygen fails to create it in macports and docker
|
||||
directories = [
|
||||
os.path.join(source_dir, 'build'),
|
||||
os.path.join(source_dir, 'build', 'doxyxml'),
|
||||
]
|
||||
for d in directories:
|
||||
os.makedirs(
|
||||
name=d,
|
||||
exist_ok=True,
|
||||
)
|
||||
|
||||
# run doxygen
|
||||
doxy_proc = subprocess.run('doxygen Doxyfile', shell=True, cwd=source_dir)
|
||||
if doxy_proc.returncode != 0:
|
||||
|
||||
@@ -30,42 +30,84 @@ localization there.
|
||||
|
||||
Extraction
|
||||
----------
|
||||
There should be minimal cases where strings need to be extracted from source code; however it may be necessary in some
|
||||
situations. For example if a system tray icon is added it should be localized as it is user interfacing.
|
||||
|
||||
- Wrap the string to be extracted in a function as shown.
|
||||
.. code-block:: cpp
|
||||
.. tab:: UI
|
||||
|
||||
#include <boost/locale.hpp>
|
||||
#include <string>
|
||||
Sunshine uses `Vue I18n <https://vue-i18n.intlify.dev/>`__ for localizing the UI.
|
||||
The following is a simple example of how to use it.
|
||||
|
||||
std::string msg = boost::locale::translate("Hello world!");
|
||||
- Add the string to `src_assets/common/assets/web/public/assets/locale/en.json`, in English.
|
||||
.. code-block:: json
|
||||
|
||||
.. tip:: More examples can be found in the documentation for
|
||||
`boost locale <https://www.boost.org/doc/libs/1_70_0/libs/locale/doc/html/messages_formatting.html>`__.
|
||||
{
|
||||
"index": {
|
||||
"welcome": "Hello, Sunshine!"
|
||||
}
|
||||
}
|
||||
|
||||
.. warning:: This is for information only. Contributors should never include manually updated template files, or
|
||||
manually compiled language files in Pull Requests.
|
||||
.. note:: The json keys should be sorted alphabetically. You can use `jsonabc <https://novicelab.org/jsonabc/>`__
|
||||
to sort the keys.
|
||||
|
||||
Strings are automatically extracted from the code to the `locale/sunshine.po` template file. The generated file is
|
||||
used by CrowdIn to generate language specific template files. The file is generated using the
|
||||
`.github/workflows/localize.yml` workflow and is run on any push event into the `nightly` branch. Jobs are only run if
|
||||
any of the following paths are modified.
|
||||
.. attention:: Due to the integration with Crowdin, it is important to only add strings to the `en.json` file,
|
||||
and to not modify any other language files. After the PR is merged, the translations can take place
|
||||
on `CrowdIn <https://translate.lizardbyte.dev/>`__. Once the translations are complete, a PR will be made
|
||||
to merge the translations into Sunshine.
|
||||
|
||||
.. code-block:: yaml
|
||||
- Use the string in a Vue component.
|
||||
.. code-block:: html
|
||||
|
||||
- 'src/**'
|
||||
<template>
|
||||
<div>
|
||||
<p>{{ $t('index.welcome') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
When testing locally it may be desirable to manually extract, initialize, update, and compile strings. Python is
|
||||
required for this, along with the python dependencies in the `./scripts/requirements.txt` file. Additionally,
|
||||
`xgettext <https://www.gnu.org/software/gettext/>`__ must be installed.
|
||||
.. tip:: More formatting examples can be found in the
|
||||
`Vue I18n guide <https://kazupon.github.io/vue-i18n/guide/formatting.html>`__.
|
||||
|
||||
**Extract, initialize, and update**
|
||||
.. code-block:: bash
|
||||
.. tab:: C++
|
||||
|
||||
python ./scripts/_locale.py --extract --init --update
|
||||
There should be minimal cases where strings need to be extracted from C++ source code; however it may be necessary in
|
||||
some situations. For example the system tray icon could be localized as it is user interfacing.
|
||||
|
||||
**Compile**
|
||||
.. code-block:: bash
|
||||
- Wrap the string to be extracted in a function as shown.
|
||||
.. code-block:: cpp
|
||||
|
||||
python ./scripts/_locale.py --compile
|
||||
#include <boost/locale.hpp>
|
||||
#include <string>
|
||||
|
||||
std::string msg = boost::locale::translate("Hello world!");
|
||||
|
||||
.. tip:: More examples can be found in the documentation for
|
||||
`boost locale <https://www.boost.org/doc/libs/1_70_0/libs/locale/doc/html/messages_formatting.html>`__.
|
||||
|
||||
.. warning:: This is for information only. Contributors should never include manually updated template files, or
|
||||
manually compiled language files in Pull Requests.
|
||||
|
||||
Strings are automatically extracted from the code to the `locale/sunshine.po` template file. The generated file is
|
||||
used by CrowdIn to generate language specific template files. The file is generated using the
|
||||
`.github/workflows/localize.yml` workflow and is run on any push event into the `nightly` branch. Jobs are only run if
|
||||
any of the following paths are modified.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- 'src/**'
|
||||
|
||||
When testing locally it may be desirable to manually extract, initialize, update, and compile strings. Python is
|
||||
required for this, along with the python dependencies in the `./scripts/requirements.txt` file. Additionally,
|
||||
`xgettext <https://www.gnu.org/software/gettext/>`__ must be installed.
|
||||
|
||||
**Extract, initialize, and update**
|
||||
.. code-block:: bash
|
||||
|
||||
python ./scripts/_locale.py --extract --init --update
|
||||
|
||||
**Compile**
|
||||
.. code-block:: bash
|
||||
|
||||
python ./scripts/_locale.py --compile
|
||||
|
||||
.. attention:: Due to the integration with Crowdin, it is important to not include any extracted or compiled files in
|
||||
Pull Requests. The files are automatically generated and updated by the workflow. Once the PR is merged, the
|
||||
translations can take place on `CrowdIn <https://translate.lizardbyte.dev/>`__. Once the translations are
|
||||
complete, a PR will be made to merge the translations into Sunshine.
|
||||
|
||||
@@ -59,5 +59,81 @@ Format inplace with rstfmt
|
||||
|
||||
Unit Testing
|
||||
------------
|
||||
.. todo:: Sunshine does not currently have any unit tests. If you would like to help us improve please get in contact
|
||||
with us, or make a PR with suggested changes.
|
||||
Sunshine uses `Google Test <https://github.com/google/googletest>`__ for unit testing. Google Test is included in the
|
||||
repo as a submodule. The test sources are located in the `./tests` directory.
|
||||
|
||||
The tests need to be compiled into an executable, and then run. The tests are built using the normal build process, but
|
||||
can be disabled by setting the `BUILD_TESTS` CMake option to `OFF`.
|
||||
|
||||
To run the tests, execute the following command from the build directory:
|
||||
|
||||
.. tab:: Linux
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd tests
|
||||
./test_sunshine
|
||||
popd
|
||||
|
||||
.. tab:: macOS
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd tests
|
||||
./test_sunshine
|
||||
popd
|
||||
|
||||
.. tab:: Windows
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd tests
|
||||
test_sunshine.exe
|
||||
popd
|
||||
|
||||
To see all available options, run the tests with the `--help` option.
|
||||
|
||||
.. tab:: Linux
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd tests
|
||||
./test_sunshine --help
|
||||
popd
|
||||
|
||||
.. tab:: macOS
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd tests
|
||||
./test_sunshine --help
|
||||
popd
|
||||
|
||||
.. tab:: Windows
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pushd tests
|
||||
test_sunshine.exe --help
|
||||
popd
|
||||
|
||||
Some tests rely on Python to run. CMake will search for Python and enable the docs tests if it is found, otherwise
|
||||
cmake will fail. You can manually disable the tests by setting the `TESTS_ENABLE_PYTHON_TESTS` CMake option to
|
||||
`OFF`.
|
||||
|
||||
.. tip::
|
||||
|
||||
See the googletest `FAQ <https://google.github.io/googletest/faq.html>`__ for more information on how to use
|
||||
Google Test.
|
||||
|
||||
We use `gcovr <https://www.gcovr.com/>`__ to generate code coverage reports,
|
||||
and `Codecov <https://about.codecov.io/>`__ to analyze the reports for all PRs and commits.
|
||||
|
||||
Codecov will fail a PR if the total coverage is reduced too much, or if not enough of the diff is covered by tests.
|
||||
In some cases, the code cannot be covered when running the tests inside of GitHub runners. For example, any test that
|
||||
needs access to the GPU will not be able to run. In these cases, the coverage can be omitted by adding comments to the
|
||||
code. See the `gcovr documentation <https://gcovr.com/en/stable/guide/exclusion-markers.html#exclusion-markers>`__ for
|
||||
more information.
|
||||
|
||||
Even if your changes cannot be covered in the CI, we still encourage you to write the tests for them. This will allow
|
||||
maintainers to run the tests locally.
|
||||
|
||||
BIN
docs/source/images/discord_calls_01.png
Normal file
BIN
docs/source/images/discord_calls_01.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
docs/source/images/discord_calls_02.png
Normal file
BIN
docs/source/images/discord_calls_02.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 39 KiB |
BIN
docs/source/images/discord_calls_03.png
Normal file
BIN
docs/source/images/discord_calls_03.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
docs/source/images/discord_calls_04.png
Normal file
BIN
docs/source/images/discord_calls_04.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 94 KiB |
BIN
docs/source/images/discord_calls_05.png
Normal file
BIN
docs/source/images/discord_calls_05.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
@@ -4,12 +4,13 @@
|
||||
"dev": "vite build --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fortawesome/fontawesome-free": "6.5.1",
|
||||
"@fortawesome/fontawesome-free": "6.5.2",
|
||||
"@popperjs/core": "2.11.8",
|
||||
"@vitejs/plugin-vue": "4.6.2",
|
||||
"bootstrap": "5.3.3",
|
||||
"vite": "4.5.2",
|
||||
"vite-plugin-ejs": "1.6.4",
|
||||
"vue": "3.4.5"
|
||||
"vue": "3.4.23",
|
||||
"vue-i18n": "9.13.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ echo "
|
||||
function install() {
|
||||
# user input rules
|
||||
# shellcheck disable=SC2002
|
||||
cat "$SUNSHINE_SHARE_HERE/udev/rules.d/85-sunshine.rules" | sudo tee /etc/udev/rules.d/85-sunshine.rules
|
||||
cat "$SUNSHINE_SHARE_HERE/udev/rules.d/60-sunshine.rules" | sudo tee /etc/udev/rules.d/60-sunshine.rules
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger --property-match=DEVNAME=/dev/uinput
|
||||
|
||||
# sunshine service
|
||||
mkdir -p ~/.config/systemd/user
|
||||
@@ -56,30 +58,11 @@ function install() {
|
||||
|
||||
# setcap
|
||||
sudo setcap cap_sys_admin+p "$(readlink -f "$SUNSHINE_BIN_HERE")"
|
||||
|
||||
while true
|
||||
do
|
||||
read -r -p "This installation requires a reboot. Do you want to reboot NOW? [y/n] " input
|
||||
|
||||
case $input in
|
||||
[yY][eE][sS]|[yY])
|
||||
echo "Yes"
|
||||
sudo reboot now
|
||||
;;
|
||||
[nN][oO]|[nN])
|
||||
echo "No"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Invalid input..."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
function remove() {
|
||||
# remove input rules
|
||||
sudo rm -f /etc/udev/rules.d/85-sunshine.rules
|
||||
sudo rm -f /etc/udev/rules.d/60-sunshine.rules
|
||||
|
||||
# remove service
|
||||
sudo rm -f ~/.config/systemd/user/sunshine.service
|
||||
|
||||
@@ -7,12 +7,15 @@ pkgrel=1
|
||||
pkgdesc="@PROJECT_DESCRIPTION@"
|
||||
arch=('x86_64' 'aarch64')
|
||||
url=@PROJECT_HOMEPAGE_URL@
|
||||
license=('GPL3')
|
||||
license=('GPL-3.0-only')
|
||||
install=sunshine.install
|
||||
|
||||
depends=('avahi'
|
||||
'boost-libs'
|
||||
'curl'
|
||||
'libayatana-appindicator'
|
||||
'libcap'
|
||||
'libdrm'
|
||||
'libevdev'
|
||||
'libmfx'
|
||||
'libnotify'
|
||||
@@ -28,16 +31,21 @@ depends=('avahi'
|
||||
'numactl'
|
||||
'openssl'
|
||||
'opus'
|
||||
'python'
|
||||
'udev')
|
||||
checkdepends=('doxygen'
|
||||
'graphviz')
|
||||
makedepends=('boost'
|
||||
'cmake'
|
||||
'gcc12'
|
||||
'git'
|
||||
'make'
|
||||
'nodejs'
|
||||
'npm')
|
||||
optdepends=('cuda: NvFBC capture support'
|
||||
'libcap'
|
||||
'libdrm')
|
||||
optdepends=('cuda: Nvidia GPU encoding support'
|
||||
'libva-mesa-driver: AMD GPU encoding support'
|
||||
'intel-media-driver: Intel GPU encoding support'
|
||||
'xorg-server-xvfb: Virtual X server for headless testing')
|
||||
|
||||
provides=('sunshine')
|
||||
|
||||
@@ -54,6 +62,9 @@ build() {
|
||||
export BUILD_VERSION="@GITHUB_BUILD_VERSION@"
|
||||
export COMMIT="@GITHUB_COMMIT@"
|
||||
|
||||
export CC=gcc-12
|
||||
export CXX=g++-12
|
||||
|
||||
export CFLAGS="${CFLAGS/-Werror=format-security/}"
|
||||
export CXXFLAGS="${CXXFLAGS/-Werror=format-security/}"
|
||||
|
||||
@@ -69,6 +80,14 @@ build() {
|
||||
make -C build
|
||||
}
|
||||
|
||||
check() {
|
||||
export CC=gcc-12
|
||||
export CXX=g++-12
|
||||
|
||||
cd "${srcdir}/build/tests"
|
||||
./test_sunshine --gtest_color=yes
|
||||
}
|
||||
|
||||
package() {
|
||||
make -C build install DESTDIR="$pkgdir"
|
||||
}
|
||||
|
||||
20
packaging/linux/Arch/sunshine.install
Normal file
20
packaging/linux/Arch/sunshine.install
Normal file
@@ -0,0 +1,20 @@
|
||||
do_setcap() {
|
||||
setcap cap_sys_admin+p $(readlink -f $(which sunshine))
|
||||
}
|
||||
|
||||
do_udev_reload() {
|
||||
udevadm control --reload-rules
|
||||
udevadm trigger --property-match=DEVNAME=/dev/uinput
|
||||
modprobe uinput || true
|
||||
}
|
||||
|
||||
post_install() {
|
||||
do_setcap
|
||||
do_udev_reload
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
do_setcap
|
||||
do_udev_reload
|
||||
}
|
||||
|
||||
Submodule packaging/linux/flatpak/deps/org.flatpak.Builder.BaseApp added at 5532d4354e
1
packaging/linux/flatpak/deps/shared-modules
Submodule
1
packaging/linux/flatpak/deps/shared-modules
Submodule
Submodule packaging/linux/flatpak/deps/shared-modules added at ec91811777
@@ -11,6 +11,7 @@ separate-locales: false
|
||||
finish-args:
|
||||
- --device=all # access all devices
|
||||
- --env=PULSE_PROP_media.category=Manager # allow sunshine to manage audio sinks
|
||||
- --env=SUNSHINE_MIGRATE_CONFIG=1 # migrate config files to the new location
|
||||
- --filesystem=home # need to save files in user's home directory
|
||||
- --share=ipc # required for X11 shared memory extension
|
||||
- --share=network # access network
|
||||
@@ -33,6 +34,8 @@ build-options:
|
||||
prepend-ld-library-path: /usr/lib/sdk/vala/lib
|
||||
|
||||
modules:
|
||||
- "org.flatpak.Builder.BaseApp/xvfb.json"
|
||||
|
||||
- name: boost
|
||||
disabled: false
|
||||
buildsystem: simple
|
||||
@@ -326,6 +329,9 @@ modules:
|
||||
build-args:
|
||||
- --share=network
|
||||
env:
|
||||
BUILD_VERSION: "@BUILD_VERSION@"
|
||||
BRANCH: "@GITHUB_BRANCH@"
|
||||
COMMIT: "@GITHUB_COMMIT@"
|
||||
npm_config_nodedir: /usr/lib/sdk/node18
|
||||
NPM_CONFIG_LOGLEVEL: info
|
||||
config-opts:
|
||||
@@ -340,6 +346,7 @@ modules:
|
||||
- -DSUNSHINE_ENABLE_DRM=ON
|
||||
- -DSUNSHINE_ENABLE_CUDA=ON
|
||||
- -DSUNSHINE_BUILD_FLATPAK=ON
|
||||
- -DTESTS_ENABLE_PYTHON_TESTS=OFF
|
||||
sources:
|
||||
- type: git
|
||||
url: "@GITHUB_CLONE_URL@"
|
||||
@@ -357,3 +364,7 @@ modules:
|
||||
's%/app/bin/sunshine%flatpak run dev.lizardbyte.sunshine\nExecStop=flatpak kill dev.lizardbyte.sunshine%g'
|
||||
/app/share/sunshine/systemd/user/sunshine.service
|
||||
- install -D $FLATPAK_BUILDER_BUILDDIR/packaging/linux/flatpak/scripts/* /app/bin
|
||||
run-tests: true
|
||||
test-rule: "" # empty to disable
|
||||
test-commands:
|
||||
- xvfb-run tests/test_sunshine --gtest_color=yes
|
||||
|
||||
@@ -7,7 +7,7 @@ echo Sunshine User Service has been installed.
|
||||
echo Use [systemctl --user enable sunshine] once to autostart Sunshine on login.
|
||||
|
||||
# Udev rule
|
||||
UDEV=$(cat /app/share/sunshine/udev/rules.d/85-sunshine.rules)
|
||||
UDEV=$(cat /app/share/sunshine/udev/rules.d/60-sunshine.rules)
|
||||
echo Configuring mouse permission.
|
||||
flatpak-spawn --host pkexec sh -c "echo '$UDEV' > /etc/udev/rules.d/85-sunshine.rules"
|
||||
flatpak-spawn --host pkexec sh -c "echo '$UDEV' > /etc/udev/rules.d/60-sunshine.rules"
|
||||
echo Restart computer for mouse permission to take effect.
|
||||
|
||||
@@ -7,5 +7,5 @@ systemctl --user daemon-reload
|
||||
echo Sunshine User Service has been removed.
|
||||
|
||||
# Udev rule
|
||||
flatpak-spawn --host pkexec sh -c "rm /etc/udev/rules.d/85-sunshine.rules"
|
||||
flatpak-spawn --host pkexec sh -c "rm /etc/udev/rules.d/60-sunshine.rules"
|
||||
echo Mouse permission removed. Restart computer to take effect.
|
||||
|
||||
@@ -12,9 +12,9 @@ Actions=RunInTerminal;KMS;
|
||||
[Desktop Action RunInTerminal]
|
||||
Name=Run in Terminal
|
||||
Icon=application-x-executable
|
||||
Exec=gio launch @CMAKE_INSTALL_DATAROOTDIR@/applications/sunshine_terminal.desktop
|
||||
Exec=gio launch @CMAKE_INSTALL_FULL_DATAROOTDIR@/applications/sunshine_terminal.desktop
|
||||
|
||||
[Desktop Action KMS]
|
||||
Name=Run in Terminal (KMS)
|
||||
Icon=application-x-executable
|
||||
Exec=gio launch @CMAKE_INSTALL_DATAROOTDIR@/applications/sunshine_kms.desktop
|
||||
Exec=gio launch @CMAKE_INSTALL_FULL_DATAROOTDIR@/applications/sunshine_kms.desktop
|
||||
|
||||
@@ -12,4 +12,4 @@ Actions=RunInTerminal;
|
||||
[Desktop Action RunInTerminal]
|
||||
Name=Run in Terminal
|
||||
Icon=application-x-executable
|
||||
Exec=gio launch @CMAKE_INSTALL_DATAROOTDIR@/applications/sunshine_terminal.desktop
|
||||
Exec=gio launch @CMAKE_INSTALL_FULL_DATAROOTDIR@/applications/sunshine_terminal.desktop
|
||||
|
||||
@@ -31,13 +31,19 @@ post-fetch {
|
||||
system -W ${worksrcpath} "${git.cmd} submodule update --init --recursive"
|
||||
}
|
||||
|
||||
# https://guide.macports.org/chunked/reference.dependencies.html
|
||||
depends_build-append port:npm9 \
|
||||
port:pkgconfig
|
||||
|
||||
depends_lib port:avahi \
|
||||
port:curl \
|
||||
port:libopus \
|
||||
port:miniupnpc
|
||||
port:miniupnpc \
|
||||
port:python311 \
|
||||
port:py311-pip
|
||||
|
||||
depends_test port:doxygen \
|
||||
port:graphviz
|
||||
|
||||
boost.version 1.81
|
||||
|
||||
@@ -45,6 +51,10 @@ configure.args -DBUILD_WERROR=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=${prefix} \
|
||||
-DSUNSHINE_ASSETS_DIR=etc/sunshine/assets
|
||||
|
||||
configure.env-append BRANCH=@GITHUB_BRANCH@
|
||||
configure.env-append BUILD_VERSION=@BUILD_VERSION@
|
||||
configure.env-append COMMIT=@GITHUB_COMMIT@
|
||||
|
||||
startupitem.create yes
|
||||
startupitem.executable "${prefix}/bin/{$name}"
|
||||
startupitem.location LaunchDaemons
|
||||
@@ -62,3 +72,9 @@ notes-append "Run @PROJECT_NAME@ by executing 'sunshine <path to user config>',
|
||||
notes-append "The config file will be created if it doesn't exist."
|
||||
notes-append "It is recommended to set a location for the apps file in the config."
|
||||
notes-append "See our documentation at 'https://docs.lizardbyte.dev/projects/sunshine/en/v@PROJECT_VERSION@/' for further info."
|
||||
|
||||
test.run yes
|
||||
test.dir ${build.dir}/tests
|
||||
test.target ""
|
||||
test.cmd ./test_sunshine
|
||||
test.args --gtest_color=yes
|
||||
|
||||
69
packaging/macos/sunshine.rb
Normal file
69
packaging/macos/sunshine.rb
Normal file
@@ -0,0 +1,69 @@
|
||||
require "language/node"
|
||||
|
||||
class @PROJECT_NAME@ < Formula
|
||||
desc "@PROJECT_DESCRIPTION@"
|
||||
homepage "@PROJECT_HOMEPAGE_URL@"
|
||||
url "@GITHUB_CLONE_URL@",
|
||||
tag: "@GITHUB_BRANCH@"
|
||||
version "@PROJECT_VERSION@"
|
||||
license all_of: ["GPL-3.0-only"]
|
||||
head "@GITHUB_CLONE_URL@", branch: "@GITHUB_DEFAULT_BRANCH@"
|
||||
|
||||
depends_on "boost" => :build
|
||||
depends_on "cmake" => :build
|
||||
depends_on "node" => :build
|
||||
depends_on "pkg-config" => :build
|
||||
depends_on "curl"
|
||||
depends_on "miniupnpc"
|
||||
depends_on "openssl"
|
||||
depends_on "opus"
|
||||
|
||||
def install
|
||||
ENV["BRANCH"] = "@GITHUB_BRANCH@"
|
||||
ENV["BUILD_VERSION"] = "@BUILD_VERSION@"
|
||||
ENV["COMMIT"] = "@GITHUB_COMMIT@"
|
||||
|
||||
args = %W[
|
||||
-DBUILD_WERROR=ON
|
||||
-DCMAKE_INSTALL_PREFIX=#{prefix}
|
||||
-DOPENSSL_ROOT_DIR=#{Formula["openssl"].opt_prefix}
|
||||
-DSUNSHINE_ASSETS_DIR=sunshine/assets
|
||||
-DSUNSHINE_BUILD_HOMEBREW=ON
|
||||
-DTESTS_ENABLE_PYTHON_TESTS=OFF
|
||||
]
|
||||
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, *args
|
||||
|
||||
cd "build" do
|
||||
system "make", "-j"
|
||||
system "make", "install"
|
||||
bin.install "tests/test_sunshine"
|
||||
end
|
||||
end
|
||||
|
||||
service do
|
||||
run [opt_bin/"sunshine", "~/.config/sunshine/sunshine.conf"]
|
||||
end
|
||||
|
||||
def caveats
|
||||
<<~EOS
|
||||
Thanks for installing @PROJECT_NAME@!
|
||||
|
||||
To get started, review the documentation at:
|
||||
https://docs.lizardbyte.dev/projects/sunshine/en/latest/
|
||||
|
||||
Sunshine can only access microphones on macOS due to system limitations.
|
||||
To stream system audio use "Soundflower" or "BlackHole".
|
||||
|
||||
Gamepads are not currently supported on macOS.
|
||||
EOS
|
||||
end
|
||||
|
||||
test do
|
||||
# test that the binary runs at all
|
||||
system "#{bin}/sunshine", "--version"
|
||||
|
||||
# run the test suite
|
||||
# cannot build tests with python tests because homebrew destroys the source directory
|
||||
system "#{bin}/test_sunshine", "--gtest_color=yes"
|
||||
end
|
||||
end
|
||||
@@ -22,16 +22,20 @@ project_dir = os.path.join(root_dir, 'src')
|
||||
|
||||
year = datetime.datetime.now().year
|
||||
|
||||
# retroarcher target locales
|
||||
# target locales
|
||||
target_locales = [
|
||||
'de', # Deutsch
|
||||
'de', # German
|
||||
'en', # English
|
||||
'en_GB', # English (United Kingdom)
|
||||
'en_US', # English (United States)
|
||||
'es', # español
|
||||
'fr', # français
|
||||
'it', # italiano
|
||||
'ru', # русский
|
||||
'es', # Spanish
|
||||
'fr', # French
|
||||
'it', # Italian
|
||||
'ja', # Japanese
|
||||
'pt', # Portuguese
|
||||
'ru', # Russian
|
||||
'sv', # Swedish
|
||||
'zh', # Chinese
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
Babel==2.14.0
|
||||
clang-format
|
||||
|
||||
@@ -5,6 +5,7 @@ import subprocess
|
||||
# variables
|
||||
directories = [
|
||||
'src',
|
||||
'tests',
|
||||
'tools',
|
||||
os.path.join('third-party', 'glad'),
|
||||
os.path.join('third-party', 'nvfbc'),
|
||||
|
||||
111
src/config.cpp
111
src/config.cpp
@@ -9,6 +9,7 @@
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
@@ -85,14 +86,17 @@ namespace config {
|
||||
#define AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY 1
|
||||
#define AMF_VIDEO_ENCODER_AV1_USAGE_ULTRA_LOW_LATENCY 2
|
||||
#define AMF_VIDEO_ENCODER_AV1_USAGE_WEBCAM 3
|
||||
#define AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING 0
|
||||
#define AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY_HIGH_QUALITY 5
|
||||
#define AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING 0
|
||||
#define AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY 1
|
||||
#define AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY 2
|
||||
#define AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM 3
|
||||
#define AMF_VIDEO_ENCODER_USAGE_TRANSCONDING 0
|
||||
#define AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY 5
|
||||
#define AMF_VIDEO_ENCODER_USAGE_TRANSCODING 0
|
||||
#define AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY 1
|
||||
#define AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY 2
|
||||
#define AMF_VIDEO_ENCODER_USAGE_WEBCAM 3
|
||||
#define AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY 5
|
||||
#define AMF_VIDEO_ENCODER_UNDEFINED 0
|
||||
#define AMF_VIDEO_ENCODER_CABAC 1
|
||||
#define AMF_VIDEO_ENCODER_CALV 2
|
||||
@@ -121,43 +125,46 @@ namespace config {
|
||||
};
|
||||
|
||||
enum class rc_av1_e : int {
|
||||
cbr = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CBR,
|
||||
cqp = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP,
|
||||
vbr_latency = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
|
||||
vbr_peak = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
|
||||
cbr = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CBR
|
||||
vbr_peak = AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR
|
||||
};
|
||||
|
||||
enum class rc_hevc_e : int {
|
||||
cbr = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CBR,
|
||||
cqp = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP,
|
||||
vbr_latency = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
|
||||
vbr_peak = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
|
||||
cbr = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CBR
|
||||
vbr_peak = AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR
|
||||
};
|
||||
|
||||
enum class rc_h264_e : int {
|
||||
cbr = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR,
|
||||
cqp = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP,
|
||||
vbr_latency = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
|
||||
vbr_peak = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
|
||||
cbr = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR
|
||||
vbr_peak = AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR
|
||||
};
|
||||
|
||||
enum class usage_av1_e : int {
|
||||
transcoding = AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING,
|
||||
webcam = AMF_VIDEO_ENCODER_AV1_USAGE_WEBCAM,
|
||||
lowlatency_high_quality = AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY_HIGH_QUALITY,
|
||||
lowlatency = AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY,
|
||||
ultralowlatency = AMF_VIDEO_ENCODER_AV1_USAGE_ULTRA_LOW_LATENCY
|
||||
};
|
||||
|
||||
enum class usage_hevc_e : int {
|
||||
transcoding = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING,
|
||||
transcoding = AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING,
|
||||
webcam = AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM,
|
||||
lowlatency_high_quality = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY,
|
||||
lowlatency = AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY,
|
||||
ultralowlatency = AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY
|
||||
};
|
||||
|
||||
enum class usage_h264_e : int {
|
||||
transcoding = AMF_VIDEO_ENCODER_USAGE_TRANSCONDING,
|
||||
transcoding = AMF_VIDEO_ENCODER_USAGE_TRANSCODING,
|
||||
webcam = AMF_VIDEO_ENCODER_USAGE_WEBCAM,
|
||||
lowlatency_high_quality = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY,
|
||||
lowlatency = AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY,
|
||||
ultralowlatency = AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY
|
||||
};
|
||||
@@ -170,40 +177,41 @@ namespace config {
|
||||
|
||||
template <class T>
|
||||
std::optional<int>
|
||||
quality_from_view(const std::string_view &quality_type) {
|
||||
quality_from_view(const std::string_view &quality_type, const std::optional<int>(&original)) {
|
||||
#define _CONVERT_(x) \
|
||||
if (quality_type == #x##sv) return (int) T::x
|
||||
_CONVERT_(balanced);
|
||||
_CONVERT_(quality);
|
||||
_CONVERT_(speed);
|
||||
_CONVERT_(balanced);
|
||||
#undef _CONVERT_
|
||||
return std::nullopt;
|
||||
return original;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::optional<int>
|
||||
rc_from_view(const std::string_view &rc) {
|
||||
rc_from_view(const std::string_view &rc, const std::optional<int>(&original)) {
|
||||
#define _CONVERT_(x) \
|
||||
if (rc == #x##sv) return (int) T::x
|
||||
_CONVERT_(cbr);
|
||||
_CONVERT_(cqp);
|
||||
_CONVERT_(vbr_latency);
|
||||
_CONVERT_(vbr_peak);
|
||||
_CONVERT_(cbr);
|
||||
#undef _CONVERT_
|
||||
return std::nullopt;
|
||||
return original;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
std::optional<int>
|
||||
usage_from_view(const std::string_view &rc) {
|
||||
usage_from_view(const std::string_view &usage, const std::optional<int>(&original)) {
|
||||
#define _CONVERT_(x) \
|
||||
if (rc == #x##sv) return (int) T::x
|
||||
_CONVERT_(transcoding);
|
||||
_CONVERT_(webcam);
|
||||
if (usage == #x##sv) return (int) T::x
|
||||
_CONVERT_(lowlatency);
|
||||
_CONVERT_(lowlatency_high_quality);
|
||||
_CONVERT_(transcoding);
|
||||
_CONVERT_(ultralowlatency);
|
||||
_CONVERT_(webcam);
|
||||
#undef _CONVERT_
|
||||
return std::nullopt;
|
||||
return original;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -212,7 +220,7 @@ namespace config {
|
||||
if (coder == "cabac"sv || coder == "ac"sv) return cabac;
|
||||
if (coder == "cavlc"sv || coder == "vlc"sv) return cavlc;
|
||||
|
||||
return -1;
|
||||
return _auto;
|
||||
}
|
||||
} // namespace amd
|
||||
|
||||
@@ -343,15 +351,16 @@ namespace config {
|
||||
}, // qsv
|
||||
|
||||
{
|
||||
(int) amd::quality_h264_e::balanced, // quality (h264)
|
||||
(int) amd::quality_hevc_e::balanced, // quality (hevc)
|
||||
(int) amd::quality_av1_e::balanced, // quality (av1)
|
||||
(int) amd::rc_h264_e::vbr_latency, // rate control (h264)
|
||||
(int) amd::rc_hevc_e::vbr_latency, // rate control (hevc)
|
||||
(int) amd::rc_av1_e::vbr_latency, // rate control (av1)
|
||||
(int) amd::usage_h264_e::ultralowlatency, // usage (h264)
|
||||
(int) amd::usage_hevc_e::ultralowlatency, // usage (hevc)
|
||||
(int) amd::usage_av1_e::ultralowlatency, // usage (av1)
|
||||
(int) amd::rc_h264_e::vbr_latency, // rate control (h264)
|
||||
(int) amd::rc_hevc_e::vbr_latency, // rate control (hevc)
|
||||
(int) amd::rc_av1_e::vbr_latency, // rate control (av1)
|
||||
0, // enforce_hrd
|
||||
(int) amd::quality_h264_e::balanced, // quality (h264)
|
||||
(int) amd::quality_hevc_e::balanced, // quality (hevc)
|
||||
(int) amd::quality_av1_e::balanced, // quality (av1)
|
||||
0, // preanalysis
|
||||
1, // vbaq
|
||||
(int) amd::coder_e::_auto, // coder
|
||||
@@ -441,6 +450,7 @@ namespace config {
|
||||
};
|
||||
|
||||
sunshine_t sunshine {
|
||||
"en", // locale
|
||||
2, // min_log_level
|
||||
0, // flags
|
||||
{}, // User file
|
||||
@@ -849,6 +859,11 @@ namespace config {
|
||||
std::vector<std::string> list;
|
||||
list_string_f(vars, name, list);
|
||||
|
||||
// check if list is empty, i.e. when the value doesn't exist in the config file
|
||||
if (list.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The framerate list must be cleared before adding values from the file configuration.
|
||||
// If the list is not cleared, then the specified parameters do not affect the behavior of the sunshine server.
|
||||
// That is, if you set only 30 fps in the configuration file, it will not work because by default, during initialization the list includes 10, 30, 60, 90 and 120 fps.
|
||||
@@ -968,30 +983,31 @@ namespace config {
|
||||
std::string quality;
|
||||
string_f(vars, "amd_quality", quality);
|
||||
if (!quality.empty()) {
|
||||
video.amd.amd_quality_h264 = amd::quality_from_view<amd::quality_h264_e>(quality);
|
||||
video.amd.amd_quality_hevc = amd::quality_from_view<amd::quality_hevc_e>(quality);
|
||||
video.amd.amd_quality_av1 = amd::quality_from_view<amd::quality_av1_e>(quality);
|
||||
video.amd.amd_quality_h264 = amd::quality_from_view<amd::quality_h264_e>(quality, video.amd.amd_quality_h264);
|
||||
video.amd.amd_quality_hevc = amd::quality_from_view<amd::quality_hevc_e>(quality, video.amd.amd_quality_hevc);
|
||||
video.amd.amd_quality_av1 = amd::quality_from_view<amd::quality_av1_e>(quality, video.amd.amd_quality_av1);
|
||||
}
|
||||
|
||||
std::string rc;
|
||||
string_f(vars, "amd_rc", rc);
|
||||
int_f(vars, "amd_coder", video.amd.amd_coder, amd::coder_from_view);
|
||||
if (!rc.empty()) {
|
||||
video.amd.amd_rc_h264 = amd::rc_from_view<amd::rc_h264_e>(rc);
|
||||
video.amd.amd_rc_hevc = amd::rc_from_view<amd::rc_hevc_e>(rc);
|
||||
video.amd.amd_rc_av1 = amd::rc_from_view<amd::rc_av1_e>(rc);
|
||||
video.amd.amd_rc_h264 = amd::rc_from_view<amd::rc_h264_e>(rc, video.amd.amd_rc_h264);
|
||||
video.amd.amd_rc_hevc = amd::rc_from_view<amd::rc_hevc_e>(rc, video.amd.amd_rc_hevc);
|
||||
video.amd.amd_rc_av1 = amd::rc_from_view<amd::rc_av1_e>(rc, video.amd.amd_rc_av1);
|
||||
}
|
||||
|
||||
std::string usage;
|
||||
string_f(vars, "amd_usage", usage);
|
||||
if (!usage.empty()) {
|
||||
video.amd.amd_usage_h264 = amd::usage_from_view<amd::usage_h264_e>(rc);
|
||||
video.amd.amd_usage_hevc = amd::usage_from_view<amd::usage_hevc_e>(rc);
|
||||
video.amd.amd_usage_av1 = amd::usage_from_view<amd::usage_av1_e>(rc);
|
||||
video.amd.amd_usage_h264 = amd::usage_from_view<amd::usage_h264_e>(usage, video.amd.amd_usage_h264);
|
||||
video.amd.amd_usage_hevc = amd::usage_from_view<amd::usage_hevc_e>(usage, video.amd.amd_usage_hevc);
|
||||
video.amd.amd_usage_av1 = amd::usage_from_view<amd::usage_av1_e>(usage, video.amd.amd_usage_av1);
|
||||
}
|
||||
|
||||
bool_f(vars, "amd_preanalysis", (bool &) video.amd.amd_preanalysis);
|
||||
bool_f(vars, "amd_vbaq", (bool &) video.amd.amd_vbaq);
|
||||
bool_f(vars, "amd_enforce_hrd", (bool &) video.amd.amd_enforce_hrd);
|
||||
|
||||
int_f(vars, "vt_coder", video.vt.vt_coder, vt::coder_from_view);
|
||||
int_f(vars, "vt_software", video.vt.vt_allow_sw, vt::allow_software_from_view);
|
||||
@@ -1096,6 +1112,21 @@ namespace config {
|
||||
config::sunshine.flags[config::flag::UPNP].flip();
|
||||
}
|
||||
|
||||
string_restricted_f(vars, "locale", config::sunshine.locale, {
|
||||
"de"sv, // German
|
||||
"en"sv, // English
|
||||
"en_GB"sv, // English (UK)
|
||||
"en_US"sv, // English (US)
|
||||
"es"sv, // Spanish
|
||||
"fr"sv, // French
|
||||
"it"sv, // Italian
|
||||
"ja"sv, // Japanese
|
||||
"pt"sv, // Portuguese
|
||||
"ru"sv, // Russian
|
||||
"sv"sv, // Swedish
|
||||
"zh"sv, // Chinese
|
||||
});
|
||||
|
||||
std::string log_level_string;
|
||||
string_f(vars, "min_log_level", log_level_string);
|
||||
|
||||
@@ -1156,7 +1187,7 @@ namespace config {
|
||||
auto line = argv[x];
|
||||
|
||||
if (line == "--help"sv) {
|
||||
print_help(*argv);
|
||||
logging::print_help(*argv);
|
||||
return 1;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
@@ -1176,7 +1207,7 @@ namespace config {
|
||||
break;
|
||||
}
|
||||
if (apply_flags(line + 1)) {
|
||||
print_help(*argv);
|
||||
logging::print_help(*argv);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -1190,7 +1221,7 @@ namespace config {
|
||||
else {
|
||||
TUPLE_EL(var, 1, parse_option(line, line_end));
|
||||
if (!var) {
|
||||
print_help(*argv);
|
||||
logging::print_help(*argv);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
14
src/config.h
14
src/config.h
@@ -48,15 +48,16 @@ namespace config {
|
||||
} qsv;
|
||||
|
||||
struct {
|
||||
std::optional<int> amd_quality_h264;
|
||||
std::optional<int> amd_quality_hevc;
|
||||
std::optional<int> amd_quality_av1;
|
||||
std::optional<int> amd_rc_h264;
|
||||
std::optional<int> amd_rc_hevc;
|
||||
std::optional<int> amd_rc_av1;
|
||||
std::optional<int> amd_usage_h264;
|
||||
std::optional<int> amd_usage_hevc;
|
||||
std::optional<int> amd_usage_av1;
|
||||
std::optional<int> amd_rc_h264;
|
||||
std::optional<int> amd_rc_hevc;
|
||||
std::optional<int> amd_rc_av1;
|
||||
std::optional<int> amd_enforce_hrd;
|
||||
std::optional<int> amd_quality_h264;
|
||||
std::optional<int> amd_quality_hevc;
|
||||
std::optional<int> amd_quality_av1;
|
||||
std::optional<int> amd_preanalysis;
|
||||
std::optional<int> amd_vbaq;
|
||||
int amd_coder;
|
||||
@@ -160,6 +161,7 @@ namespace config {
|
||||
bool elevated;
|
||||
};
|
||||
struct sunshine_t {
|
||||
std::string locale;
|
||||
int min_log_level;
|
||||
std::bitset<flag::FLAG_SIZE> flags;
|
||||
std::string credentials_file;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <Simple-Web-Server/crypto.hpp>
|
||||
#include <Simple-Web-Server/server_https.hpp>
|
||||
#include <boost/asio/ssl/context_base.hpp>
|
||||
#include <jwt-cpp/jwt.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "confighttp.h"
|
||||
@@ -47,6 +48,8 @@ namespace confighttp {
|
||||
namespace fs = std::filesystem;
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
std::string jwt_key;
|
||||
|
||||
using https_server_t = SimpleWeb::Server<SimpleWeb::HTTPS>;
|
||||
|
||||
using args_t = SimpleWeb::CaseInsensitiveMultimap;
|
||||
@@ -64,7 +67,7 @@ namespace confighttp {
|
||||
BOOST_LOG(debug) << "DESTINATION :: "sv << request->path;
|
||||
|
||||
for (auto &[name, val] : request->header) {
|
||||
BOOST_LOG(debug) << name << " -- " << (name == "Authorization" ? "CREDENTIALS REDACTED" : val);
|
||||
BOOST_LOG(debug) << name << " -- " << (name == "Cookie" || name == "Authorization" ? "SENSIBLE HEADER REDACTED" : val);
|
||||
}
|
||||
|
||||
BOOST_LOG(debug) << " [--] "sv;
|
||||
@@ -80,9 +83,7 @@ namespace confighttp {
|
||||
send_unauthorized(resp_https_t response, req_https_t request) {
|
||||
auto address = net::addr_to_normalized_string(request->remote_endpoint().address());
|
||||
BOOST_LOG(info) << "Web UI: ["sv << address << "] -- not authorized"sv;
|
||||
const SimpleWeb::CaseInsensitiveMultimap headers {
|
||||
{ "WWW-Authenticate", R"(Basic realm="Sunshine Gamestream Host", charset="UTF-8")" }
|
||||
};
|
||||
const SimpleWeb::CaseInsensitiveMultimap headers {};
|
||||
response->write(SimpleWeb::StatusCode::client_error_unauthorized, headers);
|
||||
}
|
||||
|
||||
@@ -114,29 +115,46 @@ namespace confighttp {
|
||||
}
|
||||
|
||||
auto fg = util::fail_guard([&]() {
|
||||
send_unauthorized(response, request);
|
||||
BOOST_LOG(info) << request->path;
|
||||
std::string apiPrefix = "/api";
|
||||
if (request->path.compare(0, apiPrefix.length(), apiPrefix) == 0) {
|
||||
send_unauthorized(response, request);
|
||||
}
|
||||
// Redirect to login, but only once
|
||||
else if (request->path.compare("/login") != 0) {
|
||||
send_redirect(response, request, "/login");
|
||||
}
|
||||
});
|
||||
|
||||
auto auth = request->header.find("authorization");
|
||||
auto auth = request->header.find("cookie");
|
||||
if (auth == request->header.end()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto &rawAuth = auth->second;
|
||||
auto authData = SimpleWeb::Crypto::Base64::decode(rawAuth.substr("Basic "sv.length()));
|
||||
std::istringstream iss(rawAuth);
|
||||
std::string token, cookie_name = "sunshine_session=", cookie_value = "";
|
||||
|
||||
int index = authData.find(':');
|
||||
if (index >= authData.size() - 1) {
|
||||
return false;
|
||||
while (std::getline(iss, token, ';')) {
|
||||
// Left Trim Cookie
|
||||
token.erase(token.begin(), std::find_if(token.begin(), token.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
// Compare that the cookie name is sunshine_session
|
||||
if (token.compare(0, cookie_name.length(), cookie_name) == 0) {
|
||||
cookie_value = token.substr(cookie_name.length());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto username = authData.substr(0, index);
|
||||
auto password = authData.substr(index + 1);
|
||||
auto hash = util::hex(crypto::hash(password + config::sunshine.salt)).to_string();
|
||||
if (cookie_value.length() == 0) return false;
|
||||
auto decoded = jwt::decode(cookie_value);
|
||||
auto verifier = jwt::verify()
|
||||
.with_issuer("sunshine-" + http::unique_id)
|
||||
.with_claim("sub", jwt::claim(std::string(config::sunshine.username)))
|
||||
.allow_algorithm(jwt::algorithm::hs256 { jwt_key });
|
||||
|
||||
if (!boost::iequals(username, config::sunshine.username) || hash != config::sunshine.password) {
|
||||
return false;
|
||||
}
|
||||
verifier.verify(decoded);
|
||||
|
||||
fg.disable();
|
||||
return true;
|
||||
@@ -181,6 +199,16 @@ namespace confighttp {
|
||||
response->write(content, headers);
|
||||
}
|
||||
|
||||
void
|
||||
getLoginPage(resp_https_t response, req_https_t request) {
|
||||
print_req(request);
|
||||
|
||||
std::string content = file_handler::read_file(WEB_DIR "login.html");
|
||||
SimpleWeb::CaseInsensitiveMultimap headers;
|
||||
headers.emplace("Content-Type", "text/html; charset=utf-8");
|
||||
response->write(content, headers);
|
||||
}
|
||||
|
||||
void
|
||||
getAppsPage(resp_https_t response, req_https_t request) {
|
||||
if (!authenticate(response, request)) return;
|
||||
@@ -550,6 +578,24 @@ namespace confighttp {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
getLocale(resp_https_t response, req_https_t request) {
|
||||
// we need to return the locale whether authenticated or not
|
||||
|
||||
print_req(request);
|
||||
|
||||
pt::ptree outputTree;
|
||||
auto g = util::fail_guard([&]() {
|
||||
std::ostringstream data;
|
||||
|
||||
pt::write_json(data, outputTree);
|
||||
response->write(data.str());
|
||||
});
|
||||
|
||||
outputTree.put("status", "true");
|
||||
outputTree.put("locale", config::sunshine.locale);
|
||||
}
|
||||
|
||||
void
|
||||
saveConfig(resp_https_t response, req_https_t request) {
|
||||
if (!authenticate(response, request)) return;
|
||||
@@ -637,6 +683,8 @@ namespace confighttp {
|
||||
else {
|
||||
http::save_user_creds(config::sunshine.credentials_file, newUsername, newPassword);
|
||||
http::reload_user_creds(config::sunshine.credentials_file);
|
||||
// Regen the JWT Key to invalidate sessions
|
||||
jwt_key = crypto::rand_alphabet(64);
|
||||
outputTree.put("status", true);
|
||||
}
|
||||
}
|
||||
@@ -720,16 +768,112 @@ namespace confighttp {
|
||||
outputTree.put("status", true);
|
||||
}
|
||||
|
||||
void
|
||||
login(resp_https_t response, req_https_t request) {
|
||||
auto address = net::addr_to_normalized_string(request->remote_endpoint().address());
|
||||
auto ip_type = net::from_address(address);
|
||||
|
||||
if (ip_type > http::origin_web_ui_allowed) {
|
||||
BOOST_LOG(info) << "Web UI: ["sv << address << "] -- denied"sv;
|
||||
response->write(SimpleWeb::StatusCode::client_error_forbidden);
|
||||
return;
|
||||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << request->content.rdbuf();
|
||||
|
||||
pt::ptree inputTree, outputTree;
|
||||
auto g = util::fail_guard([&]() {
|
||||
std::ostringstream data;
|
||||
|
||||
pt::write_json(data, outputTree);
|
||||
response->write(data.str());
|
||||
});
|
||||
|
||||
try {
|
||||
// TODO: Input Validation
|
||||
pt::read_json(ss, inputTree);
|
||||
auto username = inputTree.get<std::string>("username");
|
||||
auto password = inputTree.get<std::string>("password");
|
||||
auto hash = util::hex(crypto::hash(password + config::sunshine.salt)).to_string();
|
||||
|
||||
if (!boost::iequals(username, config::sunshine.username) || hash != config::sunshine.password) {
|
||||
outputTree.put("status", "false");
|
||||
return;
|
||||
}
|
||||
outputTree.put("status", "true");
|
||||
auto token = jwt::create().set_type("JWT").set_issued_at(std::chrono::system_clock::now()).set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds { 3600 }).set_issuer("sunshine-" + http::unique_id).set_payload_claim("sub", jwt::claim(std::string(config::sunshine.username))).sign(jwt::algorithm::hs256 { jwt_key });
|
||||
std::stringstream cookie_stream;
|
||||
cookie_stream << "sunshine_session=";
|
||||
cookie_stream << token;
|
||||
cookie_stream << "; Secure; HttpOnly; SameSite=Strict; Path=/";
|
||||
const SimpleWeb::CaseInsensitiveMultimap headers {
|
||||
{ "Set-Cookie", cookie_stream.str() }
|
||||
};
|
||||
std::ostringstream data;
|
||||
pt::write_json(data, outputTree);
|
||||
response->write(SimpleWeb::StatusCode::success_ok, data.str(), headers);
|
||||
g.disable();
|
||||
return;
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
BOOST_LOG(warning) << "SaveApp: "sv << e.what();
|
||||
|
||||
outputTree.put("status", "false");
|
||||
outputTree.put("error", "Invalid Input JSON");
|
||||
return;
|
||||
}
|
||||
|
||||
outputTree.put("status", "true");
|
||||
}
|
||||
|
||||
void
|
||||
logout(resp_https_t response, req_https_t request) {
|
||||
pt::ptree outputTree;
|
||||
try {
|
||||
if (!authenticate(response, request)) return;
|
||||
|
||||
print_req(request);
|
||||
|
||||
auto g = util::fail_guard([&]() {
|
||||
std::ostringstream data;
|
||||
pt::write_json(data, outputTree);
|
||||
response->write(data.str());
|
||||
});
|
||||
|
||||
const SimpleWeb::CaseInsensitiveMultimap headers {
|
||||
{ "Set-Cookie", "sunshine_session=redacted; expires=Thu, 01 Jan 1970 00:00:00 GMT; Secure; HttpOnly; SameSite=Strict; Path=/" }
|
||||
};
|
||||
std::ostringstream data;
|
||||
outputTree.put("status", true);
|
||||
pt::write_json(data, outputTree);
|
||||
|
||||
response->write(SimpleWeb::StatusCode::success_ok, data.str(), headers);
|
||||
g.disable();
|
||||
}
|
||||
catch (std::exception &e) {
|
||||
BOOST_LOG(warning) << "SaveApp: "sv << e.what();
|
||||
|
||||
outputTree.put("status", "false");
|
||||
outputTree.put("error", "Invalid Input JSON");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
start() {
|
||||
auto shutdown_event = mail::man->event<bool>(mail::shutdown);
|
||||
|
||||
// On each server start, create a randomized jwt_key
|
||||
jwt_key = crypto::rand_alphabet(64);
|
||||
|
||||
auto port_https = net::map_port(PORT_HTTPS);
|
||||
auto address_family = net::af_from_enum_string(config::sunshine.address_family);
|
||||
|
||||
https_server_t server { config::nvhttp.cert, config::nvhttp.pkey };
|
||||
server.default_resource["GET"] = not_found;
|
||||
server.resource["^/$"]["GET"] = getIndexPage;
|
||||
server.resource["^/login/?$"]["GET"] = getLoginPage;
|
||||
server.resource["^/pin/?$"]["GET"] = getPinPage;
|
||||
server.resource["^/apps/?$"]["GET"] = getAppsPage;
|
||||
server.resource["^/clients/?$"]["GET"] = getClientsPage;
|
||||
@@ -743,12 +887,15 @@ namespace confighttp {
|
||||
server.resource["^/api/apps$"]["POST"] = saveApp;
|
||||
server.resource["^/api/config$"]["GET"] = getConfig;
|
||||
server.resource["^/api/config$"]["POST"] = saveConfig;
|
||||
server.resource["^/api/configLocale$"]["GET"] = getLocale;
|
||||
server.resource["^/api/restart$"]["POST"] = restart;
|
||||
server.resource["^/api/password$"]["POST"] = savePassword;
|
||||
server.resource["^/api/apps/([0-9]+)$"]["DELETE"] = deleteApp;
|
||||
server.resource["^/api/clients/unpair$"]["POST"] = unpairAll;
|
||||
server.resource["^/api/apps/close$"]["POST"] = closeApp;
|
||||
server.resource["^/api/covers/upload$"]["POST"] = uploadCover;
|
||||
server.resource["^/api/logout$"]["POST"] = logout;
|
||||
server.resource["^/api/login$"]["POST"] = login;
|
||||
server.resource["^/images/sunshine.ico$"]["GET"] = getFaviconImage;
|
||||
server.resource["^/images/logo-sunshine-45.png$"]["GET"] = getSunshineLogoImage;
|
||||
server.resource["^/assets\\/.+$"]["GET"] = getNodeModules;
|
||||
|
||||
@@ -17,6 +17,10 @@ namespace crypto {
|
||||
X509_STORE_add_cert(x509_store.get(), cert.get());
|
||||
_certs.emplace_back(std::make_pair(std::move(cert), std::move(x509_store)));
|
||||
}
|
||||
void
|
||||
cert_chain_t::clear() {
|
||||
_certs.clear();
|
||||
}
|
||||
|
||||
static int
|
||||
openssl_verify_cb(int ok, X509_STORE_CTX *ctx) {
|
||||
|
||||
@@ -73,6 +73,9 @@ namespace crypto {
|
||||
void
|
||||
add(x509_t &&cert);
|
||||
|
||||
void
|
||||
clear();
|
||||
|
||||
const char *
|
||||
verify(x509_t::element_type *cert);
|
||||
|
||||
|
||||
@@ -87,12 +87,12 @@ namespace args {
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* print_help("sunshine", 0, nullptr);
|
||||
* help("sunshine", 0, nullptr);
|
||||
* ```
|
||||
*/
|
||||
int
|
||||
help(const char *name, int argc, char *argv[]) {
|
||||
print_help(name);
|
||||
logging::print_help(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace args {
|
||||
*/
|
||||
int
|
||||
version(const char *name, int argc, char *argv[]) {
|
||||
std::cout << PROJECT_NAME << " version: v" << PROJECT_VER << std::endl;
|
||||
// version was already logged at startup
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "process.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
|
||||
@@ -469,15 +469,19 @@ namespace input {
|
||||
* @param input The input context.
|
||||
* @param val The cartesian coordinate pair to convert.
|
||||
* @param size The size of the client's surface containing the value.
|
||||
* @return The host-relative coordinate pair.
|
||||
* @return The host-relative coordinate pair if a touchport is available.
|
||||
*/
|
||||
std::pair<float, float>
|
||||
std::optional<std::pair<float, float>>
|
||||
client_to_touchport(std::shared_ptr<input_t> &input, const std::pair<float, float> &val, const std::pair<float, float> &size) {
|
||||
auto &touch_port_event = input->touch_port_event;
|
||||
auto &touch_port = input->touch_port;
|
||||
if (touch_port_event->peek()) {
|
||||
touch_port = *touch_port_event->pop();
|
||||
}
|
||||
if (!touch_port) {
|
||||
BOOST_LOG(verbose) << "Ignoring early absolute input without a touch port"sv;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto scalarX = touch_port.width / size.first;
|
||||
auto scalarY = touch_port.height / size.second;
|
||||
@@ -491,7 +495,7 @@ namespace input {
|
||||
x = std::clamp(x, offsetX, (size.first * scalarX) - offsetX);
|
||||
y = std::clamp(y, offsetY, (size.second * scalarY) - offsetY);
|
||||
|
||||
return { (x - offsetX) * touch_port.scalar_inv, (y - offsetY) * touch_port.scalar_inv };
|
||||
return std::pair { (x - offsetX) * touch_port.scalar_inv, (y - offsetY) * touch_port.scalar_inv };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -561,6 +565,9 @@ namespace input {
|
||||
auto height = (float) util::endian::big(packet->height);
|
||||
|
||||
auto tpcoords = client_to_touchport(input, { x, y }, { width, height });
|
||||
if (!tpcoords) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &touch_port = input->touch_port;
|
||||
platf::touch_port_t abs_port {
|
||||
@@ -568,7 +575,7 @@ namespace input {
|
||||
touch_port.env_width, touch_port.env_height
|
||||
};
|
||||
|
||||
platf::abs_mouse(platf_input, abs_port, tpcoords.first, tpcoords.second);
|
||||
platf::abs_mouse(platf_input, abs_port, tpcoords->first, tpcoords->second);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -918,6 +925,9 @@ namespace input {
|
||||
{ from_clamped_netfloat(packet->x, 0.0f, 1.0f) * 65535.f,
|
||||
from_clamped_netfloat(packet->y, 0.0f, 1.0f) * 65535.f },
|
||||
{ 65535.f, 65535.f });
|
||||
if (!coords) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &touch_port = input->touch_port;
|
||||
platf::touch_port_t abs_port {
|
||||
@@ -926,8 +936,8 @@ namespace input {
|
||||
};
|
||||
|
||||
// Renormalize the coordinates
|
||||
coords.first /= abs_port.width;
|
||||
coords.second /= abs_port.height;
|
||||
coords->first /= abs_port.width;
|
||||
coords->second /= abs_port.height;
|
||||
|
||||
// Normalize rotation value to 0-359 degree range
|
||||
auto rotation = util::endian::little(packet->rotation);
|
||||
@@ -946,8 +956,8 @@ namespace input {
|
||||
packet->eventType,
|
||||
rotation,
|
||||
util::endian::little(packet->pointerId),
|
||||
coords.first,
|
||||
coords.second,
|
||||
coords->first,
|
||||
coords->second,
|
||||
from_clamped_netfloat(packet->pressureOrDistance, 0.0f, 1.0f),
|
||||
contact_area.first,
|
||||
contact_area.second,
|
||||
@@ -972,6 +982,9 @@ namespace input {
|
||||
{ from_clamped_netfloat(packet->x, 0.0f, 1.0f) * 65535.f,
|
||||
from_clamped_netfloat(packet->y, 0.0f, 1.0f) * 65535.f },
|
||||
{ 65535.f, 65535.f });
|
||||
if (!coords) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto &touch_port = input->touch_port;
|
||||
platf::touch_port_t abs_port {
|
||||
@@ -980,8 +993,8 @@ namespace input {
|
||||
};
|
||||
|
||||
// Renormalize the coordinates
|
||||
coords.first /= abs_port.width;
|
||||
coords.second /= abs_port.height;
|
||||
coords->first /= abs_port.width;
|
||||
coords->second /= abs_port.height;
|
||||
|
||||
// Normalize rotation value to 0-359 degree range
|
||||
auto rotation = util::endian::little(packet->rotation);
|
||||
@@ -1002,8 +1015,8 @@ namespace input {
|
||||
packet->penButtons,
|
||||
packet->tilt,
|
||||
rotation,
|
||||
coords.first,
|
||||
coords.second,
|
||||
coords->first,
|
||||
coords->second,
|
||||
from_clamped_netfloat(packet->pressureOrDistance, 0.0f, 1.0f),
|
||||
contact_area.first,
|
||||
contact_area.second,
|
||||
|
||||
@@ -32,6 +32,11 @@ namespace input {
|
||||
float client_offsetX, client_offsetY;
|
||||
|
||||
float scalar_inv;
|
||||
|
||||
explicit
|
||||
operator bool() const {
|
||||
return width != 0 && height != 0 && env_width != 0 && env_height != 0;
|
||||
}
|
||||
};
|
||||
|
||||
std::pair<float, float>
|
||||
|
||||
225
src/logging.cpp
225
src/logging.cpp
@@ -4,9 +4,11 @@
|
||||
*/
|
||||
|
||||
// standard includes
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
// lib includes
|
||||
#include <boost/core/null_deleter.hpp>
|
||||
#include <boost/log/attributes/clock.hpp>
|
||||
#include <boost/log/common.hpp>
|
||||
#include <boost/log/expressions.hpp>
|
||||
@@ -16,6 +18,10 @@
|
||||
// local includes
|
||||
#include "logging.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/log.h>
|
||||
}
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
namespace bl = boost::log;
|
||||
@@ -29,45 +35,182 @@ bl::sources::severity_logger<int> warning(3); // Strange events
|
||||
bl::sources::severity_logger<int> error(4); // Recoverable errors
|
||||
bl::sources::severity_logger<int> fatal(5); // Unrecoverable errors
|
||||
|
||||
/**
|
||||
* @brief Flush the log.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* log_flush();
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
log_flush() {
|
||||
sink->flush();
|
||||
}
|
||||
BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", int)
|
||||
|
||||
/**
|
||||
* @brief Print help to stdout.
|
||||
* @param name The name of the program.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* print_help("sunshine");
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
print_help(const char *name) {
|
||||
std::cout
|
||||
<< "Usage: "sv << name << " [options] [/path/to/configuration_file] [--cmd]"sv << std::endl
|
||||
<< " Any configurable option can be overwritten with: \"name=value\""sv << std::endl
|
||||
<< std::endl
|
||||
<< " Note: The configuration will be created if it doesn't exist."sv << std::endl
|
||||
<< std::endl
|
||||
<< " --help | print help"sv << std::endl
|
||||
<< " --creds username password | set user credentials for the Web manager"sv << std::endl
|
||||
<< " --version | print the version of sunshine"sv << std::endl
|
||||
<< std::endl
|
||||
<< " flags"sv << std::endl
|
||||
<< " -0 | Read PIN from stdin"sv << std::endl
|
||||
<< " -1 | Do not load previously saved state and do retain any state after shutdown"sv << std::endl
|
||||
<< " | Effectively starting as if for the first time without overwriting any pairings with your devices"sv << std::endl
|
||||
<< " -2 | Force replacement of headers in video stream"sv << std::endl
|
||||
<< " -p | Enable/Disable UPnP"sv << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
namespace logging {
|
||||
/**
|
||||
* @brief A destructor that restores the initial state.
|
||||
*/
|
||||
deinit_t::~deinit_t() {
|
||||
deinit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deinitialize the logging system.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* deinit();
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
deinit() {
|
||||
log_flush();
|
||||
bl::core::get()->remove_sink(sink);
|
||||
sink.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the logging system.
|
||||
* @param min_log_level The minimum log level to output.
|
||||
* @param log_file The log file to write to.
|
||||
* @returns A deinit_t object that will deinitialize the logging system when it goes out of scope.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* log_init(2, "sunshine.log");
|
||||
* ```
|
||||
*/
|
||||
[[nodiscard]] std::unique_ptr<deinit_t>
|
||||
init(int min_log_level, const std::string &log_file) {
|
||||
if (sink) {
|
||||
// Deinitialize the logging system before reinitializing it. This can probably only ever be hit in tests.
|
||||
deinit();
|
||||
}
|
||||
|
||||
setup_av_logging(min_log_level);
|
||||
|
||||
sink = boost::make_shared<text_sink>();
|
||||
|
||||
boost::shared_ptr<std::ostream> stream { &std::cout, boost::null_deleter() };
|
||||
sink->locked_backend()->add_stream(stream);
|
||||
sink->locked_backend()->add_stream(boost::make_shared<std::ofstream>(log_file));
|
||||
sink->set_filter(severity >= min_log_level);
|
||||
|
||||
sink->set_formatter([](const bl::record_view &view, bl::formatting_ostream &os) {
|
||||
constexpr const char *message = "Message";
|
||||
constexpr const char *severity = "Severity";
|
||||
constexpr int DATE_BUFFER_SIZE = 21 + 2 + 1; // Full string plus ": \0"
|
||||
|
||||
auto log_level = view.attribute_values()[severity].extract<int>().get();
|
||||
|
||||
std::string_view log_type;
|
||||
switch (log_level) {
|
||||
case 0:
|
||||
log_type = "Verbose: "sv;
|
||||
break;
|
||||
case 1:
|
||||
log_type = "Debug: "sv;
|
||||
break;
|
||||
case 2:
|
||||
log_type = "Info: "sv;
|
||||
break;
|
||||
case 3:
|
||||
log_type = "Warning: "sv;
|
||||
break;
|
||||
case 4:
|
||||
log_type = "Error: "sv;
|
||||
break;
|
||||
case 5:
|
||||
log_type = "Fatal: "sv;
|
||||
break;
|
||||
};
|
||||
|
||||
char _date[DATE_BUFFER_SIZE];
|
||||
std::time_t t = std::time(nullptr);
|
||||
strftime(_date, DATE_BUFFER_SIZE, "[%Y:%m:%d:%H:%M:%S]: ", std::localtime(&t));
|
||||
|
||||
os << _date << log_type << view.attribute_values()[message].extract<std::string>();
|
||||
});
|
||||
|
||||
// Flush after each log record to ensure log file contents on disk isn't stale.
|
||||
// This is particularly important when running from a Windows service.
|
||||
sink->locked_backend()->auto_flush(true);
|
||||
|
||||
bl::core::get()->add_sink(sink);
|
||||
return std::make_unique<deinit_t>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Setup AV logging.
|
||||
* @param min_log_level The log level.
|
||||
*/
|
||||
void
|
||||
setup_av_logging(int min_log_level) {
|
||||
if (min_log_level >= 1) {
|
||||
av_log_set_level(AV_LOG_QUIET);
|
||||
}
|
||||
else {
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
}
|
||||
av_log_set_callback([](void *ptr, int level, const char *fmt, va_list vl) {
|
||||
static int print_prefix = 1;
|
||||
char buffer[1024];
|
||||
|
||||
av_log_format_line(ptr, level, fmt, vl, buffer, sizeof(buffer), &print_prefix);
|
||||
if (level <= AV_LOG_ERROR) {
|
||||
// We print AV_LOG_FATAL at the error level. FFmpeg prints things as fatal that
|
||||
// are expected in some cases, such as lack of codec support or similar things.
|
||||
BOOST_LOG(error) << buffer;
|
||||
}
|
||||
else if (level <= AV_LOG_WARNING) {
|
||||
BOOST_LOG(warning) << buffer;
|
||||
}
|
||||
else if (level <= AV_LOG_INFO) {
|
||||
BOOST_LOG(info) << buffer;
|
||||
}
|
||||
else if (level <= AV_LOG_VERBOSE) {
|
||||
// AV_LOG_VERBOSE is less verbose than AV_LOG_DEBUG
|
||||
BOOST_LOG(debug) << buffer;
|
||||
}
|
||||
else {
|
||||
BOOST_LOG(verbose) << buffer;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Flush the log.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* log_flush();
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
log_flush() {
|
||||
if (sink) {
|
||||
sink->flush();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Print help to stdout.
|
||||
* @param name The name of the program.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* print_help("sunshine");
|
||||
* ```
|
||||
*/
|
||||
void
|
||||
print_help(const char *name) {
|
||||
std::cout
|
||||
<< "Usage: "sv << name << " [options] [/path/to/configuration_file] [--cmd]"sv << std::endl
|
||||
<< " Any configurable option can be overwritten with: \"name=value\""sv << std::endl
|
||||
<< std::endl
|
||||
<< " Note: The configuration will be created if it doesn't exist."sv << std::endl
|
||||
<< std::endl
|
||||
<< " --help | print help"sv << std::endl
|
||||
<< " --creds username password | set user credentials for the Web manager"sv << std::endl
|
||||
<< " --version | print the version of sunshine"sv << std::endl
|
||||
<< std::endl
|
||||
<< " flags"sv << std::endl
|
||||
<< " -0 | Read PIN from stdin"sv << std::endl
|
||||
<< " -1 | Do not load previously saved state and do retain any state after shutdown"sv << std::endl
|
||||
<< " | Effectively starting as if for the first time without overwriting any pairings with your devices"sv << std::endl
|
||||
<< " -2 | Force replacement of headers in video stream"sv << std::endl
|
||||
<< " -p | Enable/Disable UPnP"sv << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
} // namespace logging
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <boost/log/common.hpp>
|
||||
#include <boost/log/sinks.hpp>
|
||||
|
||||
extern boost::shared_ptr<boost::log::sinks::asynchronous_sink<boost::log::sinks::text_ostream_backend>> sink;
|
||||
using text_sink = boost::log::sinks::asynchronous_sink<boost::log::sinks::text_ostream_backend>;
|
||||
|
||||
extern boost::log::sources::severity_logger<int> verbose;
|
||||
@@ -20,8 +19,20 @@ extern boost::log::sources::severity_logger<int> warning;
|
||||
extern boost::log::sources::severity_logger<int> error;
|
||||
extern boost::log::sources::severity_logger<int> fatal;
|
||||
|
||||
// functions
|
||||
void
|
||||
log_flush();
|
||||
void
|
||||
print_help(const char *name);
|
||||
namespace logging {
|
||||
class deinit_t {
|
||||
public:
|
||||
~deinit_t();
|
||||
};
|
||||
|
||||
void
|
||||
deinit();
|
||||
[[nodiscard]] std::unique_ptr<deinit_t>
|
||||
init(int min_log_level, const std::string &log_file);
|
||||
void
|
||||
setup_av_logging(int min_log_level);
|
||||
void
|
||||
log_flush();
|
||||
void
|
||||
print_help(const char *name);
|
||||
} // namespace logging
|
||||
|
||||
106
src/main.cpp
106
src/main.cpp
@@ -4,13 +4,11 @@
|
||||
*/
|
||||
|
||||
// standard includes
|
||||
#include <codecvt>
|
||||
#include <csignal>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
// lib includes
|
||||
#include <boost/log/expressions.hpp>
|
||||
|
||||
// local includes
|
||||
#include "confighttp.h"
|
||||
#include "entry_handler.h"
|
||||
@@ -26,19 +24,10 @@
|
||||
#include "video.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/log.h>
|
||||
#include <rs.h>
|
||||
}
|
||||
|
||||
using namespace std::literals;
|
||||
namespace bl = boost::log;
|
||||
|
||||
struct NoDelete {
|
||||
void
|
||||
operator()(void *) {}
|
||||
};
|
||||
|
||||
BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", int)
|
||||
|
||||
std::map<int, std::function<void()>> signal_handlers;
|
||||
void
|
||||
@@ -106,8 +95,11 @@ main(int argc, char *argv[]) {
|
||||
setlocale(LC_ALL, ".UTF-8");
|
||||
#endif
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
// Use UTF-8 conversion for the default C++ locale (used by boost::log)
|
||||
std::locale::global(std::locale(std::locale(), new std::codecvt_utf8<wchar_t>));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
mail::man = std::make_shared<safe::mail_raw_t>();
|
||||
|
||||
@@ -115,84 +107,10 @@ main(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (config::sunshine.min_log_level >= 1) {
|
||||
av_log_set_level(AV_LOG_QUIET);
|
||||
auto log_deinit_guard = logging::init(config::sunshine.min_log_level, config::sunshine.log_file);
|
||||
if (!log_deinit_guard) {
|
||||
BOOST_LOG(error) << "Logging failed to initialize"sv;
|
||||
}
|
||||
else {
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
}
|
||||
av_log_set_callback([](void *ptr, int level, const char *fmt, va_list vl) {
|
||||
static int print_prefix = 1;
|
||||
char buffer[1024];
|
||||
|
||||
av_log_format_line(ptr, level, fmt, vl, buffer, sizeof(buffer), &print_prefix);
|
||||
if (level <= AV_LOG_ERROR) {
|
||||
// We print AV_LOG_FATAL at the error level. FFmpeg prints things as fatal that
|
||||
// are expected in some cases, such as lack of codec support or similar things.
|
||||
BOOST_LOG(error) << buffer;
|
||||
}
|
||||
else if (level <= AV_LOG_WARNING) {
|
||||
BOOST_LOG(warning) << buffer;
|
||||
}
|
||||
else if (level <= AV_LOG_INFO) {
|
||||
BOOST_LOG(info) << buffer;
|
||||
}
|
||||
else if (level <= AV_LOG_VERBOSE) {
|
||||
// AV_LOG_VERBOSE is less verbose than AV_LOG_DEBUG
|
||||
BOOST_LOG(debug) << buffer;
|
||||
}
|
||||
else {
|
||||
BOOST_LOG(verbose) << buffer;
|
||||
}
|
||||
});
|
||||
|
||||
sink = boost::make_shared<text_sink>();
|
||||
|
||||
boost::shared_ptr<std::ostream> stream { &std::cout, NoDelete {} };
|
||||
sink->locked_backend()->add_stream(stream);
|
||||
sink->locked_backend()->add_stream(boost::make_shared<std::ofstream>(config::sunshine.log_file));
|
||||
sink->set_filter(severity >= config::sunshine.min_log_level);
|
||||
|
||||
sink->set_formatter([message = "Message"s, severity = "Severity"s](const bl::record_view &view, bl::formatting_ostream &os) {
|
||||
constexpr int DATE_BUFFER_SIZE = 21 + 2 + 1; // Full string plus ": \0"
|
||||
|
||||
auto log_level = view.attribute_values()[severity].extract<int>().get();
|
||||
|
||||
std::string_view log_type;
|
||||
switch (log_level) {
|
||||
case 0:
|
||||
log_type = "Verbose: "sv;
|
||||
break;
|
||||
case 1:
|
||||
log_type = "Debug: "sv;
|
||||
break;
|
||||
case 2:
|
||||
log_type = "Info: "sv;
|
||||
break;
|
||||
case 3:
|
||||
log_type = "Warning: "sv;
|
||||
break;
|
||||
case 4:
|
||||
log_type = "Error: "sv;
|
||||
break;
|
||||
case 5:
|
||||
log_type = "Fatal: "sv;
|
||||
break;
|
||||
};
|
||||
|
||||
char _date[DATE_BUFFER_SIZE];
|
||||
std::time_t t = std::time(nullptr);
|
||||
strftime(_date, DATE_BUFFER_SIZE, "[%Y:%m:%d:%H:%M:%S]: ", std::localtime(&t));
|
||||
|
||||
os << _date << log_type << view.attribute_values()[message].extract<std::string>();
|
||||
});
|
||||
|
||||
// Flush after each log record to ensure log file contents on disk isn't stale.
|
||||
// This is particularly important when running from a Windows service.
|
||||
sink->locked_backend()->auto_flush(true);
|
||||
|
||||
bl::core::get()->add_sink(sink);
|
||||
auto fg = util::fail_guard(log_flush);
|
||||
|
||||
// logging can begin at this point
|
||||
// if anything is logged prior to this point, it will appear in stdout, but not in the log viewer in the UI
|
||||
@@ -224,7 +142,7 @@ main(int argc, char *argv[]) {
|
||||
nvprefs_instance.modify_application_profile();
|
||||
// Modify global settings, undo file is produced in the process to restore after improper termination
|
||||
nvprefs_instance.modify_global_profile();
|
||||
// Unload dynamic library to survive driver reinstallation
|
||||
// Unload dynamic library to survive driver re-installation
|
||||
nvprefs_instance.unload();
|
||||
}
|
||||
|
||||
@@ -317,7 +235,7 @@ main(int argc, char *argv[]) {
|
||||
|
||||
auto task = []() {
|
||||
BOOST_LOG(fatal) << "10 seconds passed, yet Sunshine's still running: Forcing shutdown"sv;
|
||||
log_flush();
|
||||
logging::log_flush();
|
||||
lifetime::debug_trap();
|
||||
};
|
||||
force_shutdown = task_pool.pushDelayed(task, 10s).task_id;
|
||||
@@ -330,7 +248,7 @@ main(int argc, char *argv[]) {
|
||||
|
||||
auto task = []() {
|
||||
BOOST_LOG(fatal) << "10 seconds passed, yet Sunshine's still running: Forcing shutdown"sv;
|
||||
log_flush();
|
||||
logging::log_flush();
|
||||
lifetime::debug_trap();
|
||||
};
|
||||
force_shutdown = task_pool.pushDelayed(task, 10s).task_id;
|
||||
@@ -343,8 +261,8 @@ main(int argc, char *argv[]) {
|
||||
// If any of the following fail, we log an error and continue event though sunshine will not function correctly.
|
||||
// This allows access to the UI to fix configuration problems or view the logs.
|
||||
|
||||
auto deinit_guard = platf::init();
|
||||
if (!deinit_guard) {
|
||||
auto platf_deinit_guard = platf::init();
|
||||
if (!platf_deinit_guard) {
|
||||
BOOST_LOG(error) << "Platform failed to initialize"sv;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "logging.h"
|
||||
#include "utility.h"
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
@@ -169,7 +170,9 @@ namespace net {
|
||||
addr_to_url_escaped_string(boost::asio::ip::address address) {
|
||||
address = normalize_address(address);
|
||||
if (address.is_v6()) {
|
||||
return "["s + address.to_string() + ']';
|
||||
std::stringstream ss;
|
||||
ss << '[' << address.to_string() << ']';
|
||||
return ss.str();
|
||||
}
|
||||
else {
|
||||
return address.to_string();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
// standard includes
|
||||
#include <filesystem>
|
||||
#include <utility>
|
||||
|
||||
// lib includes
|
||||
#include <Simple-Web-Server/server_http.hpp>
|
||||
@@ -42,6 +43,8 @@ namespace nvhttp {
|
||||
namespace fs = std::filesystem;
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
crypto::cert_chain_t cert_chain;
|
||||
|
||||
class SunshineHttpsServer: public SimpleWeb::Server<SimpleWeb::HTTPS> {
|
||||
public:
|
||||
SunshineHttpsServer(const std::string &certification_file, const std::string &private_key_file):
|
||||
@@ -1017,7 +1020,6 @@ namespace nvhttp {
|
||||
conf_intern.pkey = file_handler::read_file(config::nvhttp.pkey.c_str());
|
||||
conf_intern.servercert = file_handler::read_file(config::nvhttp.cert.c_str());
|
||||
|
||||
crypto::cert_chain_t cert_chain;
|
||||
for (auto &[_, client] : map_id_client) {
|
||||
for (auto &cert : client.certs) {
|
||||
cert_chain.add(crypto::x509(cert));
|
||||
@@ -1026,15 +1028,15 @@ namespace nvhttp {
|
||||
|
||||
auto add_cert = std::make_shared<safe::queue_t<crypto::x509_t>>(30);
|
||||
|
||||
// /resume doesn't always get the parameter "localAudioPlayMode"
|
||||
// /launch will store it in host_audio
|
||||
// resume doesn't always get the parameter "localAudioPlayMode"
|
||||
// launch will store it in host_audio
|
||||
bool host_audio {};
|
||||
|
||||
https_server_t https_server { config::nvhttp.cert, config::nvhttp.pkey };
|
||||
http_server_t http_server;
|
||||
|
||||
// Verify certificates after establishing connection
|
||||
https_server.verify = [&cert_chain, add_cert](SSL *ssl) {
|
||||
https_server.verify = [add_cert](SSL *ssl) {
|
||||
crypto::x509_t x509 { SSL_get_peer_certificate(ssl) };
|
||||
if (!x509) {
|
||||
BOOST_LOG(info) << "unknown -- denied"sv;
|
||||
@@ -1148,6 +1150,7 @@ namespace nvhttp {
|
||||
void
|
||||
erase_all_clients() {
|
||||
map_id_client.clear();
|
||||
cert_chain.clear();
|
||||
save_state();
|
||||
}
|
||||
} // namespace nvhttp
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "src/config.h"
|
||||
#include "src/logging.h"
|
||||
#include "src/stat_trackers.h"
|
||||
#include "src/thread_safe.h"
|
||||
#include "src/utility.h"
|
||||
#include "src/video_colorspace.h"
|
||||
@@ -19,6 +21,8 @@ extern "C" {
|
||||
#include <moonlight-common-c/src/Limelight.h>
|
||||
}
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
struct sockaddr;
|
||||
struct AVFrame;
|
||||
struct AVBufferRef;
|
||||
@@ -499,6 +503,22 @@ namespace platf {
|
||||
int env_width, env_height;
|
||||
|
||||
int width, height;
|
||||
|
||||
protected:
|
||||
// collect capture timing data (at loglevel debug)
|
||||
stat_trackers::min_max_avg_tracker<double> sleep_overshoot_tracker;
|
||||
void
|
||||
log_sleep_overshoot(std::chrono::nanoseconds overshoot_ns) {
|
||||
if (config::sunshine.min_log_level <= 1) {
|
||||
// Print sleep overshoot stats to debug log every 20 seconds
|
||||
auto print_info = [&](double min_overshoot, double max_overshoot, double avg_overshoot) {
|
||||
auto f = stat_trackers::one_digit_after_decimal();
|
||||
BOOST_LOG(debug) << "Sleep overshoot (min/max/avg): " << f % min_overshoot << "ms/" << f % max_overshoot << "ms/" << f % avg_overshoot << "ms";
|
||||
};
|
||||
// std::chrono::nanoseconds overshoot_ns = std::chrono::steady_clock::now() - next_frame;
|
||||
sleep_overshoot_tracker.collect_and_callback_on_interval(overshoot_ns.count() / 1000000., print_info, 20s);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class mic_t {
|
||||
|
||||
@@ -247,29 +247,38 @@ namespace cuda {
|
||||
|
||||
// There's no way to directly go from CUDA to a DRM device, so we'll
|
||||
// use sysfs to look up the DRM device name from the PCI ID.
|
||||
char pci_bus_id[13];
|
||||
CU_CHECK(cdf->cuDeviceGetPCIBusId(pci_bus_id, sizeof(pci_bus_id), device), "Couldn't get CUDA device PCI bus ID");
|
||||
BOOST_LOG(debug) << "Found CUDA device with PCI bus ID: "sv << pci_bus_id;
|
||||
std::array<char, 13> pci_bus_id;
|
||||
CU_CHECK(cdf->cuDeviceGetPCIBusId(pci_bus_id.data(), pci_bus_id.size(), device), "Couldn't get CUDA device PCI bus ID");
|
||||
BOOST_LOG(debug) << "Found CUDA device with PCI bus ID: "sv << pci_bus_id.data();
|
||||
|
||||
// Linux uses lowercase hexadecimal while CUDA uses uppercase
|
||||
std::transform(pci_bus_id.begin(), pci_bus_id.end(), pci_bus_id.begin(),
|
||||
[](char c) { return std::tolower(c); });
|
||||
|
||||
// Look for the name of the primary node in sysfs
|
||||
char sysfs_path[PATH_MAX];
|
||||
std::snprintf(sysfs_path, sizeof(sysfs_path), "/sys/bus/pci/devices/%s/drm", pci_bus_id);
|
||||
fs::path sysfs_dir { sysfs_path };
|
||||
for (auto &entry : fs::directory_iterator { sysfs_dir }) {
|
||||
auto file = entry.path().filename();
|
||||
auto filestring = file.generic_u8string();
|
||||
if (std::string_view { filestring }.substr(0, 4) != "card"sv) {
|
||||
continue;
|
||||
try {
|
||||
char sysfs_path[PATH_MAX];
|
||||
std::snprintf(sysfs_path, sizeof(sysfs_path), "/sys/bus/pci/devices/%s/drm", pci_bus_id.data());
|
||||
fs::path sysfs_dir { sysfs_path };
|
||||
for (auto &entry : fs::directory_iterator { sysfs_dir }) {
|
||||
auto file = entry.path().filename();
|
||||
auto filestring = file.generic_string();
|
||||
if (std::string_view { filestring }.substr(0, 4) != "card"sv) {
|
||||
continue;
|
||||
}
|
||||
|
||||
BOOST_LOG(debug) << "Found DRM primary node: "sv << filestring;
|
||||
|
||||
fs::path dri_path { "/dev/dri"sv };
|
||||
auto device_path = dri_path / file;
|
||||
return open(device_path.c_str(), O_RDWR);
|
||||
}
|
||||
|
||||
BOOST_LOG(debug) << "Found DRM primary node: "sv << filestring;
|
||||
|
||||
fs::path dri_path { "/dev/dri"sv };
|
||||
auto device_path = dri_path / file;
|
||||
return open(device_path.c_str(), O_RDWR);
|
||||
}
|
||||
catch (const std::filesystem::filesystem_error &err) {
|
||||
BOOST_LOG(error) << "Failed to read sysfs: "sv << err.what();
|
||||
}
|
||||
|
||||
BOOST_LOG(error) << "Unable to find DRM device with PCI bus ID: "sv << pci_bus_id;
|
||||
BOOST_LOG(error) << "Unable to find DRM device with PCI bus ID: "sv << pci_bus_id.data();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -791,16 +800,21 @@ namespace cuda {
|
||||
handle.reset();
|
||||
});
|
||||
|
||||
sleep_overshoot_tracker.reset();
|
||||
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
if (next_frame > now) {
|
||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||
std::this_thread::sleep_for(next_frame - now);
|
||||
}
|
||||
while (next_frame > now) {
|
||||
std::this_thread::sleep_for(1ns);
|
||||
now = std::chrono::steady_clock::now();
|
||||
now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds overshoot_ns = now - next_frame;
|
||||
log_sleep_overshoot(overshoot_ns);
|
||||
|
||||
next_frame += delay;
|
||||
if (next_frame < now) { // some major slowdown happened; we couldn't keep up
|
||||
next_frame = now + delay;
|
||||
}
|
||||
next_frame = now + delay;
|
||||
|
||||
std::shared_ptr<platf::img_t> img_out;
|
||||
auto status = snapshot(pull_free_image_cb, img_out, 150ms, *cursor);
|
||||
@@ -1035,4 +1049,4 @@ namespace platf {
|
||||
|
||||
return display_names;
|
||||
}
|
||||
} // namespace platf
|
||||
} // namespace platf
|
||||
|
||||
@@ -22,7 +22,9 @@ extern "C" {
|
||||
#define fourcc_mod_code(vendor, val) ((((uint64_t) vendor) << 56) | ((val) &0x00ffffffffffffffULL))
|
||||
#define DRM_FORMAT_MOD_INVALID fourcc_mod_code(0, ((1ULL << 56) - 1))
|
||||
|
||||
#define SUNSHINE_SHADERS_DIR SUNSHINE_ASSETS_DIR "/shaders/opengl"
|
||||
#if !defined(SUNSHINE_SHADERS_DIR) // for testing this needs to be defined in cmake as we don't do an install
|
||||
#define SUNSHINE_SHADERS_DIR SUNSHINE_ASSETS_DIR "/shaders/opengl"
|
||||
#endif
|
||||
|
||||
using namespace std::literals;
|
||||
namespace gl {
|
||||
@@ -37,7 +39,7 @@ namespace gl {
|
||||
}
|
||||
|
||||
tex_t::~tex_t() {
|
||||
if (!size() == 0) {
|
||||
if (size() != 0) {
|
||||
ctx.DeleteTextures(size(), begin());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,8 +587,8 @@ namespace platf {
|
||||
weak_strong += data.rumble(tp);
|
||||
}
|
||||
|
||||
std::clamp<std::uint32_t>(weak_strong.first, 0, 0xFFFF);
|
||||
std::clamp<std::uint32_t>(weak_strong.second, 0, 0xFFFF);
|
||||
weak_strong.first = std::clamp<std::uint32_t>(weak_strong.first, 0, 0xFFFF);
|
||||
weak_strong.second = std::clamp<std::uint32_t>(weak_strong.second, 0, 0xFFFF);
|
||||
|
||||
old_rumble = weak_strong * gain / 0xFFFF;
|
||||
return old_rumble;
|
||||
@@ -1510,7 +1510,7 @@ namespace platf {
|
||||
std::stringstream ss;
|
||||
ss << std::hex << std::setfill('0');
|
||||
for (const auto &ch : str) {
|
||||
ss << ch;
|
||||
ss << static_cast<uint_least32_t>(ch);
|
||||
}
|
||||
|
||||
std::string hex_unicode(ss.str());
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <filesystem>
|
||||
#include <thread>
|
||||
|
||||
#include "src/config.h"
|
||||
#include "src/logging.h"
|
||||
#include "src/platform/common.h"
|
||||
#include "src/round_robin.h"
|
||||
@@ -108,6 +109,7 @@ namespace platf {
|
||||
using obj_prop_t = util::safe_ptr<drmModeObjectProperties, drmModeFreeObjectProperties>;
|
||||
using prop_t = util::safe_ptr<drmModePropertyRes, drmModeFreeProperty>;
|
||||
using prop_blob_t = util::safe_ptr<drmModePropertyBlobRes, drmModeFreePropertyBlob>;
|
||||
using version_t = util::safe_ptr<drmVersion, drmFreeVersion>;
|
||||
|
||||
using conn_type_count_t = std::map<std::uint32_t, std::uint32_t>;
|
||||
|
||||
@@ -297,6 +299,9 @@ namespace platf {
|
||||
return -1;
|
||||
}
|
||||
|
||||
version_t ver { drmGetVersion(fd.el) };
|
||||
BOOST_LOG(info) << path << " -> "sv << ((ver && ver->name) ? ver->name : "UNKNOWN");
|
||||
|
||||
// Open the render node for this card to share with libva.
|
||||
// If it fails, we'll just share the primary node instead.
|
||||
char *rendernode_path = drmGetRenderDeviceNameFromFd(fd.el);
|
||||
@@ -315,12 +320,21 @@ namespace platf {
|
||||
}
|
||||
|
||||
if (drmSetClientCap(fd.el, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) {
|
||||
BOOST_LOG(error) << "Couldn't expose some/all drm planes for card: "sv << path;
|
||||
BOOST_LOG(error) << "GPU driver doesn't support universal planes: "sv << path;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (drmSetClientCap(fd.el, DRM_CLIENT_CAP_ATOMIC, 1)) {
|
||||
BOOST_LOG(warning) << "Couldn't expose some properties for card: "sv << path;
|
||||
BOOST_LOG(warning) << "GPU driver doesn't support atomic mode-setting: "sv << path;
|
||||
#if defined(SUNSHINE_BUILD_X11)
|
||||
// We won't be able to capture the mouse cursor with KMS on non-atomic drivers,
|
||||
// so fall back to X11 if it's available and the user didn't explicitly force KMS.
|
||||
if (window_system == window_system_e::X11 && config::video.capture != "kms") {
|
||||
BOOST_LOG(info) << "Avoiding KMS capture under X11 due to lack of atomic mode-setting"sv;
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
BOOST_LOG(warning) << "Cursor capture may fail without atomic mode-setting support!"sv;
|
||||
}
|
||||
|
||||
plane_res.reset(drmModeGetPlaneResources(fd.el));
|
||||
@@ -364,6 +378,12 @@ namespace platf {
|
||||
return drmModeGetResources(fd.el);
|
||||
}
|
||||
|
||||
bool
|
||||
is_nvidia() {
|
||||
version_t ver { drmGetVersion(fd.el) };
|
||||
return ver && ver->name && strncmp(ver->name, "nvidia-drm", 10) == 0;
|
||||
}
|
||||
|
||||
bool
|
||||
is_cursor(std::uint32_t plane_id) {
|
||||
auto props = plane_props(plane_id);
|
||||
@@ -594,7 +614,7 @@ namespace platf {
|
||||
for (auto &entry : fs::directory_iterator { card_dir }) {
|
||||
auto file = entry.path().filename();
|
||||
|
||||
auto filestring = file.generic_u8string();
|
||||
auto filestring = file.generic_string();
|
||||
if (filestring.size() < 4 || std::string_view { filestring }.substr(0, 4) != "card"sv) {
|
||||
continue;
|
||||
}
|
||||
@@ -604,6 +624,15 @@ namespace platf {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip non-Nvidia cards if we're looking for CUDA devices
|
||||
// unless NVENC is selected manually by the user
|
||||
if (mem_type == mem_type_e::cuda && !card.is_nvidia()) {
|
||||
BOOST_LOG(debug) << file << " is not a CUDA device"sv;
|
||||
if (config::video.encoder != "nvenc") {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
auto end = std::end(card);
|
||||
for (auto plane = std::begin(card); plane != end; ++plane) {
|
||||
// Skip unused planes
|
||||
@@ -627,8 +656,7 @@ namespace platf {
|
||||
}
|
||||
|
||||
if (!fb->handles[0]) {
|
||||
BOOST_LOG(error)
|
||||
<< "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Possibly not permitted: do [sudo setcap cap_sys_admin+p sunshine]"sv;
|
||||
BOOST_LOG(error) << "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Probably not permitted"sv;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -896,12 +924,14 @@ namespace platf {
|
||||
|
||||
if (!prop_crtc_w || !prop_crtc_h || !prop_crtc_x || !prop_crtc_y) {
|
||||
BOOST_LOG(error) << "Cursor plane is missing required plane CRTC properties!"sv;
|
||||
BOOST_LOG(error) << "Atomic mode-setting must be enabled to capture the cursor!"sv;
|
||||
cursor_plane_id = -1;
|
||||
captured_cursor.visible = false;
|
||||
return;
|
||||
}
|
||||
if (!prop_src_x || !prop_src_y || !prop_src_w || !prop_src_h) {
|
||||
BOOST_LOG(error) << "Cursor plane is missing required plane SRC properties!"sv;
|
||||
BOOST_LOG(error) << "Atomic mode-setting must be enabled to capture the cursor!"sv;
|
||||
cursor_plane_id = -1;
|
||||
captured_cursor.visible = false;
|
||||
return;
|
||||
@@ -1039,7 +1069,7 @@ namespace platf {
|
||||
}
|
||||
|
||||
inline capture_e
|
||||
refresh(file_t *file, egl::surface_descriptor_t *sd) {
|
||||
refresh(file_t *file, egl::surface_descriptor_t *sd, std::optional<std::chrono::steady_clock::time_point> &frame_timestamp) {
|
||||
// Check for a change in HDR metadata
|
||||
if (connector_id) {
|
||||
auto connector_props = card.connector_props(*connector_id);
|
||||
@@ -1050,6 +1080,7 @@ namespace platf {
|
||||
}
|
||||
|
||||
plane_t plane = drmModeGetPlane(card.fd.el, plane_id);
|
||||
frame_timestamp = std::chrono::steady_clock::now();
|
||||
|
||||
auto fb = card.fb(plane.get());
|
||||
if (!fb) {
|
||||
@@ -1059,8 +1090,7 @@ namespace platf {
|
||||
}
|
||||
|
||||
if (!fb->handles[0]) {
|
||||
BOOST_LOG(error)
|
||||
<< "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Possibly not permitted: do [sudo setcap cap_sys_admin+p sunshine]"sv;
|
||||
BOOST_LOG(error) << "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Probably not permitted"sv;
|
||||
return capture_e::error;
|
||||
}
|
||||
|
||||
@@ -1163,17 +1193,22 @@ namespace platf {
|
||||
capture(const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) override {
|
||||
auto next_frame = std::chrono::steady_clock::now();
|
||||
|
||||
sleep_overshoot_tracker.reset();
|
||||
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
if (next_frame > now) {
|
||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||
std::this_thread::sleep_for(next_frame - now);
|
||||
}
|
||||
while (next_frame > now) {
|
||||
std::this_thread::sleep_for(1ns);
|
||||
now = std::chrono::steady_clock::now();
|
||||
now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds overshoot_ns = now - next_frame;
|
||||
log_sleep_overshoot(overshoot_ns);
|
||||
|
||||
next_frame += delay;
|
||||
if (next_frame < now) { // some major slowdown happened; we couldn't keep up
|
||||
next_frame = now + delay;
|
||||
}
|
||||
next_frame = now + delay;
|
||||
|
||||
std::shared_ptr<platf::img_t> img_out;
|
||||
auto status = snapshot(pull_free_image_cb, img_out, 1000ms, *cursor);
|
||||
@@ -1240,8 +1275,13 @@ namespace platf {
|
||||
auto delta_width = std::min<uint32_t>(captured_cursor.src_w, std::max<int32_t>(0, screen_width - cursor_x)) - cursor_delta_x;
|
||||
for (auto y = 0; y < delta_height; ++y) {
|
||||
// Offset into the cursor image to skip drawing the parts of the cursor image that are off screen
|
||||
auto cursor_begin = (uint32_t *) &captured_cursor.pixels[((y + cursor_delta_y) * captured_cursor.src_w + cursor_delta_x) * 4];
|
||||
auto cursor_end = (uint32_t *) &captured_cursor.pixels[((y + cursor_delta_y) * captured_cursor.src_w + delta_width + cursor_delta_x) * 4];
|
||||
//
|
||||
// NB: We must access the elements via the data() function because cursor_end may point to the
|
||||
// the first element beyond the valid range of the vector. Using vector's [] operator in that
|
||||
// manner is undefined behavior (and triggers errors when using debug libc++), while doing the
|
||||
// same with an array is fine.
|
||||
auto cursor_begin = (uint32_t *) &captured_cursor.pixels.data()[((y + cursor_delta_y) * captured_cursor.src_w + cursor_delta_x) * 4];
|
||||
auto cursor_end = (uint32_t *) &captured_cursor.pixels.data()[((y + cursor_delta_y) * captured_cursor.src_w + delta_width + cursor_delta_x) * 4];
|
||||
|
||||
auto pixels_begin = &pixels[(y + cursor_y) * (img.row_pitch / img.pixel_pitch) + cursor_x];
|
||||
|
||||
@@ -1269,7 +1309,8 @@ namespace platf {
|
||||
|
||||
egl::surface_descriptor_t sd;
|
||||
|
||||
auto status = refresh(fb_fd, &sd);
|
||||
std::optional<std::chrono::steady_clock::time_point> frame_timestamp;
|
||||
auto status = refresh(fb_fd, &sd, frame_timestamp);
|
||||
if (status != capture_e::ok) {
|
||||
return status;
|
||||
}
|
||||
@@ -1296,6 +1337,8 @@ namespace platf {
|
||||
|
||||
gl::ctx.GetTextureSubImage(rgb->tex[0], 0, img_offset_x, img_offset_y, 0, width, height, 1, GL_BGRA, GL_UNSIGNED_BYTE, img_out->height * img_out->row_pitch, img_out->data);
|
||||
|
||||
img_out->frame_timestamp = frame_timestamp;
|
||||
|
||||
if (cursor && captured_cursor.visible) {
|
||||
blend_cursor(*img_out);
|
||||
}
|
||||
@@ -1374,17 +1417,22 @@ namespace platf {
|
||||
capture(const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) {
|
||||
auto next_frame = std::chrono::steady_clock::now();
|
||||
|
||||
sleep_overshoot_tracker.reset();
|
||||
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
if (next_frame > now) {
|
||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||
std::this_thread::sleep_for(next_frame - now);
|
||||
}
|
||||
while (next_frame > now) {
|
||||
std::this_thread::sleep_for(1ns);
|
||||
now = std::chrono::steady_clock::now();
|
||||
now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds overshoot_ns = now - next_frame;
|
||||
log_sleep_overshoot(overshoot_ns);
|
||||
|
||||
next_frame += delay;
|
||||
if (next_frame < now) { // some major slowdown happened; we couldn't keep up
|
||||
next_frame = now + delay;
|
||||
}
|
||||
next_frame = now + delay;
|
||||
|
||||
std::shared_ptr<platf::img_t> img_out;
|
||||
auto status = snapshot(pull_free_image_cb, img_out, 1000ms, *cursor);
|
||||
@@ -1422,7 +1470,7 @@ namespace platf {
|
||||
auto img = (egl::img_descriptor_t *) img_out.get();
|
||||
img->reset();
|
||||
|
||||
auto status = refresh(fb_fd, &img->sd);
|
||||
auto status = refresh(fb_fd, &img->sd, img->frame_timestamp);
|
||||
if (status != capture_e::ok) {
|
||||
return status;
|
||||
}
|
||||
@@ -1571,7 +1619,7 @@ namespace platf {
|
||||
|
||||
// A list of names of displays accepted as display_name
|
||||
std::vector<std::string>
|
||||
kms_display_names() {
|
||||
kms_display_names(mem_type_e hwdevice_type) {
|
||||
int count = 0;
|
||||
|
||||
if (!fs::exists("/dev/dri")) {
|
||||
@@ -1593,7 +1641,7 @@ namespace platf {
|
||||
for (auto &entry : fs::directory_iterator { card_dir }) {
|
||||
auto file = entry.path().filename();
|
||||
|
||||
auto filestring = file.generic_u8string();
|
||||
auto filestring = file.generic_string();
|
||||
if (std::string_view { filestring }.substr(0, 4) != "card"sv) {
|
||||
continue;
|
||||
}
|
||||
@@ -1603,6 +1651,18 @@ namespace platf {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip non-Nvidia cards if we're looking for CUDA devices
|
||||
// unless NVENC is selected manually by the user
|
||||
if (hwdevice_type == mem_type_e::cuda && !card.is_nvidia()) {
|
||||
BOOST_LOG(debug) << file << " is not a CUDA device"sv;
|
||||
if (config::video.encoder == "nvenc") {
|
||||
BOOST_LOG(warning) << "Using NVENC with your display connected to a different GPU may not work properly!"sv;
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
auto crtc_to_monitor = kms::map_crtc_to_monitor(card.monitors(conn_type_count));
|
||||
|
||||
auto end = std::end(card);
|
||||
@@ -1623,8 +1683,9 @@ namespace platf {
|
||||
}
|
||||
|
||||
if (!fb->handles[0]) {
|
||||
BOOST_LOG(error)
|
||||
<< "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Possibly not permitted: do [sudo setcap cap_sys_admin+p sunshine]"sv;
|
||||
BOOST_LOG(error) << "Couldn't get handle for DRM Framebuffer ["sv << plane->fb_id << "]: Probably not permitted"sv;
|
||||
BOOST_LOG((window_system != window_system_e::X11 || config::video.capture == "kms") ? fatal : error)
|
||||
<< "You must run [sudo setcap cap_sys_admin+p $(readlink -f $(which sunshine))] for KMS display capture to work!"sv;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
// standard includes
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
// lib includes
|
||||
#include <arpa/inet.h>
|
||||
@@ -98,24 +99,89 @@ namespace platf {
|
||||
return ifaddr_t { p };
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Performs migration if necessary, then returns the appdata directory.
|
||||
* @details This is used for the log directory, so it cannot invoke Boost logging!
|
||||
* @return The path of the appdata directory that should be used.
|
||||
*/
|
||||
fs::path
|
||||
appdata() {
|
||||
const char *dir;
|
||||
static std::once_flag migration_flag;
|
||||
static fs::path config_path;
|
||||
|
||||
// May be set if running under a systemd service with the ConfigurationDirectory= option set.
|
||||
if ((dir = getenv("CONFIGURATION_DIRECTORY")) != nullptr) {
|
||||
return fs::path { dir } / "sunshine"sv;
|
||||
}
|
||||
// Otherwise, follow the XDG base directory specification:
|
||||
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
if ((dir = getenv("XDG_CONFIG_HOME")) != nullptr) {
|
||||
return fs::path { dir } / "sunshine"sv;
|
||||
}
|
||||
if ((dir = getenv("HOME")) == nullptr) {
|
||||
dir = getpwuid(geteuid())->pw_dir;
|
||||
}
|
||||
// Ensure migration is only attempted once
|
||||
std::call_once(migration_flag, []() {
|
||||
bool found = false;
|
||||
bool migrate_config = true;
|
||||
const char *dir;
|
||||
const char *homedir;
|
||||
const char *migrate_envvar;
|
||||
|
||||
return fs::path { dir } / ".config/sunshine"sv;
|
||||
// Get the home directory
|
||||
if ((homedir = getenv("HOME")) == nullptr || strlen(homedir) == 0) {
|
||||
// If HOME is empty or not set, use the current user's home directory
|
||||
homedir = getpwuid(geteuid())->pw_dir;
|
||||
}
|
||||
|
||||
// May be set if running under a systemd service with the ConfigurationDirectory= option set.
|
||||
if ((dir = getenv("CONFIGURATION_DIRECTORY")) != nullptr && strlen(dir) > 0) {
|
||||
found = true;
|
||||
config_path = fs::path(dir) / "sunshine"sv;
|
||||
}
|
||||
// Otherwise, follow the XDG base directory specification:
|
||||
// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
||||
if (!found && (dir = getenv("XDG_CONFIG_HOME")) != nullptr && strlen(dir) > 0) {
|
||||
found = true;
|
||||
config_path = fs::path(dir) / "sunshine"sv;
|
||||
}
|
||||
// As a last resort, use the home directory
|
||||
if (!found) {
|
||||
migrate_config = false;
|
||||
config_path = fs::path(homedir) / ".config/sunshine"sv;
|
||||
}
|
||||
|
||||
// migrate from the old config location if necessary
|
||||
migrate_envvar = getenv("SUNSHINE_MIGRATE_CONFIG");
|
||||
if (migrate_config && found && migrate_envvar && strcmp(migrate_envvar, "1") == 0) {
|
||||
std::error_code ec;
|
||||
fs::path old_config_path = fs::path(homedir) / ".config/sunshine"sv;
|
||||
if (old_config_path != config_path && fs::exists(old_config_path, ec)) {
|
||||
if (!fs::exists(config_path, ec)) {
|
||||
std::cout << "Migrating config from "sv << old_config_path << " to "sv << config_path << std::endl;
|
||||
if (!ec) {
|
||||
// Create the new directory tree if it doesn't already exist
|
||||
fs::create_directories(config_path, ec);
|
||||
}
|
||||
if (!ec) {
|
||||
// Copy the old directory into the new location
|
||||
// NB: We use a copy instead of a move so that cross-volume migrations work
|
||||
fs::copy(old_config_path, config_path, fs::copy_options::recursive | fs::copy_options::copy_symlinks, ec);
|
||||
}
|
||||
if (!ec) {
|
||||
// If the copy was successful, delete the original directory
|
||||
fs::remove_all(old_config_path, ec);
|
||||
if (ec) {
|
||||
std::cerr << "Failed to clean up old config directory: " << ec.message() << std::endl;
|
||||
|
||||
// This is not fatal. Next time we start, we'll warn the user to delete the old one.
|
||||
ec.clear();
|
||||
}
|
||||
}
|
||||
if (ec) {
|
||||
std::cerr << "Migration failed: " << ec.message() << std::endl;
|
||||
config_path = old_config_path;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We cannot use Boost logging because it hasn't been initialized yet!
|
||||
std::cerr << "Config exists in both "sv << old_config_path << " and "sv << config_path << ". Using "sv << config_path << " for config" << std::endl;
|
||||
std::cerr << "It is recommended to remove "sv << old_config_path << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return config_path;
|
||||
}
|
||||
|
||||
std::string
|
||||
@@ -734,13 +800,13 @@ namespace platf {
|
||||
|
||||
#ifdef SUNSHINE_BUILD_DRM
|
||||
std::vector<std::string>
|
||||
kms_display_names();
|
||||
kms_display_names(mem_type_e hwdevice_type);
|
||||
std::shared_ptr<display_t>
|
||||
kms_display(mem_type_e hwdevice_type, const std::string &display_name, const video::config_t &config);
|
||||
|
||||
bool
|
||||
verify_kms() {
|
||||
return !kms_display_names().empty();
|
||||
return !kms_display_names(mem_type_e::unknown).empty();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -766,7 +832,7 @@ namespace platf {
|
||||
if (sources[source::WAYLAND]) return wl_display_names();
|
||||
#endif
|
||||
#ifdef SUNSHINE_BUILD_DRM
|
||||
if (sources[source::KMS]) return kms_display_names();
|
||||
if (sources[source::KMS]) return kms_display_names(hwdevice_type);
|
||||
#endif
|
||||
#ifdef SUNSHINE_BUILD_X11
|
||||
if (sources[source::X11]) return x11_display_names();
|
||||
|
||||
@@ -129,16 +129,22 @@ namespace wl {
|
||||
capture(const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) override {
|
||||
auto next_frame = std::chrono::steady_clock::now();
|
||||
|
||||
sleep_overshoot_tracker.reset();
|
||||
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
if (next_frame > now) {
|
||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||
std::this_thread::sleep_for(next_frame - now);
|
||||
}
|
||||
while (next_frame > now) {
|
||||
now = std::chrono::steady_clock::now();
|
||||
now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds overshoot_ns = now - next_frame;
|
||||
log_sleep_overshoot(overshoot_ns);
|
||||
|
||||
next_frame += delay;
|
||||
if (next_frame < now) { // some major slowdown happened; we couldn't keep up
|
||||
next_frame = now + delay;
|
||||
}
|
||||
next_frame = now + delay;
|
||||
|
||||
std::shared_ptr<platf::img_t> img_out;
|
||||
auto status = snapshot(pull_free_image_cb, img_out, 1000ms, *cursor);
|
||||
@@ -259,16 +265,22 @@ namespace wl {
|
||||
capture(const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) override {
|
||||
auto next_frame = std::chrono::steady_clock::now();
|
||||
|
||||
sleep_overshoot_tracker.reset();
|
||||
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
if (next_frame > now) {
|
||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||
std::this_thread::sleep_for(next_frame - now);
|
||||
}
|
||||
while (next_frame > now) {
|
||||
now = std::chrono::steady_clock::now();
|
||||
now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds overshoot_ns = now - next_frame;
|
||||
log_sleep_overshoot(overshoot_ns);
|
||||
|
||||
next_frame += delay;
|
||||
if (next_frame < now) { // some major slowdown happened; we couldn't keep up
|
||||
next_frame = now + delay;
|
||||
}
|
||||
next_frame = now + delay;
|
||||
|
||||
std::shared_ptr<platf::img_t> img_out;
|
||||
auto status = snapshot(pull_free_image_cb, img_out, 1000ms, *cursor);
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace platf {
|
||||
}
|
||||
|
||||
if (streamedMonitor != -1) {
|
||||
BOOST_LOG(info) << "Configuring selected monitor ("sv << streamedMonitor << ") to stream"sv;
|
||||
BOOST_LOG(info) << "Configuring selected display ("sv << streamedMonitor << ") to stream"sv;
|
||||
screen_res_t screenr { x11::rr::GetScreenResources(xdisplay.get(), xwindow) };
|
||||
int output = screenr->noutput;
|
||||
|
||||
@@ -481,17 +481,22 @@ namespace platf {
|
||||
capture(const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) override {
|
||||
auto next_frame = std::chrono::steady_clock::now();
|
||||
|
||||
sleep_overshoot_tracker.reset();
|
||||
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
if (next_frame > now) {
|
||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||
std::this_thread::sleep_for(next_frame - now);
|
||||
}
|
||||
while (next_frame > now) {
|
||||
std::this_thread::sleep_for(1ns);
|
||||
now = std::chrono::steady_clock::now();
|
||||
now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds overshoot_ns = now - next_frame;
|
||||
log_sleep_overshoot(overshoot_ns);
|
||||
|
||||
next_frame += delay;
|
||||
if (next_frame < now) { // some major slowdown happened; we couldn't keep up
|
||||
next_frame = now + delay;
|
||||
}
|
||||
next_frame = now + delay;
|
||||
|
||||
std::shared_ptr<platf::img_t> img_out;
|
||||
auto status = snapshot(pull_free_image_cb, img_out, 1000ms, *cursor);
|
||||
@@ -535,6 +540,7 @@ namespace platf {
|
||||
auto img = (x11_img_t *) img_out.get();
|
||||
|
||||
XImage *x_img { x11::GetImage(xdisplay.get(), xwindow, offset_x, offset_y, width, height, AllPlanes, ZPixmap) };
|
||||
img->frame_timestamp = std::chrono::steady_clock::now();
|
||||
|
||||
img->width = x_img->width;
|
||||
img->height = x_img->height;
|
||||
@@ -621,17 +627,22 @@ namespace platf {
|
||||
capture(const push_captured_image_cb_t &push_captured_image_cb, const pull_free_image_cb_t &pull_free_image_cb, bool *cursor) override {
|
||||
auto next_frame = std::chrono::steady_clock::now();
|
||||
|
||||
sleep_overshoot_tracker.reset();
|
||||
|
||||
while (true) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
if (next_frame > now) {
|
||||
std::this_thread::sleep_for((next_frame - now) / 3 * 2);
|
||||
std::this_thread::sleep_for(next_frame - now);
|
||||
}
|
||||
while (next_frame > now) {
|
||||
std::this_thread::sleep_for(1ns);
|
||||
now = std::chrono::steady_clock::now();
|
||||
now = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds overshoot_ns = now - next_frame;
|
||||
log_sleep_overshoot(overshoot_ns);
|
||||
|
||||
next_frame += delay;
|
||||
if (next_frame < now) { // some major slowdown happened; we couldn't keep up
|
||||
next_frame = now + delay;
|
||||
}
|
||||
next_frame = now + delay;
|
||||
|
||||
std::shared_ptr<platf::img_t> img_out;
|
||||
auto status = snapshot(pull_free_image_cb, img_out, 1000ms, *cursor);
|
||||
@@ -795,7 +806,7 @@ namespace platf {
|
||||
return {};
|
||||
}
|
||||
|
||||
BOOST_LOG(info) << "Detecting monitors"sv;
|
||||
BOOST_LOG(info) << "Detecting displays"sv;
|
||||
|
||||
x11::xdisplay_t xdisplay { x11::OpenDisplay(nullptr) };
|
||||
if (!xdisplay) {
|
||||
@@ -810,7 +821,7 @@ namespace platf {
|
||||
for (int x = 0; x < output; ++x) {
|
||||
output_info_t out_info { x11::rr::GetOutputInfo(xdisplay.get(), screenr.get(), screenr->outputs[x]) };
|
||||
if (out_info) {
|
||||
BOOST_LOG(info) << "Detected monitor "sv << monitor << ": "sv << out_info->name << ", connected: "sv << (out_info->connection == RR_Connected);
|
||||
BOOST_LOG(info) << "Detected display: "sv << out_info->name << " (id: "sv << monitor << ")"sv << out_info->name << " connected: "sv << (out_info->connection == RR_Connected);
|
||||
++monitor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
struct CaptureSession {
|
||||
AVCaptureVideoDataOutput *output;
|
||||
@@ -29,6 +30,7 @@ typedef bool (^FrameCallbackBlock)(CMSampleBufferRef);
|
||||
@property (nonatomic, assign) NSMapTable<AVCaptureConnection *, dispatch_semaphore_t> *captureSignals;
|
||||
|
||||
+ (NSArray<NSDictionary *> *)displayNames;
|
||||
+ (NSString *)getDisplayName:(CGDirectDisplayID)displayID;
|
||||
|
||||
- (id)initWithDisplay:(CGDirectDisplayID)displayID frameRate:(int)frameRate;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user