mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-10-22 08:07:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e8572e1db | ||
|
|
98a997bd8e | ||
|
|
6fbc95cc41 | ||
|
|
1852f74e8b | ||
|
|
55e3e16860 | ||
|
|
7cf2a55b43 | ||
|
|
c41cbbd2da | ||
|
|
7283bb046b | ||
|
|
dd2df6cbcf | ||
|
|
01f1cac811 | ||
|
|
aaa112c3f3 | ||
|
|
dc0fa9c64d | ||
|
|
f749b38aa2 | ||
|
|
43d79673e1 | ||
|
|
fc841f572c | ||
|
|
df9f117a08 | ||
|
|
bedc46a1be | ||
|
|
a7c6095be5 | ||
|
|
f2d5cf785e | ||
|
|
f926ad9b5e | ||
|
|
68acf969f2 | ||
|
|
65d53e800b | ||
|
|
e44d8ac7e9 | ||
|
|
d1823dd6e1 | ||
|
|
80bfd3b8e9 | ||
|
|
07128cc7fe | ||
|
|
0892f0b0bb | ||
|
|
8cf7f3ac08 | ||
|
|
ab2bb51879 | ||
|
|
8cb98b5365 | ||
|
|
782c5f8a34 | ||
|
|
d6b5c5f63e | ||
|
|
ef6dfa6d91 | ||
|
|
3840ee8ee7 | ||
|
|
f47e40fa2a | ||
|
|
49a4a61876 | ||
|
|
669c1a6f0d | ||
|
|
15342190fa | ||
|
|
c98ef6e8a9 | ||
|
|
d36d5936da | ||
|
|
70de75ae3d | ||
|
|
ea62e33e51 | ||
|
|
524e92c81a | ||
|
|
d5a26b1d70 | ||
|
|
cd7649a666 | ||
|
|
847cc0a38a | ||
|
|
3588eb9bf8 | ||
|
|
296e22d3ca | ||
|
|
923e590da1 | ||
|
|
e56329d05a | ||
|
|
2452e80e57 | ||
|
|
b9019831a9 | ||
|
|
b3b49b440e | ||
|
|
cbedf0f74f | ||
|
|
6c980eba68 | ||
|
|
e9f766904e | ||
|
|
62d76c006d | ||
|
|
615b78a612 | ||
|
|
aaf0340d6c | ||
|
|
93ea437760 | ||
|
|
fe6a1244ed | ||
|
|
953858b0e7 | ||
|
|
f3da46833f | ||
|
|
ba2488b6e2 | ||
|
|
4e7e0d67e5 | ||
|
|
faa16b207c | ||
|
|
2d9f62761c | ||
|
|
60689f531d | ||
|
|
3f97692311 | ||
|
|
81221336f4 | ||
|
|
ecfc758ce4 | ||
|
|
2cb3a132c6 | ||
|
|
519473e498 | ||
|
|
9b271d918a | ||
|
|
5b4d874851 | ||
|
|
9dc1dbc002 | ||
|
|
7ee323f0d5 | ||
|
|
4bb6f711b9 | ||
|
|
816cec8f5c | ||
|
|
2394dfe88a | ||
|
|
dfc0d2303b | ||
|
|
598a48ec50 | ||
|
|
9f41e98e3f | ||
|
|
489891ff3c | ||
|
|
a44ed0b047 | ||
|
|
1aaa97b91d | ||
|
|
13d68e789f | ||
|
|
10dae7482c | ||
|
|
979de190dc | ||
|
|
46bcbda972 | ||
|
|
43bdc353fb | ||
|
|
6314676b9c | ||
|
|
9f77f3d968 | ||
|
|
f4733dbbe8 | ||
|
|
61fc0e4893 | ||
|
|
652ad86cad | ||
|
|
60f308bd76 | ||
|
|
b2113ff95b | ||
|
|
b8188a46a9 | ||
|
|
e790b0761e | ||
|
|
fa3317f6cd | ||
|
|
b080f7a81c | ||
|
|
57a1c5eb76 | ||
|
|
5b7e2521cc | ||
|
|
fced653c1c | ||
|
|
9253e6ac5e | ||
|
|
aff2ed22b9 | ||
|
|
5520a52379 | ||
|
|
505050e936 | ||
|
|
0437835bde | ||
|
|
77386f8dfc | ||
|
|
529fdf0341 | ||
|
|
fa74700ad9 | ||
|
|
caca491943 | ||
|
|
4794f44a6d | ||
|
|
f0119b1231 | ||
|
|
4c579aa826 | ||
|
|
b9463b3c0e | ||
|
|
cede6ce8a9 | ||
|
|
956e6e3638 | ||
|
|
b282c7d815 | ||
|
|
5b6142e2d9 | ||
|
|
58313ad8fc | ||
|
|
7aff148e9f | ||
|
|
ee5c61fb74 | ||
|
|
91be6c8028 | ||
|
|
2e0bd2ec28 | ||
|
|
a0151fbc04 | ||
|
|
d853782fea | ||
|
|
c6638a7154 | ||
|
|
4abebe3aec | ||
|
|
5aed8f928a | ||
|
|
afe6cfc383 | ||
|
|
174983ce1e | ||
|
|
1313c7b3bf | ||
|
|
bee622bcad | ||
|
|
8cefdeae49 | ||
|
|
7cf70b9607 | ||
|
|
add4b582b5 | ||
|
|
b419d21940 |
No files matched your search
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug report
|
||||||
about: Create a report to help us address issues in Moonlight
|
about: Ask for help on Discord before reporting a bug
|
||||||
|
|
||||||
---
|
---
|
||||||
**READ ME FIRST!**
|
**READ ME FIRST!**
|
||||||
This issue tracker is not the right place to ask for troubleshooting help if you're not able to connect or stream at all. For those requests, please use the #pc-help channel on our Discord server where there are many more people who can help (or direct you back here if it looks like a Moonlight bug after all). https://discord.gg/MySTSdq
|
This issue tracker is not the right place to ask for troubleshooting help if you're not able to connect or stream at all. For those requests, please use the #pc-help channel on our Discord server where there are many more people who can help (or direct you back here if it looks like a Moonlight bug after all). https://moonlight-stream.org/discord
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
A clear and concise description of what the bug is.
|
A clear and concise description of what the bug is.
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
issuesOpened: >
|
issuesOpened: >
|
||||||
If this is a question about Moonlight or you need help troubleshooting a streaming problem, please use the help channels on our [Discord server](https://discord.gg/MySTSdq) instead of GitHub issues. There are many more people available on Discord to help you and answer your questions.<br /><br />
|
If this is a question about Moonlight or you need help troubleshooting a streaming problem, please use the help channels on our [Discord server](https://moonlight-stream.org/discord) instead of GitHub issues. There are many more people available on Discord to help you and answer your questions.<br /><br />
|
||||||
This issue tracker should only be used for specific bugs or feature requests.<br /><br />
|
This issue tracker should only be used for specific bugs or feature requests.<br /><br />
|
||||||
Thank you, and happy streaming!
|
Thank you, and happy streaming!
|
||||||
-72
@@ -1,72 +0,0 @@
|
|||||||
language: cpp
|
|
||||||
|
|
||||||
git:
|
|
||||||
depth: 1
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode10.2
|
|
||||||
compiler: clang
|
|
||||||
env: TRAVIS_TARGET=osx
|
|
||||||
addons:
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- qt
|
|
||||||
- os: linux
|
|
||||||
sudo: required
|
|
||||||
dist: xenial
|
|
||||||
compiler: gcc
|
|
||||||
env: TRAVIS_TARGET=steamlink
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libc6:i386
|
|
||||||
- libstdc++6:i386
|
|
||||||
- os: linux
|
|
||||||
sudo: required
|
|
||||||
dist: bionic
|
|
||||||
compiler: gcc
|
|
||||||
env: TRAVIS_TARGET=linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- sourceline: 'ppa:savoury1/multimedia'
|
|
||||||
- sourceline: 'ppa:savoury1/ffmpeg4'
|
|
||||||
packages:
|
|
||||||
- qt5-default
|
|
||||||
- qtbase5-dev
|
|
||||||
- qtquickcontrols2-5-dev
|
|
||||||
- libqt5svg5-dev
|
|
||||||
- libgl1-mesa-dev
|
|
||||||
- libegl1-mesa-dev
|
|
||||||
- libxkbcommon-dev
|
|
||||||
- wayland-protocols
|
|
||||||
- libopus-dev
|
|
||||||
- libva-dev
|
|
||||||
- libvdpau-dev
|
|
||||||
- libsdl2-dev
|
|
||||||
- qtdeclarative5-dev
|
|
||||||
- libssl-dev
|
|
||||||
- libsdl2-ttf-dev
|
|
||||||
- libavcodec-dev
|
|
||||||
- libavutil-dev
|
|
||||||
|
|
||||||
install:
|
|
||||||
- '[ "$TRAVIS_TARGET" != osx ] || brew link --force qt'
|
|
||||||
- if [[ "$TRAVIS_TARGET" = "osx" ]]; then nvm use node && npm install --global create-dmg; fi
|
|
||||||
- if [[ "$TRAVIS_TARGET" = "steamlink" ]]; then git clone --depth=1 https://github.com/ValveSoftware/steamlink-sdk.git $HOME/steamlink-sdk; fi
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- '[ "$TRAVIS_TARGET" = "steamlink" ] || qmake -v'
|
|
||||||
- '[[ "$TRAVIS_TARGET" != linux || "$CXX" != clang++ ]] || export QMAKESPEC=linux-clang'
|
|
||||||
- '[[ "$TRAVIS_TARGET" != linux || "$CXX" != g++ ]] || export QMAKESPEC=linux-g++'
|
|
||||||
- '[ "$TRAVIS_TARGET" != osx ] || export QMAKESPEC=macx-clang'
|
|
||||||
- '[ "$TRAVIS_TARGET" != "steamlink" ] || export STEAMLINK_SDK_PATH=$HOME/steamlink-sdk'
|
|
||||||
|
|
||||||
script:
|
|
||||||
- '[ "$TRAVIS_TARGET" != "linux" ] || qmake moonlight-qt.pro -spec $QMAKESPEC'
|
|
||||||
- '[ "$TRAVIS_TARGET" != "linux" ] || make -j$(nproc) debug'
|
|
||||||
- '[ "$TRAVIS_TARGET" != "linux" ] || make -j$(nproc) release'
|
|
||||||
- '[ "$TRAVIS_TARGET" != "osx" ] || scripts/generate-dmg.sh Release'
|
|
||||||
- '[ "$TRAVIS_TARGET" != "steamlink" ] || scripts/build-steamlink-app.sh'
|
|
||||||
@@ -131,10 +131,15 @@ private:
|
|||||||
static LoadLibraryExWFunc s_RealLoadLibraryExW;
|
static LoadLibraryExWFunc s_RealLoadLibraryExW;
|
||||||
|
|
||||||
static constexpr LPCWSTR k_BlacklistedDlls[] = {
|
static constexpr LPCWSTR k_BlacklistedDlls[] = {
|
||||||
// This DLL shipped with ASUS Sonic Radar 3 improperly handles
|
// These A-Volute DLLs shipped with various audio driver packages improperly handle
|
||||||
// D3D9 exclusive fullscreen in a way that causes CreateDeviceEx()
|
// D3D9 exclusive fullscreen in a way that causes CreateDeviceEx() to deadlock.
|
||||||
// to deadlock. https://github.com/moonlight-stream/moonlight-qt/issues/102
|
// https://github.com/moonlight-stream/moonlight-qt/issues/102
|
||||||
L"NahimicOSD.dll",
|
L"NahimicOSD.dll", // ASUS Sonic Radar 3
|
||||||
|
L"SSAudioOSD.dll", // SteelSeries headsets
|
||||||
|
L"SS2OSD.dll", // ASUS Sonic Studio 2
|
||||||
|
L"Nahimic2OSD.dll",
|
||||||
|
L"NahimicMSIOSD.dll",
|
||||||
|
L"nhAsusPhoebusOSD.dll" // ASUS Phoebus
|
||||||
|
|
||||||
// This DLL has been seen in several crash reports. Some Googling
|
// This DLL has been seen in several crash reports. Some Googling
|
||||||
// suggests it's highly unstable and causes issues in many games.
|
// suggests it's highly unstable and causes issues in many games.
|
||||||
|
|||||||
@@ -4,31 +4,33 @@
|
|||||||
|
|
||||||
Moonlight also has mobile versions for [Android](https://github.com/moonlight-stream/moonlight-android) and [iOS](https://github.com/moonlight-stream/moonlight-ios).
|
Moonlight also has mobile versions for [Android](https://github.com/moonlight-stream/moonlight-android) and [iOS](https://github.com/moonlight-stream/moonlight-ios).
|
||||||
|
|
||||||
You can follow development on our [Discord server](https://discord.gg/6ERtzFY).
|
You can follow development on our [Discord server](https://moonlight-stream.org/discord).
|
||||||
|
|
||||||
[](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master)
|
[](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master)
|
||||||
[](https://travis-ci.org/moonlight-stream/moonlight-qt)
|
|
||||||
[](https://github.com/moonlight-stream/moonlight-qt/releases)
|
[](https://github.com/moonlight-stream/moonlight-qt/releases)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
- Hardware accelerated video decoding on Windows, Mac, and Linux
|
- Hardware accelerated video decoding on Windows, Mac, and Linux
|
||||||
- Supports streaming at up to 120 FPS (high refresh rate monitor recommended)
|
- Supports streaming at up to 120 FPS (high refresh rate monitor recommended)
|
||||||
- Supports streaming at 720p, 1080p, 1440p, 4K, and the client PC's native screen resolution
|
- Supports streaming at 720p, 1080p, 1440p, 4K, and the client PC's native screen resolution
|
||||||
- 5.1 surround sound audio
|
- 7.1 surround sound audio support
|
||||||
|
- Support for both pointer capture (for games) and direct mouse control (for remote desktop)
|
||||||
|
- Direct touchscreen mouse control
|
||||||
- HEVC support for better image quality at reduced bandwidth
|
- HEVC support for better image quality at reduced bandwidth
|
||||||
- Keyboard and mouse support
|
|
||||||
- Gamepad support with force feedback for up to 4 players
|
- Gamepad support with force feedback for up to 4 players
|
||||||
|
|
||||||
## Downloads
|
## Downloads
|
||||||
- [Windows, macOS, and Steam Link](https://github.com/moonlight-stream/moonlight-qt/releases)
|
- [Windows, macOS, and Steam Link](https://github.com/moonlight-stream/moonlight-qt/releases)
|
||||||
- [Snap (for Ubuntu-based Linux distros)](https://snapcraft.io/moonlight)
|
- [Snap (for Ubuntu-based Linux distros)](https://snapcraft.io/moonlight)
|
||||||
- [Flatpak (for other Linux distros)](https://flathub.org/apps/details/com.moonlight_stream.Moonlight)
|
- [Flatpak (for other Linux distros)](https://flathub.org/apps/details/com.moonlight_stream.Moonlight)
|
||||||
|
- [AppImage](https://github.com/moonlight-stream/moonlight-qt/releases)
|
||||||
|
- [Raspberry Pi 4](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Raspberry-Pi-4)
|
||||||
|
- [NVIDIA Jetson and Nintendo Switch (Ubuntu L4T)](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Linux4Tegra-(L4T)-Ubuntu)
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
### General Build Requirements
|
|
||||||
* Qt 5.9 SDK or later
|
|
||||||
|
|
||||||
### Windows-specific Build Requirements
|
### Windows Build Requirements
|
||||||
|
* Qt 5.12.4 SDK or later
|
||||||
* Windows 7 or later
|
* Windows 7 or later
|
||||||
* [Visual Studio](https://visualstudio.microsoft.com/downloads/) 2017 (Community edition is fine)
|
* [Visual Studio](https://visualstudio.microsoft.com/downloads/) 2017 (Community edition is fine)
|
||||||
* Select MSVC Desktop toolchain during Qt installation
|
* Select MSVC Desktop toolchain during Qt installation
|
||||||
@@ -36,17 +38,19 @@ You can follow development on our [Discord server](https://discord.gg/6ERtzFY).
|
|||||||
* [7-Zip](https://www.7-zip.org/) (only if building installers for non-development PCs)
|
* [7-Zip](https://www.7-zip.org/) (only if building installers for non-development PCs)
|
||||||
* [WiX Toolset](http://wixtoolset.org/releases/) v3.11 or later (only if building installers for non-development PCs)
|
* [WiX Toolset](http://wixtoolset.org/releases/) v3.11 or later (only if building installers for non-development PCs)
|
||||||
|
|
||||||
### Mac-specific Build Requirements
|
### macOS Build Requirements
|
||||||
* macOS Sierra (10.12) or later
|
* Qt 5.14 SDK or later
|
||||||
* Xcode 10
|
* macOS High Sierra (10.13) or later
|
||||||
|
* Xcode 11
|
||||||
* [create-dmg](https://github.com/sindresorhus/create-dmg) (only if building DMGs for use on non-development Macs)
|
* [create-dmg](https://github.com/sindresorhus/create-dmg) (only if building DMGs for use on non-development Macs)
|
||||||
|
|
||||||
### Linux-specific Build Requirements
|
### Linux/Unix Build Requirements
|
||||||
|
* Qt 5.9 SDK or later
|
||||||
* GCC or Clang
|
* GCC or Clang
|
||||||
* Install your distro equivalents of: `openssl-devel qt5-devel SDL2-devel ffmpeg-devel qt5-qtquickcontrols2-devel libva-devel libvdpau-devel opus-devel pulseaudio-libs-devel alsa-lib-devel SDL2_ttf-devel`
|
* Install your distro equivalents of: `openssl-devel qt5-devel SDL2-devel ffmpeg-devel qt5-qtquickcontrols2-devel libva-devel libvdpau-devel opus-devel pulseaudio-libs-devel alsa-lib-devel SDL2_ttf-devel`
|
||||||
* FFmpeg 4.0 is required to build. If your distro doesn't package FFmpeg 4.0, you can build and install it from source on http://ffmpeg.org/
|
* FFmpeg 4.0 is required to build. If your distro doesn't package FFmpeg 4.0, you can build and install it from source on http://ffmpeg.org/
|
||||||
|
|
||||||
### Steam Link-specific Build Requirements
|
### Steam Link Build Requirements
|
||||||
* [Steam Link SDK](https://github.com/ValveSoftware/steamlink-sdk) cloned on your build system
|
* [Steam Link SDK](https://github.com/ValveSoftware/steamlink-sdk) cloned on your build system
|
||||||
* STEAMLINK_SDK_PATH environment variable set to the Steam Link SDK path
|
* STEAMLINK_SDK_PATH environment variable set to the Steam Link SDK path
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule app/SDL_GameControllerDB updated: aeebc86f9f...b0486daf50.
+13
-2
@@ -46,7 +46,7 @@ win32 {
|
|||||||
LIBS += -L$$(DXSDK_DIR)/Lib/x64
|
LIBS += -L$$(DXSDK_DIR)/Lib/x64
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib
|
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib qwave.lib
|
||||||
}
|
}
|
||||||
macx {
|
macx {
|
||||||
INCLUDEPATH += $$PWD/../libs/mac/include
|
INCLUDEPATH += $$PWD/../libs/mac/include
|
||||||
@@ -104,6 +104,16 @@ unix:!macx {
|
|||||||
CONFIG += libdrm
|
CONFIG += libdrm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packagesExist(wayland-client) {
|
||||||
|
DEFINES += HAS_WAYLAND
|
||||||
|
PKGCONFIG += wayland-client
|
||||||
|
}
|
||||||
|
|
||||||
|
packagesExist(x11) {
|
||||||
|
DEFINES += HAS_X11
|
||||||
|
PKGCONFIG += x11
|
||||||
|
}
|
||||||
}
|
}
|
||||||
win32 {
|
win32 {
|
||||||
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus -ld3dx9
|
LIBS += -llibssl -llibcrypto -lSDL2 -lSDL2_ttf -lavcodec -lavutil -lopus -ld3dx9
|
||||||
@@ -148,7 +158,8 @@ SOURCES += \
|
|||||||
settings/mappingmanager.cpp \
|
settings/mappingmanager.cpp \
|
||||||
gui/sdlgamepadkeynavigation.cpp \
|
gui/sdlgamepadkeynavigation.cpp \
|
||||||
streaming/video/overlaymanager.cpp \
|
streaming/video/overlaymanager.cpp \
|
||||||
backend/systemproperties.cpp
|
backend/systemproperties.cpp \
|
||||||
|
wm.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
utils.h \
|
utils.h \
|
||||||
|
|||||||
@@ -28,9 +28,11 @@ AutoUpdateChecker::AutoUpdateChecker(QObject *parent) :
|
|||||||
|
|
||||||
void AutoUpdateChecker::start()
|
void AutoUpdateChecker::start()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) || defined(STEAM_LINK) // Only run update checker on platforms without auto-update
|
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN) || defined(STEAM_LINK) || defined(APP_IMAGE) // Only run update checker on platforms without auto-update
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 14, 2) && !defined(QT_NO_BEARERMANAGEMENT)
|
||||||
// HACK: Set network accessibility to work around QTBUG-80947
|
// HACK: Set network accessibility to work around QTBUG-80947
|
||||||
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
|
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
|
||||||
|
#endif
|
||||||
|
|
||||||
// We'll get a callback when this is finished
|
// We'll get a callback when this is finished
|
||||||
QUrl url("https://moonlight-stream.org/updates/qt.json");
|
QUrl url("https://moonlight-stream.org/updates/qt.json");
|
||||||
@@ -48,8 +50,10 @@ void AutoUpdateChecker::parseStringToVersionQuad(QString& string, QVector<int>&
|
|||||||
|
|
||||||
QString AutoUpdateChecker::getPlatform()
|
QString AutoUpdateChecker::getPlatform()
|
||||||
{
|
{
|
||||||
#ifdef STEAM_LINK
|
#if defined(STEAM_LINK)
|
||||||
return QStringLiteral("steamlink");
|
return QStringLiteral("steamlink");
|
||||||
|
#elif defined(APP_IMAGE)
|
||||||
|
return QStringLiteral("appimage");
|
||||||
#else
|
#else
|
||||||
return QSysInfo::productType();
|
return QSysInfo::productType();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -71,10 +71,10 @@ private:
|
|||||||
|
|
||||||
QUrl BoxArtManager::loadBoxArt(NvComputer* computer, NvApp& app)
|
QUrl BoxArtManager::loadBoxArt(NvComputer* computer, NvApp& app)
|
||||||
{
|
{
|
||||||
// Try to open the cached file
|
// Try to open the cached file if it exists and contains data
|
||||||
QString cacheFilePath = getFilePathForBoxArt(computer, app.id);
|
QFile cacheFile(getFilePathForBoxArt(computer, app.id));
|
||||||
if (QFile::exists(cacheFilePath)) {
|
if (cacheFile.exists() && cacheFile.size() > 0) {
|
||||||
return QUrl::fromLocalFile(cacheFilePath);
|
return QUrl::fromLocalFile(cacheFile.fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get here, we need to fetch asynchronously.
|
// If we get here, we need to fetch asynchronously.
|
||||||
@@ -109,6 +109,10 @@ QUrl BoxArtManager::loadBoxArtFromNetwork(NvComputer* computer, int appId)
|
|||||||
if (image.save(cachePath)) {
|
if (image.save(cachePath)) {
|
||||||
return QUrl::fromLocalFile(cachePath);
|
return QUrl::fromLocalFile(cachePath);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// A failed save() may leave a zero byte file. Make sure that's removed.
|
||||||
|
QFile(cachePath).remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QUrl();
|
return QUrl();
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ private:
|
|||||||
|
|
||||||
QString serverInfo;
|
QString serverInfo;
|
||||||
try {
|
try {
|
||||||
serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::NVLL_NONE);
|
serverInfo = http.getServerInfo(NvHTTP::NvLogLevel::NVLL_NONE, true);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ private:
|
|||||||
bool stateChanged = false;
|
bool stateChanged = false;
|
||||||
bool online = false;
|
bool online = false;
|
||||||
bool wasOnline = m_Computer->state == NvComputer::CS_ONLINE;
|
bool wasOnline = m_Computer->state == NvComputer::CS_ONLINE;
|
||||||
for (int i = 0; i < TRIES_BEFORE_OFFLINING && !online; i++) {
|
for (int i = 0; i < (wasOnline ? TRIES_BEFORE_OFFLINING : 1) && !online; i++) {
|
||||||
for (auto& address : m_Computer->uniqueAddresses()) {
|
for (auto& address : m_Computer->uniqueAddresses()) {
|
||||||
if (isInterruptionRequested()) {
|
if (isInterruptionRequested()) {
|
||||||
return;
|
return;
|
||||||
@@ -209,9 +209,10 @@ void ComputerManager::saveHosts()
|
|||||||
|
|
||||||
settings.remove(SER_HOSTS);
|
settings.remove(SER_HOSTS);
|
||||||
settings.beginWriteArray(SER_HOSTS);
|
settings.beginWriteArray(SER_HOSTS);
|
||||||
for (int i = 0; i < m_KnownHosts.count(); i++) {
|
int i = 0;
|
||||||
settings.setArrayIndex(i);
|
for (const NvComputer* computer : m_KnownHosts) {
|
||||||
m_KnownHosts.value(m_KnownHosts.keys()[i])->serialize(settings);
|
settings.setArrayIndex(i++);
|
||||||
|
computer->serialize(settings);
|
||||||
}
|
}
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ NvComputer::NvComputer(QSettings& settings)
|
|||||||
this->gpuModel = nullptr;
|
this->gpuModel = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NvComputer::serialize(QSettings& settings)
|
void NvComputer::serialize(QSettings& settings) const
|
||||||
{
|
{
|
||||||
QReadLocker lock(&this->lock);
|
QReadLocker lock(&this->lock);
|
||||||
|
|
||||||
@@ -313,7 +313,7 @@ bool NvComputer::isReachableOverVpn()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<QString> NvComputer::uniqueAddresses()
|
QVector<QString> NvComputer::uniqueAddresses() const
|
||||||
{
|
{
|
||||||
QVector<QString> uniqueAddressList;
|
QVector<QString> uniqueAddressList;
|
||||||
|
|
||||||
|
|||||||
@@ -33,10 +33,10 @@ public:
|
|||||||
isReachableOverVpn();
|
isReachableOverVpn();
|
||||||
|
|
||||||
QVector<QString>
|
QVector<QString>
|
||||||
uniqueAddresses();
|
uniqueAddresses() const;
|
||||||
|
|
||||||
void
|
void
|
||||||
serialize(QSettings& settings);
|
serialize(QSettings& settings) const;
|
||||||
|
|
||||||
enum PairState
|
enum PairState
|
||||||
{
|
{
|
||||||
@@ -76,5 +76,5 @@ public:
|
|||||||
QVector<NvApp> appList;
|
QVector<NvApp> appList;
|
||||||
|
|
||||||
// Synchronization
|
// Synchronization
|
||||||
QReadWriteLock lock;
|
mutable QReadWriteLock lock;
|
||||||
};
|
};
|
||||||
+32
-44
@@ -12,6 +12,7 @@
|
|||||||
#include <QtEndian>
|
#include <QtEndian>
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
|
|
||||||
|
#define FAST_FAIL_TIMEOUT_MS 2000
|
||||||
#define REQUEST_TIMEOUT_MS 5000
|
#define REQUEST_TIMEOUT_MS 5000
|
||||||
#define LAUNCH_TIMEOUT_MS 120000
|
#define LAUNCH_TIMEOUT_MS 120000
|
||||||
#define RESUME_TIMEOUT_MS 30000
|
#define RESUME_TIMEOUT_MS 30000
|
||||||
@@ -92,7 +93,7 @@ NvHTTP::getCurrentGame(QString serverInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
NvHTTP::getServerInfo(NvLogLevel logLevel)
|
NvHTTP::getServerInfo(NvLogLevel logLevel, bool fastFail)
|
||||||
{
|
{
|
||||||
QString serverInfo;
|
QString serverInfo;
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
|||||||
serverInfo = openConnectionToString(m_BaseUrlHttps,
|
serverInfo = openConnectionToString(m_BaseUrlHttps,
|
||||||
"serverinfo",
|
"serverinfo",
|
||||||
nullptr,
|
nullptr,
|
||||||
REQUEST_TIMEOUT_MS,
|
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
||||||
logLevel);
|
logLevel);
|
||||||
// Throws if the request failed
|
// Throws if the request failed
|
||||||
verifyResponseStatus(serverInfo);
|
verifyResponseStatus(serverInfo);
|
||||||
@@ -119,7 +120,7 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
|||||||
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
||||||
"serverinfo",
|
"serverinfo",
|
||||||
nullptr,
|
nullptr,
|
||||||
REQUEST_TIMEOUT_MS,
|
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
||||||
logLevel);
|
logLevel);
|
||||||
verifyResponseStatus(serverInfo);
|
verifyResponseStatus(serverInfo);
|
||||||
}
|
}
|
||||||
@@ -136,7 +137,7 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
|||||||
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
serverInfo = openConnectionToString(m_BaseUrlHttp,
|
||||||
"serverinfo",
|
"serverinfo",
|
||||||
nullptr,
|
nullptr,
|
||||||
REQUEST_TIMEOUT_MS,
|
fastFail ? FAST_FAIL_TIMEOUT_MS : REQUEST_TIMEOUT_MS,
|
||||||
logLevel);
|
logLevel);
|
||||||
verifyResponseStatus(serverInfo);
|
verifyResponseStatus(serverInfo);
|
||||||
}
|
}
|
||||||
@@ -144,30 +145,6 @@ NvHTTP::getServerInfo(NvLogLevel logLevel)
|
|||||||
return serverInfo;
|
return serverInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString
|
|
||||||
getSurroundAudioInfoString(int audioConfig)
|
|
||||||
{
|
|
||||||
int channelMask;
|
|
||||||
int channelCount;
|
|
||||||
|
|
||||||
switch (audioConfig)
|
|
||||||
{
|
|
||||||
case AUDIO_CONFIGURATION_STEREO:
|
|
||||||
channelCount = 2;
|
|
||||||
channelMask = 0x3;
|
|
||||||
break;
|
|
||||||
case AUDIO_CONFIGURATION_51_SURROUND:
|
|
||||||
channelCount = 6;
|
|
||||||
channelMask = 0xFC;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
Q_ASSERT(false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return QString::number(channelMask << 16 | channelCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NvHTTP::launchApp(int appId,
|
NvHTTP::launchApp(int appId,
|
||||||
PSTREAM_CONFIGURATION streamConfig,
|
PSTREAM_CONFIGURATION streamConfig,
|
||||||
@@ -186,10 +163,7 @@ NvHTTP::launchApp(int appId,
|
|||||||
"appid="+QString::number(appId)+
|
"appid="+QString::number(appId)+
|
||||||
"&mode="+QString::number(streamConfig->width)+"x"+
|
"&mode="+QString::number(streamConfig->width)+"x"+
|
||||||
QString::number(streamConfig->height)+"x"+
|
QString::number(streamConfig->height)+"x"+
|
||||||
// Using an FPS value over 60 causes SOPS to default to 720p60,
|
QString::number(streamConfig->fps)+
|
||||||
// so force it to 60 when starting. This won't impact our ability
|
|
||||||
// to get > 60 FPS while actually streaming though.
|
|
||||||
QString::number(streamConfig->fps > 60 ? 60 : streamConfig->fps)+
|
|
||||||
"&additionalStates=1&sops="+QString::number(sops ? 1 : 0)+
|
"&additionalStates=1&sops="+QString::number(sops ? 1 : 0)+
|
||||||
"&rikey="+QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex()+
|
"&rikey="+QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex()+
|
||||||
"&rikeyid="+QString::number(riKeyId)+
|
"&rikeyid="+QString::number(riKeyId)+
|
||||||
@@ -197,7 +171,7 @@ NvHTTP::launchApp(int appId,
|
|||||||
"&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" :
|
"&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" :
|
||||||
"")+
|
"")+
|
||||||
"&localAudioPlayMode="+QString::number(localAudio ? 1 : 0)+
|
"&localAudioPlayMode="+QString::number(localAudio ? 1 : 0)+
|
||||||
"&surroundAudioInfo="+getSurroundAudioInfoString(streamConfig->audioConfiguration)+
|
"&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration))+
|
||||||
"&remoteControllersBitmap="+QString::number(gamepadMask)+
|
"&remoteControllersBitmap="+QString::number(gamepadMask)+
|
||||||
"&gcmap="+QString::number(gamepadMask),
|
"&gcmap="+QString::number(gamepadMask),
|
||||||
LAUNCH_TIMEOUT_MS);
|
LAUNCH_TIMEOUT_MS);
|
||||||
@@ -219,7 +193,7 @@ NvHTTP::resumeApp(PSTREAM_CONFIGURATION streamConfig)
|
|||||||
"resume",
|
"resume",
|
||||||
"rikey="+QString(QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex())+
|
"rikey="+QString(QByteArray(streamConfig->remoteInputAesKey, sizeof(streamConfig->remoteInputAesKey)).toHex())+
|
||||||
"&rikeyid="+QString::number(riKeyId)+
|
"&rikeyid="+QString::number(riKeyId)+
|
||||||
"&surroundAudioInfo="+getSurroundAudioInfoString(streamConfig->audioConfiguration),
|
"&surroundAudioInfo="+QString::number(SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(streamConfig->audioConfiguration)),
|
||||||
RESUME_TIMEOUT_MS);
|
RESUME_TIMEOUT_MS);
|
||||||
|
|
||||||
// Throws if the request failed
|
// Throws if the request failed
|
||||||
@@ -256,16 +230,16 @@ NvHTTP::getDisplayModeList(QString serverInfo)
|
|||||||
while (!xmlReader.atEnd()) {
|
while (!xmlReader.atEnd()) {
|
||||||
while (xmlReader.readNextStartElement()) {
|
while (xmlReader.readNextStartElement()) {
|
||||||
QStringRef name = xmlReader.name();
|
QStringRef name = xmlReader.name();
|
||||||
if (xmlReader.name() == "DisplayMode") {
|
if (name == "DisplayMode") {
|
||||||
modes.append(NvDisplayMode());
|
modes.append(NvDisplayMode());
|
||||||
}
|
}
|
||||||
else if (xmlReader.name() == "Width") {
|
else if (name == "Width") {
|
||||||
modes.last().width = xmlReader.readElementText().toInt();
|
modes.last().width = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
else if (xmlReader.name() == "Height") {
|
else if (name == "Height") {
|
||||||
modes.last().height = xmlReader.readElementText().toInt();
|
modes.last().height = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
else if (xmlReader.name() == "RefreshRate") {
|
else if (name == "RefreshRate") {
|
||||||
modes.last().refreshRate = xmlReader.readElementText().toInt();
|
modes.last().refreshRate = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +263,7 @@ NvHTTP::getAppList()
|
|||||||
while (!xmlReader.atEnd()) {
|
while (!xmlReader.atEnd()) {
|
||||||
while (xmlReader.readNextStartElement()) {
|
while (xmlReader.readNextStartElement()) {
|
||||||
QStringRef name = xmlReader.name();
|
QStringRef name = xmlReader.name();
|
||||||
if (xmlReader.name() == "App") {
|
if (name == "App") {
|
||||||
// We must have a valid app before advancing to the next one
|
// We must have a valid app before advancing to the next one
|
||||||
if (!apps.isEmpty() && !apps.last().isInitialized()) {
|
if (!apps.isEmpty() && !apps.last().isInitialized()) {
|
||||||
qWarning() << "Invalid applist XML";
|
qWarning() << "Invalid applist XML";
|
||||||
@@ -298,15 +272,18 @@ NvHTTP::getAppList()
|
|||||||
}
|
}
|
||||||
apps.append(NvApp());
|
apps.append(NvApp());
|
||||||
}
|
}
|
||||||
else if (xmlReader.name() == "AppTitle") {
|
else if (name == "AppTitle") {
|
||||||
apps.last().name = xmlReader.readElementText();
|
apps.last().name = xmlReader.readElementText();
|
||||||
}
|
}
|
||||||
else if (xmlReader.name() == "ID") {
|
else if (name == "ID") {
|
||||||
apps.last().id = xmlReader.readElementText().toInt();
|
apps.last().id = xmlReader.readElementText().toInt();
|
||||||
}
|
}
|
||||||
else if (xmlReader.name() == "IsHdrSupported") {
|
else if (name == "IsHdrSupported") {
|
||||||
apps.last().hdrSupported = xmlReader.readElementText() == "1";
|
apps.last().hdrSupported = xmlReader.readElementText() == "1";
|
||||||
}
|
}
|
||||||
|
else if (name == "IsAppCollectorGame") {
|
||||||
|
apps.last().isAppCollectorGame = xmlReader.readElementText() == "1";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,7 +299,10 @@ NvHTTP::verifyResponseStatus(QString xml)
|
|||||||
{
|
{
|
||||||
if (xmlReader.name() == "root")
|
if (xmlReader.name() == "root")
|
||||||
{
|
{
|
||||||
int statusCode = xmlReader.attributes().value("status_code").toInt();
|
// Status code can be 0xFFFFFFFF in some rare cases on GFE 3.20.3, and
|
||||||
|
// QString::toInt() will fail in that case, so use QString::toUInt()
|
||||||
|
// and cast the result to an int instead.
|
||||||
|
int statusCode = (int)xmlReader.attributes().value("status_code").toUInt();
|
||||||
if (statusCode == 200)
|
if (statusCode == 200)
|
||||||
{
|
{
|
||||||
// Successful
|
// Successful
|
||||||
@@ -335,6 +315,12 @@ NvHTTP::verifyResponseStatus(QString xml)
|
|||||||
// 401 is expected for unpaired PCs when we fetch serverinfo over HTTPS
|
// 401 is expected for unpaired PCs when we fetch serverinfo over HTTPS
|
||||||
qWarning() << "Request failed:" << statusCode << statusMessage;
|
qWarning() << "Request failed:" << statusCode << statusMessage;
|
||||||
}
|
}
|
||||||
|
if (statusCode == -1 && statusMessage == "Invalid") {
|
||||||
|
// Special case handling an audio capture error which GFE doesn't
|
||||||
|
// provide any useful status message for.
|
||||||
|
statusCode = 418;
|
||||||
|
statusMessage = "Missing audio capture device. Reinstalling GeForce Experience should resolve this error.";
|
||||||
|
}
|
||||||
throw GfeHttpResponseException(statusCode, statusMessage);
|
throw GfeHttpResponseException(statusCode, statusMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -454,8 +440,10 @@ NvHTTP::openConnection(QUrl baseUrl,
|
|||||||
// Add our client certificate
|
// Add our client certificate
|
||||||
request.setSslConfiguration(IdentityManager::get()->getSslConfig());
|
request.setSslConfiguration(IdentityManager::get()->getSslConfig());
|
||||||
|
|
||||||
// HACK: Set reachability to work around QTBUG-80947
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 14, 2) && !defined(QT_NO_BEARERMANAGEMENT)
|
||||||
|
// HACK: Set network accessibility to work around QTBUG-80947
|
||||||
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
|
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
|
||||||
|
#endif
|
||||||
|
|
||||||
QNetworkReply* reply = m_Nam.get(request);
|
QNetworkReply* reply = m_Nam.get(request);
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public:
|
|||||||
int id;
|
int id;
|
||||||
QString name;
|
QString name;
|
||||||
bool hdrSupported;
|
bool hdrSupported;
|
||||||
|
bool isAppCollectorGame;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(NvApp)
|
Q_DECLARE_METATYPE(NvApp)
|
||||||
@@ -131,7 +132,7 @@ public:
|
|||||||
getCurrentGame(QString serverInfo);
|
getCurrentGame(QString serverInfo);
|
||||||
|
|
||||||
QString
|
QString
|
||||||
getServerInfo(NvLogLevel logLevel);
|
getServerInfo(NvLogLevel logLevel, bool fastFail = false);
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ RichPresenceManager::RichPresenceManager(StreamingPreferences& prefs, QString ga
|
|||||||
discordPresence.largeImageKey = "icon";
|
discordPresence.largeImageKey = "icon";
|
||||||
Discord_UpdatePresence(&discordPresence);
|
Discord_UpdatePresence(&discordPresence);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
Q_UNUSED(prefs)
|
||||||
|
Q_UNUSED(gameName)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "systemproperties.h"
|
#include "systemproperties.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
@@ -7,8 +8,9 @@
|
|||||||
|
|
||||||
SystemProperties::SystemProperties()
|
SystemProperties::SystemProperties()
|
||||||
{
|
{
|
||||||
isRunningWayland = qgetenv("XDG_SESSION_TYPE") == "wayland";
|
hasWindowManager = WMUtils::isRunningWindowManager();
|
||||||
isRunningXWayland = qgetenv("XDG_SESSION_TYPE") == "wayland" && QGuiApplication::platformName() == "xcb";
|
isRunningWayland = WMUtils::isRunningWayland();
|
||||||
|
isRunningXWayland = isRunningWayland && QGuiApplication::platformName() == "xcb";
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
isWow64 = QSysInfo::currentCpuArchitecture() != QSysInfo::buildCpuArchitecture();
|
isWow64 = QSysInfo::currentCpuArchitecture() != QSysInfo::buildCpuArchitecture();
|
||||||
@@ -17,7 +19,8 @@ SystemProperties::SystemProperties()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STEAM_LINK
|
#ifndef STEAM_LINK
|
||||||
hasBrowser = true;
|
// Assume we can probably launch a browser if we're in a GUI environment
|
||||||
|
hasBrowser = hasWindowManager;
|
||||||
#else
|
#else
|
||||||
hasBrowser = false;
|
hasBrowser = false;
|
||||||
#endif
|
#endif
|
||||||
@@ -74,7 +77,14 @@ void SystemProperties::querySdlVideoInfo()
|
|||||||
|
|
||||||
err = SDL_GetDesktopDisplayMode(displayIndex, &desktopMode);
|
err = SDL_GetDesktopDisplayMode(displayIndex, &desktopMode);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
monitorDesktopResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
||||||
|
monitorDesktopResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Skipping resolution over 8K: %dx%d",
|
||||||
|
desktopMode.w, desktopMode.h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
@@ -83,7 +93,14 @@ void SystemProperties::querySdlVideoInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (StreamUtils::getRealDesktopMode(displayIndex, &desktopMode)) {
|
if (StreamUtils::getRealDesktopMode(displayIndex, &desktopMode)) {
|
||||||
monitorNativeResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
if (desktopMode.w <= 8192 && desktopMode.h <= 8192) {
|
||||||
|
monitorNativeResolutions.insert(displayIndex, QRect(0, 0, desktopMode.w, desktopMode.h));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Skipping resolution over 8K: %dx%d",
|
||||||
|
desktopMode.w, desktopMode.h);
|
||||||
|
}
|
||||||
|
|
||||||
// Start at desktop mode and work our way up
|
// Start at desktop mode and work our way up
|
||||||
bestMode = desktopMode;
|
bestMode = desktopMode;
|
||||||
@@ -111,11 +128,7 @@ void SystemProperties::querySdlVideoInfo()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasHardwareAcceleration =
|
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, maximumResolution);
|
||||||
Session::isHardwareDecodeAvailable(testWindow,
|
|
||||||
StreamingPreferences::VDS_AUTO,
|
|
||||||
VIDEO_FORMAT_H264,
|
|
||||||
1920, 1080, 60);
|
|
||||||
|
|
||||||
SDL_DestroyWindow(testWindow);
|
SDL_DestroyWindow(testWindow);
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,16 @@ public:
|
|||||||
SystemProperties();
|
SystemProperties();
|
||||||
|
|
||||||
Q_PROPERTY(bool hasHardwareAcceleration MEMBER hasHardwareAcceleration CONSTANT)
|
Q_PROPERTY(bool hasHardwareAcceleration MEMBER hasHardwareAcceleration CONSTANT)
|
||||||
|
Q_PROPERTY(bool rendererAlwaysFullScreen MEMBER rendererAlwaysFullScreen CONSTANT)
|
||||||
Q_PROPERTY(bool isRunningWayland MEMBER isRunningWayland CONSTANT)
|
Q_PROPERTY(bool isRunningWayland MEMBER isRunningWayland CONSTANT)
|
||||||
Q_PROPERTY(bool isRunningXWayland MEMBER isRunningXWayland CONSTANT)
|
Q_PROPERTY(bool isRunningXWayland MEMBER isRunningXWayland CONSTANT)
|
||||||
Q_PROPERTY(bool isWow64 MEMBER isWow64 CONSTANT)
|
Q_PROPERTY(bool isWow64 MEMBER isWow64 CONSTANT)
|
||||||
|
Q_PROPERTY(bool hasWindowManager MEMBER hasWindowManager CONSTANT)
|
||||||
Q_PROPERTY(bool hasBrowser MEMBER hasBrowser CONSTANT)
|
Q_PROPERTY(bool hasBrowser MEMBER hasBrowser CONSTANT)
|
||||||
Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT)
|
Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT)
|
||||||
Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged)
|
Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged)
|
||||||
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
|
Q_PROPERTY(int maximumStreamingFrameRate MEMBER maximumStreamingFrameRate CONSTANT)
|
||||||
|
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
|
||||||
|
|
||||||
Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
|
Q_INVOKABLE QRect getDesktopResolution(int displayIndex);
|
||||||
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
|
||||||
@@ -29,13 +32,16 @@ private:
|
|||||||
void querySdlVideoInfo();
|
void querySdlVideoInfo();
|
||||||
|
|
||||||
bool hasHardwareAcceleration;
|
bool hasHardwareAcceleration;
|
||||||
|
bool rendererAlwaysFullScreen;
|
||||||
bool isRunningWayland;
|
bool isRunningWayland;
|
||||||
bool isRunningXWayland;
|
bool isRunningXWayland;
|
||||||
bool isWow64;
|
bool isWow64;
|
||||||
|
bool hasWindowManager;
|
||||||
bool hasBrowser;
|
bool hasBrowser;
|
||||||
bool hasDiscordIntegration;
|
bool hasDiscordIntegration;
|
||||||
QString unmappedGamepads;
|
QString unmappedGamepads;
|
||||||
int maximumStreamingFrameRate;
|
int maximumStreamingFrameRate;
|
||||||
|
QSize maximumResolution;
|
||||||
QList<QRect> monitorDesktopResolutions;
|
QList<QRect> monitorDesktopResolutions;
|
||||||
QList<QRect> monitorNativeResolutions;
|
QList<QRect> monitorNativeResolutions;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -172,20 +172,31 @@ GlobalCommandLineParser::ParseResult GlobalCommandLineParser::parse(const QStrin
|
|||||||
parser.addPositionalArgument("action", "Action to execute", "<action>");
|
parser.addPositionalArgument("action", "Action to execute", "<action>");
|
||||||
parser.parse(args);
|
parser.parse(args);
|
||||||
auto posArgs = parser.positionalArguments();
|
auto posArgs = parser.positionalArguments();
|
||||||
QString action = posArgs.isEmpty() ? QString() : posArgs.first().toLower();
|
|
||||||
|
|
||||||
if (action == "") {
|
if (posArgs.isEmpty()) {
|
||||||
// This method will not return and terminates the process if --version
|
// This method will not return and terminates the process if --version
|
||||||
// or --help is specified
|
// or --help is specified
|
||||||
parser.handleHelpAndVersionOptions();
|
parser.handleHelpAndVersionOptions();
|
||||||
parser.handleUnknownOptions();
|
parser.handleUnknownOptions();
|
||||||
return NormalStartRequested;
|
return NormalStartRequested;
|
||||||
} else if (action == "quit") {
|
}
|
||||||
return QuitRequested;
|
else {
|
||||||
} else if (action == "stream") {
|
// If users supply arguments that accept values prior to the "quit"
|
||||||
return StreamRequested;
|
// or "stream" positional arguments, we will not be able to correctly
|
||||||
} else {
|
// parse the value out of the input because this QCommandLineParser
|
||||||
parser.showError(QString("Invalid action: %1").arg(action));
|
// doesn't know about all of the options that "quit" and "stream"
|
||||||
|
// commands can accept. To work around this issue, we just look
|
||||||
|
// for "quit" or "stream" positional arguments anywhere.
|
||||||
|
for (int i = 0; i < posArgs.size(); i++) {
|
||||||
|
QString action = posArgs.at(i).toLower();
|
||||||
|
if (action == "quit") {
|
||||||
|
return QuitRequested;
|
||||||
|
} else if (action == "stream") {
|
||||||
|
return StreamRequested;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.showError(QString("Invalid action"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +252,7 @@ StreamCommandLineParser::StreamCommandLineParser()
|
|||||||
m_AudioConfigMap = {
|
m_AudioConfigMap = {
|
||||||
{"stereo", StreamingPreferences::AC_STEREO},
|
{"stereo", StreamingPreferences::AC_STEREO},
|
||||||
{"5.1-surround", StreamingPreferences::AC_51_SURROUND},
|
{"5.1-surround", StreamingPreferences::AC_51_SURROUND},
|
||||||
|
{"7.1-surround", StreamingPreferences::AC_71_SURROUND},
|
||||||
};
|
};
|
||||||
m_VideoCodecMap = {
|
m_VideoCodecMap = {
|
||||||
{"auto", StreamingPreferences::VCC_AUTO},
|
{"auto", StreamingPreferences::VCC_AUTO},
|
||||||
@@ -280,11 +292,12 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||||||
parser.addToggleOption("vsync", "V-Sync");
|
parser.addToggleOption("vsync", "V-Sync");
|
||||||
parser.addValueOption("fps", "FPS");
|
parser.addValueOption("fps", "FPS");
|
||||||
parser.addValueOption("bitrate", "bitrate in Kbps");
|
parser.addValueOption("bitrate", "bitrate in Kbps");
|
||||||
|
parser.addValueOption("packet-size", "video packet size");
|
||||||
parser.addChoiceOption("display-mode", "display mode", m_WindowModeMap.keys());
|
parser.addChoiceOption("display-mode", "display mode", m_WindowModeMap.keys());
|
||||||
parser.addChoiceOption("audio-config", "audio config", m_AudioConfigMap.keys());
|
parser.addChoiceOption("audio-config", "audio config", m_AudioConfigMap.keys());
|
||||||
parser.addToggleOption("multi-controller", "multiple controller support");
|
parser.addToggleOption("multi-controller", "multiple controller support");
|
||||||
parser.addToggleOption("quit-after", "quit app after session");
|
parser.addToggleOption("quit-after", "quit app after session");
|
||||||
parser.addToggleOption("mouse-acceleration", "mouse acceleration");
|
parser.addToggleOption("absolute-mouse", "enable direct mouse control (best for remote desktop rather than games)");
|
||||||
parser.addToggleOption("game-optimization", "game optimizations");
|
parser.addToggleOption("game-optimization", "game optimizations");
|
||||||
parser.addToggleOption("audio-on-host", "audio on host PC");
|
parser.addToggleOption("audio-on-host", "audio on host PC");
|
||||||
parser.addToggleOption("frame-pacing", "frame pacing");
|
parser.addToggleOption("frame-pacing", "frame pacing");
|
||||||
@@ -345,6 +358,14 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||||||
preferences->width, preferences->height, preferences->fps);
|
preferences->width, preferences->height, preferences->fps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolve --packet-size option
|
||||||
|
if (parser.isSet("packet-size")) {
|
||||||
|
preferences->packetSize = parser.getIntOption("packet-size");
|
||||||
|
if (preferences->packetSize < 1024) {
|
||||||
|
parser.showError("Packet size must be greater than 1024 bytes");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Resolve --display option
|
// Resolve --display option
|
||||||
if (parser.isSet("display-mode")) {
|
if (parser.isSet("display-mode")) {
|
||||||
preferences->windowMode = mapValue(m_WindowModeMap, parser.getChoiceOptionValue("display-mode"));
|
preferences->windowMode = mapValue(m_WindowModeMap, parser.getChoiceOptionValue("display-mode"));
|
||||||
@@ -364,8 +385,8 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
|||||||
// Resolve --quit-after and --no-quit-after options
|
// Resolve --quit-after and --no-quit-after options
|
||||||
preferences->quitAppAfter = parser.getToggleOptionValue("quit-after", preferences->quitAppAfter);
|
preferences->quitAppAfter = parser.getToggleOptionValue("quit-after", preferences->quitAppAfter);
|
||||||
|
|
||||||
// Resolve --mouse-acceleration and --no-mouse-acceleration options
|
// Resolve --absolute-mouse and --no-absolute-mouse options
|
||||||
preferences->mouseAcceleration = parser.getToggleOptionValue("mouse-acceleration", preferences->mouseAcceleration);
|
preferences->absoluteMouseMode = parser.getToggleOptionValue("absolute-mouse", preferences->absoluteMouseMode);
|
||||||
|
|
||||||
// Resolve --game-optimization and --no-game-optimization options
|
// Resolve --game-optimization and --no-game-optimization options
|
||||||
preferences->gameOptimizations = parser.getToggleOptionValue("game-optimization", preferences->gameOptimizations);
|
preferences->gameOptimizations = parser.getToggleOptionValue("game-optimization", preferences->gameOptimizations);
|
||||||
|
|||||||
@@ -13,7 +13,9 @@
|
|||||||
<li>Streaming at up to 4K resolution</li>
|
<li>Streaming at up to 4K resolution</li>
|
||||||
<li>Support for up to 120 FPS streaming (high refresh rate monitor recommended)</li>
|
<li>Support for up to 120 FPS streaming (high refresh rate monitor recommended)</li>
|
||||||
<li>Hardware accelerated video decoding with VAAPI, VDPAU, and NVDEC support</li>
|
<li>Hardware accelerated video decoding with VAAPI, VDPAU, and NVDEC support</li>
|
||||||
<li>5.1 surround sound audio support</li>
|
<li>7.1 surround sound audio support</li>
|
||||||
|
<li>Support for both pointer capture (for games) and direct mouse control (for remote desktop)</li>
|
||||||
|
<li>Direct touchscreen mouse control</li>
|
||||||
<li>HEVC support for better video compression efficiency</li>
|
<li>HEVC support for better video compression efficiency</li>
|
||||||
<li>Gamepad support with force feedback for up to 4 players</li>
|
<li>Gamepad support with force feedback for up to 4 players</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -33,6 +35,30 @@
|
|||||||
</screenshots>
|
</screenshots>
|
||||||
|
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="2.0.0" date="2020-04-28">
|
||||||
|
<description>
|
||||||
|
<p>New features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Remote desktop-optimized mouse mode which doesn't require capturing the mouse cursor</li>
|
||||||
|
<li>Touchscreen input now directly controls the mouse cursor</li>
|
||||||
|
<li>7.1 surround sound support</li>
|
||||||
|
</ul>
|
||||||
|
<p>Bugfixes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Improved performance on some lossy networks</li>
|
||||||
|
<li>Fixed disconnect delay when streaming from GeForce Experience 3.20.3.63</li>
|
||||||
|
<li>Fixed frame rate not exceeding 60 when streaming from GeForce Experience 3.20.3.63</li>
|
||||||
|
<li>Fixed parsing of command-line options when passing flags prior to the action</li>
|
||||||
|
<li>Fixed an issue that may cause excessive mDNS network traffic while Moonlight is running</li>
|
||||||
|
<li>Fixed hardware decoding on Intel GPUs running Mesa 20.0 and/or the Iris driver</li>
|
||||||
|
<li>Fixed hardware decoding on Comet Lake and later Intel GPUs using the iHD VA-API driver</li>
|
||||||
|
<li>Fixed hardware decoding on AMD Radeon GPUs with XWayland</li>
|
||||||
|
<li>Fixed a crash when using the iHD VA-API driver on Wayland</li>
|
||||||
|
<li>Fixed delay after exiting the stream on Wayland</li>
|
||||||
|
<li>Updated included gamepad mappings</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release version="1.2.0" date="2019-12-17">
|
<release version="1.2.0" date="2019-12-17">
|
||||||
<description>
|
<description>
|
||||||
<p>Bugfixes:</p>
|
<p>Bugfixes:</p>
|
||||||
|
|||||||
@@ -5,9 +5,19 @@
|
|||||||
# pairing data will be lost each reboot.
|
# pairing data will be lost each reboot.
|
||||||
HOME=/usr/local/moonlight
|
HOME=/usr/local/moonlight
|
||||||
|
|
||||||
|
# For a seamless transition across the Qt 5.9 -> Qt 5.14 boundary,
|
||||||
|
# we bundle binaries built with both Qt 5.9 and Qt 5.14 and pick
|
||||||
|
# the correct one at runtime.
|
||||||
|
if [ -d "/usr/local/Qt-5.14.1" ]; then
|
||||||
|
BIN="moonlight"
|
||||||
|
else
|
||||||
|
BIN="moonlight59"
|
||||||
|
fi
|
||||||
|
|
||||||
# Renice PE_Single_CPU which seems to host A/V stuff
|
# Renice PE_Single_CPU which seems to host A/V stuff
|
||||||
renice -10 -p $(pidof PE_Single_CPU)
|
renice -10 -p $(pidof PE_Single_CPU)
|
||||||
|
|
||||||
# Renice Moonlight itself to avoid preemption by background tasks
|
# Renice Moonlight itself to avoid preemption by background tasks
|
||||||
# Write output to a logfile in /tmp
|
# Write output to a logfile in /tmp
|
||||||
exec nice -n -10 ./bin/moonlight > /tmp/moonlight.log
|
echo Launching $BIN
|
||||||
|
exec nice -n -10 ./bin/$BIN > /tmp/moonlight.log
|
||||||
@@ -38,4 +38,6 @@ GridView {
|
|||||||
|
|
||||||
updateMargins()
|
updateMargins()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boundsBehavior: Flickable.OvershootBounds
|
||||||
}
|
}
|
||||||
+48
-23
@@ -10,6 +10,8 @@ Flickable {
|
|||||||
id: settingsPage
|
id: settingsPage
|
||||||
objectName: "Settings"
|
objectName: "Settings"
|
||||||
|
|
||||||
|
boundsBehavior: Flickable.OvershootBounds
|
||||||
|
|
||||||
contentWidth: settingsColumn1.width > settingsColumn2.width ? settingsColumn1.width : settingsColumn2.width
|
contentWidth: settingsColumn1.width > settingsColumn2.width ? settingsColumn1.width : settingsColumn2.width
|
||||||
contentHeight: settingsColumn1.height > settingsColumn2.height ? settingsColumn1.height : settingsColumn2.height
|
contentHeight: settingsColumn1.height > settingsColumn2.height ? settingsColumn1.height : settingsColumn2.height
|
||||||
|
|
||||||
@@ -88,7 +90,7 @@ Flickable {
|
|||||||
|
|
||||||
// Some platforms have different desktop resolutions
|
// Some platforms have different desktop resolutions
|
||||||
// and native resolutions (like macOS with Retina displays)
|
// and native resolutions (like macOS with Retina displays)
|
||||||
if (displayResIndex == 0) {
|
if (displayResIndex === 0) {
|
||||||
screenRect = SystemProperties.getDesktopResolution(displayIndex)
|
screenRect = SystemProperties.getDesktopResolution(displayIndex)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -129,6 +131,20 @@ Flickable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prune resolutions that are over the decoder's maximum
|
||||||
|
var max_pixels = SystemProperties.maximumResolution.width * SystemProperties.maximumResolution.height;
|
||||||
|
if (max_pixels > 0) {
|
||||||
|
for (var j = 0; j < resolutionComboBox.count; j++) {
|
||||||
|
var existing_width = parseInt(resolutionListModel.get(j).video_width);
|
||||||
|
var existing_height = parseInt(resolutionListModel.get(j).video_height);
|
||||||
|
|
||||||
|
if (existing_width * existing_height > max_pixels) {
|
||||||
|
resolutionListModel.remove(j)
|
||||||
|
j--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// load the saved width/height, and iterate through the ComboBox until a match is found
|
// load the saved width/height, and iterate through the ComboBox until a match is found
|
||||||
// and set it to that index.
|
// and set it to that index.
|
||||||
var saved_width = StreamingPreferences.width
|
var saved_width = StreamingPreferences.width
|
||||||
@@ -338,19 +354,24 @@ Flickable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var savedWm = StreamingPreferences.windowMode
|
|
||||||
currentIndex = 0
|
currentIndex = 0
|
||||||
for (var i = 0; i < windowModeListModel.count; i++) {
|
|
||||||
var thisWm = windowModeListModel.get(i).val;
|
if (SystemProperties.hasWindowManager && !SystemProperties.rendererAlwaysFullScreen) {
|
||||||
if (savedWm === thisWm) {
|
var savedWm = StreamingPreferences.windowMode
|
||||||
currentIndex = i
|
for (var i = 0; i < windowModeListModel.count; i++) {
|
||||||
break
|
var thisWm = windowModeListModel.get(i).val;
|
||||||
}
|
if (savedWm === thisWm) {
|
||||||
|
currentIndex = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activated(currentIndex)
|
activated(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
id: windowModeComboBox
|
id: windowModeComboBox
|
||||||
|
enabled: SystemProperties.hasWindowManager && !SystemProperties.rendererAlwaysFullScreen
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
textRole: "text"
|
textRole: "text"
|
||||||
model: ListModel {
|
model: ListModel {
|
||||||
@@ -459,6 +480,10 @@ Flickable {
|
|||||||
text: "5.1 surround sound"
|
text: "5.1 surround sound"
|
||||||
val: StreamingPreferences.AC_51_SURROUND
|
val: StreamingPreferences.AC_51_SURROUND
|
||||||
}
|
}
|
||||||
|
ListElement {
|
||||||
|
text: "7.1 surround sound"
|
||||||
|
val: StreamingPreferences.AC_71_SURROUND
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
onActivated : {
|
onActivated : {
|
||||||
@@ -484,7 +509,8 @@ Flickable {
|
|||||||
id: startMaximizedCheck
|
id: startMaximizedCheck
|
||||||
text: "Maximize Moonlight window on startup"
|
text: "Maximize Moonlight window on startup"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
checked: !StreamingPreferences.startWindowed
|
enabled: SystemProperties.hasWindowManager
|
||||||
|
checked: !StreamingPreferences.startWindowed || !SystemProperties.hasWindowManager
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
StreamingPreferences.startWindowed = !checked
|
StreamingPreferences.startWindowed = !checked
|
||||||
}
|
}
|
||||||
@@ -553,19 +579,21 @@ Flickable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: rawInputCheck
|
id: absoluteMouseCheck
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
text: "Raw mouse input"
|
text: "Optimize mouse for remote desktop instead of games"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
checked: !StreamingPreferences.mouseAcceleration
|
enabled: SystemProperties.hasWindowManager
|
||||||
|
checked: StreamingPreferences.absoluteMouseMode && SystemProperties.hasWindowManager
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
StreamingPreferences.mouseAcceleration = !checked
|
StreamingPreferences.absoluteMouseMode = checked
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip.delay: 1000
|
ToolTip.delay: 1000
|
||||||
ToolTip.timeout: 3000
|
ToolTip.timeout: 5000
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: "When checked, mouse input is not accelerated or scaled by the OS before passing to Moonlight"
|
ToolTip.text: "This enables mouse control without capturing the client's mouse cursor. It will not work in most games.\n
|
||||||
|
You can toggle this while streaming using Ctrl+Alt+Shift+M."
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
@@ -708,20 +736,17 @@ Flickable {
|
|||||||
val: StreamingPreferences.VCC_AUTO
|
val: StreamingPreferences.VCC_AUTO
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
text: "Force H.264"
|
text: "H.264"
|
||||||
val: StreamingPreferences.VCC_FORCE_H264
|
val: StreamingPreferences.VCC_FORCE_H264
|
||||||
}
|
}
|
||||||
ListElement {
|
ListElement {
|
||||||
text: "Force HEVC"
|
text: "HEVC (H.265)"
|
||||||
val: StreamingPreferences.VCC_FORCE_HEVC
|
val: StreamingPreferences.VCC_FORCE_HEVC
|
||||||
}
|
}
|
||||||
// HDR seems to be broken in GFE 3.14.1, and even when that's fixed
|
ListElement {
|
||||||
// we'll probably need to gate this feature on OS support in our
|
text: "HEVC HDR (Experimental)"
|
||||||
// renderers.
|
|
||||||
/* ListElement {
|
|
||||||
text: "Force HEVC HDR"
|
|
||||||
val: StreamingPreferences.VCC_FORCE_HEVC_HDR
|
val: StreamingPreferences.VCC_FORCE_HEVC_HDR
|
||||||
} */
|
}
|
||||||
}
|
}
|
||||||
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
// ::onActivated must be used, as it only listens for when the index is changed by a human
|
||||||
onActivated : {
|
onActivated : {
|
||||||
|
|||||||
@@ -117,9 +117,22 @@ Item {
|
|||||||
session.sessionFinished.connect(sessionFinished)
|
session.sessionFinished.connect(sessionFinished)
|
||||||
|
|
||||||
// Kick off the stream
|
// Kick off the stream
|
||||||
|
spinnerTimer.start()
|
||||||
streamLoader.active = true
|
streamLoader.active = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: spinnerTimer
|
||||||
|
|
||||||
|
// Display the spinner appearance a bit to allow us to reach
|
||||||
|
// the code in Session.exec() that pumps the event loop.
|
||||||
|
// If we display it immediately, it will briefly hang in the
|
||||||
|
// middle of the animation on Windows, which looks very
|
||||||
|
// obviously broken.
|
||||||
|
interval: 100
|
||||||
|
onTriggered: stageSpinner.running = true
|
||||||
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: streamLoader
|
id: streamLoader
|
||||||
active: false
|
active: false
|
||||||
@@ -150,6 +163,7 @@ Item {
|
|||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
id: stageSpinner
|
id: stageSpinner
|
||||||
|
running: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
|||||||
+5
-1
@@ -17,7 +17,7 @@ ApplicationWindow {
|
|||||||
width: 1280
|
width: 1280
|
||||||
height: 600
|
height: 600
|
||||||
|
|
||||||
visibility: StreamingPreferences.startWindowed ? "Windowed" : "Maximized"
|
visibility: (SystemProperties.hasWindowManager && StreamingPreferences.startWindowed) ? "Windowed" : "Maximized"
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: stackView
|
id: stackView
|
||||||
@@ -413,6 +413,10 @@ ApplicationWindow {
|
|||||||
editText.forceActiveFocus()
|
editText.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClosed: {
|
||||||
|
editText.clear()
|
||||||
|
}
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if (editText.text) {
|
if (editText.text) {
|
||||||
ComputerManager.addNewHost(editText.text, false)
|
ComputerManager.addNewHost(editText.text, false)
|
||||||
|
|||||||
+67
-8
@@ -10,6 +10,7 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
// Don't let SDL hook our main function, since Qt is already
|
// Don't let SDL hook our main function, since Qt is already
|
||||||
// doing the same thing. This needs to be before any headers
|
// doing the same thing. This needs to be before any headers
|
||||||
@@ -21,14 +22,17 @@
|
|||||||
#include "streaming/video/ffmpeg.h"
|
#include "streaming/video/ffmpeg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#if defined(Q_OS_WIN32)
|
||||||
#include "antihookingprotection.h"
|
#include "antihookingprotection.h"
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
#include <openssl/ssl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cli/quitstream.h"
|
#include "cli/quitstream.h"
|
||||||
#include "cli/startstream.h"
|
#include "cli/startstream.h"
|
||||||
#include "cli/commandlineparser.h"
|
#include "cli/commandlineparser.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
#include "utils.h"
|
||||||
#include "gui/computermodel.h"
|
#include "gui/computermodel.h"
|
||||||
#include "gui/appmodel.h"
|
#include "gui/appmodel.h"
|
||||||
#include "backend/autoupdatechecker.h"
|
#include "backend/autoupdatechecker.h"
|
||||||
@@ -72,7 +76,12 @@ void logToLoggerStream(QString& message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (s_LogLinesWritten == MAX_LOG_LINES) {
|
else if (s_LogLinesWritten == MAX_LOG_LINES) {
|
||||||
s_LoggerStream << "Log size limit reached!" << endl;
|
s_LoggerStream << "Log size limit reached!";
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
|
s_LoggerStream << Qt::endl;
|
||||||
|
#else
|
||||||
|
s_LoggerStream << endl;
|
||||||
|
#endif
|
||||||
s_LogLimitReached = true;
|
s_LogLimitReached = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -279,19 +288,44 @@ int main(int argc, char *argv[])
|
|||||||
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
|
SetUnhandledExceptionFilter(UnhandledExceptionHandler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#if defined(Q_OS_WIN32)
|
||||||
// Force AntiHooking.dll to be statically imported and loaded
|
// Force AntiHooking.dll to be statically imported and loaded
|
||||||
// by ntdll by calling a dummy function.
|
// by ntdll by calling a dummy function.
|
||||||
AntiHookingDummyImport();
|
AntiHookingDummyImport();
|
||||||
|
#elif defined(Q_OS_LINUX)
|
||||||
|
// Force libssl.so to be directly linked to our binary, so
|
||||||
|
// linuxdeployqt can find it and include it in our AppImage.
|
||||||
|
// QtNetwork will pull it in via dlopen().
|
||||||
|
SSL_free(nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable High DPI support
|
// Avoid using High DPI on EGLFS. It breaks font rendering.
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
// https://bugreports.qt.io/browse/QTBUG-64377
|
||||||
|
//
|
||||||
|
// NB: We can't use QGuiApplication::platformName() here because it is only
|
||||||
|
// set once the QGuiApplication is created, which is too late to enable High DPI :(
|
||||||
|
if (WMUtils::isRunningWindowManager()) {
|
||||||
|
// Enable High DPI support
|
||||||
|
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
// Enable fractional High DPI scaling on Qt 5.14 and later
|
// Enable fractional High DPI scaling on Qt 5.14 and later
|
||||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#ifndef STEAM_LINK
|
||||||
|
if (!qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) {
|
||||||
|
qInfo() << "Unable to detect Wayland or X11, so EGLFS will be used by default. Set QT_QPA_PLATFORM to override this.";
|
||||||
|
qputenv("QT_QPA_PLATFORM", "eglfs");
|
||||||
|
|
||||||
|
if (!QFile("/dev/dri").exists()) {
|
||||||
|
qWarning() << "Unable to find a KMSDRM display device!";
|
||||||
|
qWarning() << "On the Raspberry Pi, you must enable the 'fake KMS' driver in raspi-config to use Moonlight outside of the GUI environment.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// This avoids using the default keychain for SSL, which may cause
|
// This avoids using the default keychain for SSL, which may cause
|
||||||
// password prompts on macOS.
|
// password prompts on macOS.
|
||||||
@@ -333,6 +367,12 @@ int main(int argc, char *argv[])
|
|||||||
// initializing the SDL video subsystem to have any effect.
|
// initializing the SDL video subsystem to have any effect.
|
||||||
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
|
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
|
||||||
|
|
||||||
|
// For SDL backends that support it, use double buffering instead of triple buffering
|
||||||
|
// to save a frame of latency. This doesn't matter for MMAL or DRM renderers since they
|
||||||
|
// are drawing directly to the screen without involving SDL, but it may matter for other
|
||||||
|
// future KMSDRM platforms that use SDL for rendering.
|
||||||
|
SDL_SetHint(SDL_HINT_VIDEO_DOUBLE_BUFFER, "1");
|
||||||
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_TIMER) != 0) {
|
if (SDL_InitSubSystem(SDL_INIT_TIMER) != 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"SDL_InitSubSystem(SDL_INIT_TIMER) failed: %s",
|
"SDL_InitSubSystem(SDL_INIT_TIMER) failed: %s",
|
||||||
@@ -363,6 +403,11 @@ int main(int argc, char *argv[])
|
|||||||
// Disable minimize on focus loss by default. Users seem to want this off by default.
|
// Disable minimize on focus loss by default. Users seem to want this off by default.
|
||||||
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0");
|
||||||
|
|
||||||
|
// SDL 2.0.12 changes the default behavior to use the button label rather than the button
|
||||||
|
// position as most other software does. Set this back to 0 to stay consistent with prior
|
||||||
|
// releases of Moonlight.
|
||||||
|
SDL_SetHint("SDL_GAMECONTROLLER_USE_BUTTON_LABELS", "0");
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// Allow thread naming using exceptions on debug builds. SDL doesn't use SEH
|
// Allow thread naming using exceptions on debug builds. SDL doesn't use SEH
|
||||||
// when throwing the exceptions, so we don't enable it for release builds out
|
// when throwing the exceptions, so we don't enable it for release builds out
|
||||||
@@ -374,7 +419,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// After the QGuiApplication is created, the platform stuff will be initialized
|
// After the QGuiApplication is created, the platform stuff will be initialized
|
||||||
// and we can set the SDL video driver to match Qt.
|
// and we can set the SDL video driver to match Qt.
|
||||||
if (qgetenv("XDG_SESSION_TYPE") == "wayland" && QGuiApplication::platformName() == "xcb") {
|
if (WMUtils::isRunningWayland() && QGuiApplication::platformName() == "xcb") {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected XWayland. This will probably break hardware decoding! Try running with QT_QPA_PLATFORM=wayland or switch to X11.");
|
"Detected XWayland. This will probably break hardware decoding! Try running with QT_QPA_PLATFORM=wayland or switch to X11.");
|
||||||
}
|
}
|
||||||
@@ -397,6 +442,17 @@ int main(int argc, char *argv[])
|
|||||||
// Move the mouse to the bottom right so it's invisible when using
|
// Move the mouse to the bottom right so it's invisible when using
|
||||||
// gamepad-only navigation.
|
// gamepad-only navigation.
|
||||||
QCursor().setPos(0xFFFF, 0xFFFF);
|
QCursor().setPos(0xFFFF, 0xFFFF);
|
||||||
|
#elif !SDL_VERSION_ATLEAST(2, 0, 11) && defined(Q_OS_LINUX) && (defined(__arm__) || defined(__aarch64__))
|
||||||
|
if (qgetenv("SDL_VIDEO_GL_DRIVER").isEmpty() && QGuiApplication::platformName() == "eglfs") {
|
||||||
|
// Look for Raspberry Pi GLES libraries. SDL 2.0.10 and earlier needs some help finding
|
||||||
|
// the correct libraries for the KMSDRM backend if not compiled with the RPI backend enabled.
|
||||||
|
if (SDL_LoadObject("libbrcmGLESv2.so") != nullptr) {
|
||||||
|
qputenv("SDL_VIDEO_GL_DRIVER", "libbrcmGLESv2.so");
|
||||||
|
}
|
||||||
|
else if (SDL_LoadObject("/opt/vc/lib/libbrcmGLESv2.so") != nullptr) {
|
||||||
|
qputenv("SDL_VIDEO_GL_DRIVER", "/opt/vc/lib/libbrcmGLESv2.so");
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
app.setWindowIcon(QIcon(":/res/moonlight.svg"));
|
app.setWindowIcon(QIcon(":/res/moonlight.svg"));
|
||||||
@@ -431,6 +487,9 @@ int main(int argc, char *argv[])
|
|||||||
return new StreamingPreferences();
|
return new StreamingPreferences();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Create the identity manager on the main thread
|
||||||
|
IdentityManager::get();
|
||||||
|
|
||||||
#ifndef Q_OS_WINRT
|
#ifndef Q_OS_WINRT
|
||||||
// Use the dense material dark theme by default
|
// Use the dense material dark theme by default
|
||||||
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")) {
|
if (!qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_STYLE")) {
|
||||||
|
|||||||
@@ -26,7 +26,13 @@ MappingManager::MappingManager()
|
|||||||
settings.endArray();
|
settings.endArray();
|
||||||
|
|
||||||
// Finally load mappings from SDL_HINT_GAMECONTROLLERCONFIG
|
// Finally load mappings from SDL_HINT_GAMECONTROLLERCONFIG
|
||||||
QStringList sdlMappings = QString::fromLocal8Bit(SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG)).split('\n', QString::SkipEmptyParts);
|
QStringList sdlMappings =
|
||||||
|
QString::fromLocal8Bit(SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG))
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
|
.split('\n', Qt::SkipEmptyParts);
|
||||||
|
#else
|
||||||
|
.split('\n', QString::SkipEmptyParts);
|
||||||
|
#endif
|
||||||
for (QString sdlMapping : sdlMappings) {
|
for (QString sdlMapping : sdlMappings) {
|
||||||
SdlGamepadMapping mapping(sdlMapping);
|
SdlGamepadMapping mapping(sdlMapping);
|
||||||
addMapping(mapping);
|
addMapping(mapping);
|
||||||
|
|||||||
@@ -19,13 +19,14 @@
|
|||||||
#define SER_UNSUPPORTEDFPS "unsupportedfps"
|
#define SER_UNSUPPORTEDFPS "unsupportedfps"
|
||||||
#define SER_MDNS "mdns"
|
#define SER_MDNS "mdns"
|
||||||
#define SER_QUITAPPAFTER "quitAppAfter"
|
#define SER_QUITAPPAFTER "quitAppAfter"
|
||||||
#define SER_MOUSEACCELERATION "mouseacceleration"
|
#define SER_ABSMOUSEMODE "mouseacceleration"
|
||||||
#define SER_STARTWINDOWED "startwindowed"
|
#define SER_STARTWINDOWED "startwindowed"
|
||||||
#define SER_FRAMEPACING "framepacing"
|
#define SER_FRAMEPACING "framepacing"
|
||||||
#define SER_CONNWARNINGS "connwarnings"
|
#define SER_CONNWARNINGS "connwarnings"
|
||||||
#define SER_RICHPRESENCE "richpresence"
|
#define SER_RICHPRESENCE "richpresence"
|
||||||
#define SER_GAMEPADMOUSE "gamepadmouse"
|
#define SER_GAMEPADMOUSE "gamepadmouse"
|
||||||
#define SER_DEFAULTVER "defaultver"
|
#define SER_DEFAULTVER "defaultver"
|
||||||
|
#define SER_PACKETSIZE "packetsize"
|
||||||
|
|
||||||
#define CURRENT_DEFAULT_VER 1
|
#define CURRENT_DEFAULT_VER 1
|
||||||
|
|
||||||
@@ -58,12 +59,13 @@ void StreamingPreferences::reload()
|
|||||||
unsupportedFps = settings.value(SER_UNSUPPORTEDFPS, false).toBool();
|
unsupportedFps = settings.value(SER_UNSUPPORTEDFPS, false).toBool();
|
||||||
enableMdns = settings.value(SER_MDNS, true).toBool();
|
enableMdns = settings.value(SER_MDNS, true).toBool();
|
||||||
quitAppAfter = settings.value(SER_QUITAPPAFTER, false).toBool();
|
quitAppAfter = settings.value(SER_QUITAPPAFTER, false).toBool();
|
||||||
mouseAcceleration = settings.value(SER_MOUSEACCELERATION, false).toBool();
|
absoluteMouseMode = settings.value(SER_ABSMOUSEMODE, false).toBool();
|
||||||
startWindowed = settings.value(SER_STARTWINDOWED, false).toBool();
|
startWindowed = settings.value(SER_STARTWINDOWED, true).toBool();
|
||||||
framePacing = settings.value(SER_FRAMEPACING, false).toBool();
|
framePacing = settings.value(SER_FRAMEPACING, false).toBool();
|
||||||
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
||||||
richPresence = settings.value(SER_RICHPRESENCE, true).toBool();
|
richPresence = settings.value(SER_RICHPRESENCE, true).toBool();
|
||||||
gamepadMouse = settings.value(SER_GAMEPADMOUSE, true).toBool();
|
gamepadMouse = settings.value(SER_GAMEPADMOUSE, true).toBool();
|
||||||
|
packetSize = settings.value(SER_PACKETSIZE, 0).toInt();
|
||||||
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
audioConfig = static_cast<AudioConfig>(settings.value(SER_AUDIOCFG,
|
||||||
static_cast<int>(AudioConfig::AC_STEREO)).toInt());
|
static_cast<int>(AudioConfig::AC_STEREO)).toInt());
|
||||||
videoCodecConfig = static_cast<VideoCodecConfig>(settings.value(SER_VIDEOCFG,
|
videoCodecConfig = static_cast<VideoCodecConfig>(settings.value(SER_VIDEOCFG,
|
||||||
@@ -101,12 +103,13 @@ void StreamingPreferences::save()
|
|||||||
settings.setValue(SER_UNSUPPORTEDFPS, unsupportedFps);
|
settings.setValue(SER_UNSUPPORTEDFPS, unsupportedFps);
|
||||||
settings.setValue(SER_MDNS, enableMdns);
|
settings.setValue(SER_MDNS, enableMdns);
|
||||||
settings.setValue(SER_QUITAPPAFTER, quitAppAfter);
|
settings.setValue(SER_QUITAPPAFTER, quitAppAfter);
|
||||||
settings.setValue(SER_MOUSEACCELERATION, mouseAcceleration);
|
settings.setValue(SER_ABSMOUSEMODE, absoluteMouseMode);
|
||||||
settings.setValue(SER_STARTWINDOWED, startWindowed);
|
settings.setValue(SER_STARTWINDOWED, startWindowed);
|
||||||
settings.setValue(SER_FRAMEPACING, framePacing);
|
settings.setValue(SER_FRAMEPACING, framePacing);
|
||||||
settings.setValue(SER_CONNWARNINGS, connectionWarnings);
|
settings.setValue(SER_CONNWARNINGS, connectionWarnings);
|
||||||
settings.setValue(SER_RICHPRESENCE, richPresence);
|
settings.setValue(SER_RICHPRESENCE, richPresence);
|
||||||
settings.setValue(SER_GAMEPADMOUSE, gamepadMouse);
|
settings.setValue(SER_GAMEPADMOUSE, gamepadMouse);
|
||||||
|
settings.setValue(SER_PACKETSIZE, packetSize);
|
||||||
settings.setValue(SER_AUDIOCFG, static_cast<int>(audioConfig));
|
settings.setValue(SER_AUDIOCFG, static_cast<int>(audioConfig));
|
||||||
settings.setValue(SER_VIDEOCFG, static_cast<int>(videoCodecConfig));
|
settings.setValue(SER_VIDEOCFG, static_cast<int>(videoCodecConfig));
|
||||||
settings.setValue(SER_VIDEODEC, static_cast<int>(videoDecoderSelection));
|
settings.setValue(SER_VIDEODEC, static_cast<int>(videoDecoderSelection));
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ public:
|
|||||||
enum AudioConfig
|
enum AudioConfig
|
||||||
{
|
{
|
||||||
AC_STEREO,
|
AC_STEREO,
|
||||||
AC_51_SURROUND
|
AC_51_SURROUND,
|
||||||
|
AC_71_SURROUND
|
||||||
};
|
};
|
||||||
Q_ENUM(AudioConfig)
|
Q_ENUM(AudioConfig)
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ public:
|
|||||||
Q_PROPERTY(bool unsupportedFps MEMBER unsupportedFps NOTIFY unsupportedFpsChanged)
|
Q_PROPERTY(bool unsupportedFps MEMBER unsupportedFps NOTIFY unsupportedFpsChanged)
|
||||||
Q_PROPERTY(bool enableMdns MEMBER enableMdns NOTIFY enableMdnsChanged)
|
Q_PROPERTY(bool enableMdns MEMBER enableMdns NOTIFY enableMdnsChanged)
|
||||||
Q_PROPERTY(bool quitAppAfter MEMBER quitAppAfter NOTIFY quitAppAfterChanged)
|
Q_PROPERTY(bool quitAppAfter MEMBER quitAppAfter NOTIFY quitAppAfterChanged)
|
||||||
Q_PROPERTY(bool mouseAcceleration MEMBER mouseAcceleration NOTIFY mouseAccelerationChanged)
|
Q_PROPERTY(bool absoluteMouseMode MEMBER absoluteMouseMode NOTIFY absoluteMouseModeChanged)
|
||||||
Q_PROPERTY(bool startWindowed MEMBER startWindowed NOTIFY startWindowedChanged)
|
Q_PROPERTY(bool startWindowed MEMBER startWindowed NOTIFY startWindowedChanged)
|
||||||
Q_PROPERTY(bool framePacing MEMBER framePacing NOTIFY framePacingChanged)
|
Q_PROPERTY(bool framePacing MEMBER framePacing NOTIFY framePacingChanged)
|
||||||
Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged)
|
Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged)
|
||||||
@@ -84,12 +85,13 @@ public:
|
|||||||
bool unsupportedFps;
|
bool unsupportedFps;
|
||||||
bool enableMdns;
|
bool enableMdns;
|
||||||
bool quitAppAfter;
|
bool quitAppAfter;
|
||||||
bool mouseAcceleration;
|
bool absoluteMouseMode;
|
||||||
bool startWindowed;
|
bool startWindowed;
|
||||||
bool framePacing;
|
bool framePacing;
|
||||||
bool connectionWarnings;
|
bool connectionWarnings;
|
||||||
bool richPresence;
|
bool richPresence;
|
||||||
bool gamepadMouse;
|
bool gamepadMouse;
|
||||||
|
int packetSize;
|
||||||
AudioConfig audioConfig;
|
AudioConfig audioConfig;
|
||||||
VideoCodecConfig videoCodecConfig;
|
VideoCodecConfig videoCodecConfig;
|
||||||
VideoDecoderSelection videoDecoderSelection;
|
VideoDecoderSelection videoDecoderSelection;
|
||||||
@@ -106,7 +108,7 @@ signals:
|
|||||||
void unsupportedFpsChanged();
|
void unsupportedFpsChanged();
|
||||||
void enableMdnsChanged();
|
void enableMdnsChanged();
|
||||||
void quitAppAfterChanged();
|
void quitAppAfterChanged();
|
||||||
void mouseAccelerationChanged();
|
void absoluteMouseModeChanged();
|
||||||
void audioConfigChanged();
|
void audioConfigChanged();
|
||||||
void videoCodecConfigChanged();
|
void videoCodecConfigChanged();
|
||||||
void videoDecoderSelectionChanged();
|
void videoDecoderSelectionChanged();
|
||||||
|
|||||||
@@ -80,19 +80,7 @@ int Session::getAudioRendererCapabilities(int audioConfiguration)
|
|||||||
OPUS_MULTISTREAM_CONFIGURATION opusConfig = {};
|
OPUS_MULTISTREAM_CONFIGURATION opusConfig = {};
|
||||||
opusConfig.sampleRate = 48000;
|
opusConfig.sampleRate = 48000;
|
||||||
opusConfig.samplesPerFrame = 240;
|
opusConfig.samplesPerFrame = 240;
|
||||||
|
opusConfig.channelCount = CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(audioConfiguration);
|
||||||
switch (audioConfiguration)
|
|
||||||
{
|
|
||||||
case AUDIO_CONFIGURATION_STEREO:
|
|
||||||
opusConfig.channelCount = 2;
|
|
||||||
break;
|
|
||||||
case AUDIO_CONFIGURATION_51_SURROUND:
|
|
||||||
opusConfig.channelCount = 6;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
SDL_assert(false);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
IAudioRenderer* audioRenderer = createAudioRenderer(&opusConfig);
|
IAudioRenderer* audioRenderer = createAudioRenderer(&opusConfig);
|
||||||
if (audioRenderer == nullptr) {
|
if (audioRenderer == nullptr) {
|
||||||
@@ -113,19 +101,7 @@ bool Session::testAudio(int audioConfiguration)
|
|||||||
OPUS_MULTISTREAM_CONFIGURATION opusConfig = {};
|
OPUS_MULTISTREAM_CONFIGURATION opusConfig = {};
|
||||||
opusConfig.sampleRate = 48000;
|
opusConfig.sampleRate = 48000;
|
||||||
opusConfig.samplesPerFrame = 240;
|
opusConfig.samplesPerFrame = 240;
|
||||||
|
opusConfig.channelCount = CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(audioConfiguration);
|
||||||
switch (audioConfiguration)
|
|
||||||
{
|
|
||||||
case AUDIO_CONFIGURATION_STEREO:
|
|
||||||
opusConfig.channelCount = 2;
|
|
||||||
break;
|
|
||||||
case AUDIO_CONFIGURATION_51_SURROUND:
|
|
||||||
opusConfig.channelCount = 6;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
SDL_assert(false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
IAudioRenderer* audioRenderer = createAudioRenderer(&opusConfig);
|
IAudioRenderer* audioRenderer = createAudioRenderer(&opusConfig);
|
||||||
if (audioRenderer == nullptr) {
|
if (audioRenderer == nullptr) {
|
||||||
@@ -237,7 +213,7 @@ void Session::arDecodeAndPlaySample(char* sampleData, int sampleLength)
|
|||||||
|
|
||||||
// Update desiredSize with the number of bytes actually populated by the decoding operation
|
// Update desiredSize with the number of bytes actually populated by the decoding operation
|
||||||
if (samplesDecoded > 0) {
|
if (samplesDecoded > 0) {
|
||||||
SDL_assert(desiredSize >= sizeof(short) * samplesDecoded * s_ActiveSession->m_AudioConfig.channelCount);
|
SDL_assert(desiredSize >= (int)(sizeof(short) * samplesDecoded * s_ActiveSession->m_AudioConfig.channelCount));
|
||||||
desiredSize = sizeof(short) * samplesDecoded * s_ActiveSession->m_AudioConfig.channelCount;
|
desiredSize = sizeof(short) * samplesDecoded * s_ActiveSession->m_AudioConfig.channelCount;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -4,12 +4,42 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
SdlAudioRenderer::SdlAudioRenderer()
|
SdlAudioRenderer::SdlAudioRenderer()
|
||||||
: m_AudioDevice(0),
|
: m_AudioDevice(0),
|
||||||
m_AudioBuffer(nullptr)
|
m_AudioBuffer(nullptr)
|
||||||
{
|
{
|
||||||
SDL_assert(!SDL_WasInit(SDL_INIT_AUDIO));
|
SDL_assert(!SDL_WasInit(SDL_INIT_AUDIO));
|
||||||
|
|
||||||
|
#ifdef HAVE_MMAL
|
||||||
|
// HACK: PulseAudio on Raspberry Pi suffers from horrible underruns,
|
||||||
|
// so switch to ALSA if we detect that we're on a Pi. We need to
|
||||||
|
// actually set a bogus PULSE_SERVER so it doesn't try to get smart on us
|
||||||
|
// and find PA anyway. SDL_AUDIODRIVER=pulseaudio can override this logic.
|
||||||
|
if (qgetenv("SDL_AUDIODRIVER").toLower() != "pulseaudio") {
|
||||||
|
QFile file("/proc/cpuinfo");
|
||||||
|
if (file.open(QIODevice::ReadOnly | QFile::Text)) {
|
||||||
|
QTextStream textStream(&file);
|
||||||
|
if (textStream.readAll().contains("Raspberry Pi")) {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Avoiding PulseAudio on Raspberry Pi");
|
||||||
|
|
||||||
|
qputenv("PULSE_SERVER", "");
|
||||||
|
if (SDL_InitSubSystem(SDL_INIT_AUDIO) != 0) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"ALSA failed; falling back to default");
|
||||||
|
qunsetenv("PULSE_SERVER");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) != 0) {
|
if (SDL_InitSubSystem(SDL_INIT_AUDIO) != 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"SDL_InitSubSystem(SDL_INIT_AUDIO) failed: %s",
|
"SDL_InitSubSystem(SDL_INIT_AUDIO) failed: %s",
|
||||||
@@ -51,9 +81,9 @@ bool SdlAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION*
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Desired audio buffer: %u samples (%lu bytes)",
|
"Desired audio buffer: %u samples (%u bytes)",
|
||||||
want.samples,
|
want.samples,
|
||||||
want.samples * sizeof(short) * want.channels);
|
want.samples * (Uint32)sizeof(short) * want.channels);
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Obtained audio buffer: %u samples (%u bytes)",
|
"Obtained audio buffer: %u samples (%u bytes)",
|
||||||
|
|||||||
@@ -42,26 +42,26 @@ bool SLAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATION* o
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SWAP_CHANNEL(i, j) \
|
|
||||||
tmp = opusConfig->mapping[i]; \
|
|
||||||
opusConfig->mapping[i] = opusConfig->mapping[j]; \
|
|
||||||
opusConfig->mapping[j] = tmp
|
|
||||||
|
|
||||||
void SLAudioRenderer::remapChannels(POPUS_MULTISTREAM_CONFIGURATION opusConfig) {
|
void SLAudioRenderer::remapChannels(POPUS_MULTISTREAM_CONFIGURATION opusConfig) {
|
||||||
unsigned char tmp;
|
OPUS_MULTISTREAM_CONFIGURATION originalConfig = *opusConfig;
|
||||||
|
|
||||||
if (opusConfig->channelCount == 6) {
|
// The Moonlight's default channel order is FL,FR,C,LFE,RL,RR,SL,SR
|
||||||
// The Moonlight's default channel order is FL,FR,C,LFE,RL,RR
|
// SLAudio expects FL,C,FR,RL,RR,(SL,SR),LFE for 5.1/7.1 so we swap the channels around to match
|
||||||
// SLAudio expects FL,C,FR,RL,RR,LFE so we swap the channels around to match
|
|
||||||
|
|
||||||
// Swap FR and C - now FL,C,FR,LFE,RL,RR
|
if (opusConfig->channelCount == 3 || opusConfig->channelCount >= 6) {
|
||||||
SWAP_CHANNEL(1, 2);
|
// Swap FR and C
|
||||||
|
opusConfig->mapping[1] = originalConfig.mapping[2];
|
||||||
|
opusConfig->mapping[2] = originalConfig.mapping[1];
|
||||||
|
}
|
||||||
|
|
||||||
// Swap LFE and RR - now FL,C,FR,RR,RL,LFE
|
if (opusConfig->channelCount >= 6) {
|
||||||
SWAP_CHANNEL(3, 5);
|
// SLAudio expects the LFE channel at the end
|
||||||
|
opusConfig->mapping[opusConfig->channelCount - 1] = originalConfig.mapping[3];
|
||||||
|
|
||||||
// Swap RR and RL - now FL,C,FR,RL,RR,LFE
|
// Slide the other channels down
|
||||||
SWAP_CHANNEL(3, 4);
|
memcpy(&opusConfig->mapping[3],
|
||||||
|
&originalConfig.mapping[4],
|
||||||
|
opusConfig->channelCount - 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,11 +72,17 @@ int SoundIoAudioRenderer::scoreChannelLayout(const struct SoundIoChannelLayout*
|
|||||||
score++;
|
score++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Score layouts using the back L/R as higher
|
|
||||||
// value than those using side L/R.
|
|
||||||
case SoundIoChannelIdBackLeft:
|
case SoundIoChannelIdBackLeft:
|
||||||
case SoundIoChannelIdBackRight:
|
case SoundIoChannelIdBackRight:
|
||||||
score += 2;
|
if (opusConfig->channelCount == 6) {
|
||||||
|
// Score back channels higher in 5.1 mode to
|
||||||
|
// discourage selection of side channel layouts.
|
||||||
|
score += 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Score back channels normally for 7.1 mode
|
||||||
|
score++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -211,13 +217,25 @@ bool SoundIoAudioRenderer::prepareForPlayback(const OPUS_MULTISTREAM_CONFIGURATI
|
|||||||
|
|
||||||
m_EffectiveLayout = m_OutputStream->layout;
|
m_EffectiveLayout = m_OutputStream->layout;
|
||||||
for (int i = 0; i < m_EffectiveLayout.channel_count; i++) {
|
for (int i = 0; i < m_EffectiveLayout.channel_count; i++) {
|
||||||
// Fixup the layout to use back L/R so our channel position
|
if (opusConfig->channelCount == 6) {
|
||||||
// logic in sioWriteCallback() works.
|
// For 5.1, replace side L/R with back L/R so our channel position
|
||||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideLeft) {
|
// logic in sioWriteCallback() works.
|
||||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackLeft;
|
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideLeft) {
|
||||||
|
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackLeft;
|
||||||
|
}
|
||||||
|
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideRight) {
|
||||||
|
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackRight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideRight) {
|
else if (opusConfig->channelCount == 8) {
|
||||||
m_EffectiveLayout.channels[i] = SoundIoChannelIdBackRight;
|
// For 5.1, replace side L/R with LOC/ROC so our channel position
|
||||||
|
// logic in sioWriteCallback() works.
|
||||||
|
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideLeft) {
|
||||||
|
m_EffectiveLayout.channels[i] = SoundIoChannelIdFrontLeftCenter;
|
||||||
|
}
|
||||||
|
if (m_EffectiveLayout.channels[i] == SoundIoChannelIdSideRight) {
|
||||||
|
m_EffectiveLayout.channels[i] = SoundIoChannelIdFrontRightCenter;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,9 +429,8 @@ void SoundIoAudioRenderer::sioWriteCallback(SoundIoOutStream* stream, int frameC
|
|||||||
|
|
||||||
for (int frame = 0; frame < frameCount; frame++) {
|
for (int frame = 0; frame < frameCount; frame++) {
|
||||||
for (int ch = 0; ch < me->m_EffectiveLayout.channel_count; ch++) {
|
for (int ch = 0; ch < me->m_EffectiveLayout.channel_count; ch++) {
|
||||||
// SoundIoChannelId - 1 happens to match Moonlight's channel layout.
|
// SoundIoChannelId - 1 happens to match Moonlight's channel layout
|
||||||
// For side L/R, this logic depends on us fixing those up
|
// after we've applied our fixups to m_EffectiveLayout for 5.1 and 7.1.
|
||||||
// in m_EffectiveLayout to back L/R.
|
|
||||||
int readPtrChannel = me->m_EffectiveLayout.channels[ch] - 1;
|
int readPtrChannel = me->m_EffectiveLayout.channels[ch] - 1;
|
||||||
|
|
||||||
if (frame >= framesLeft || readPtrChannel >= me->m_OpusChannelCount) {
|
if (frame >= framesLeft || readPtrChannel >= me->m_OpusChannelCount) {
|
||||||
|
|||||||
+246
-186
@@ -3,10 +3,12 @@
|
|||||||
#include "streaming/session.h"
|
#include "streaming/session.h"
|
||||||
#include "settings/mappingmanager.h"
|
#include "settings/mappingmanager.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
#include "streamutils.h"
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
|
||||||
#define VK_0 0x30
|
#define VK_0 0x30
|
||||||
#define VK_A 0x41
|
#define VK_A 0x41
|
||||||
@@ -20,14 +22,17 @@
|
|||||||
|
|
||||||
#define MOUSE_POLLING_INTERVAL 5
|
#define MOUSE_POLLING_INTERVAL 5
|
||||||
|
|
||||||
// How long the mouse button will be pressed for a tap to click gesture
|
// How long the fingers must be stationary to start a right click
|
||||||
#define TAP_BUTTON_RELEASE_DELAY 100
|
#define LONG_PRESS_ACTIVATION_DELAY 650
|
||||||
|
|
||||||
// How long the fingers must be stationary to start a drag
|
// How far the finger can move before it cancels a right click
|
||||||
#define DRAG_ACTIVATION_DELAY 650
|
#define LONG_PRESS_ACTIVATION_DELTA 0.01f
|
||||||
|
|
||||||
// How far the finger can move before it cancels a drag or tap
|
// How long the double tap deadzone stays in effect between touch up and touch down
|
||||||
#define DEAD_ZONE_DELTA 0.1f
|
#define DOUBLE_TAP_DEAD_ZONE_DELAY 250
|
||||||
|
|
||||||
|
// How far the finger can move before it can override the double tap deadzone
|
||||||
|
#define DOUBLE_TAP_DEAD_ZONE_DELTA 0.025f
|
||||||
|
|
||||||
// How long the Start button must be pressed to toggle mouse emulation
|
// How long the Start button must be pressed to toggle mouse emulation
|
||||||
#define MOUSE_EMULATION_LONG_PRESS_TIME 750
|
#define MOUSE_EMULATION_LONG_PRESS_TIME 750
|
||||||
@@ -58,23 +63,20 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
|||||||
m_GamepadMouse(prefs.gamepadMouse),
|
m_GamepadMouse(prefs.gamepadMouse),
|
||||||
m_MouseMoveTimer(0),
|
m_MouseMoveTimer(0),
|
||||||
m_FakeCaptureActive(false),
|
m_FakeCaptureActive(false),
|
||||||
m_LeftButtonReleaseTimer(0),
|
m_LongPressTimer(0),
|
||||||
m_RightButtonReleaseTimer(0),
|
|
||||||
m_DragTimer(0),
|
|
||||||
m_DragButton(0),
|
|
||||||
m_NumFingersDown(0),
|
|
||||||
m_StreamWidth(streamWidth),
|
m_StreamWidth(streamWidth),
|
||||||
m_StreamHeight(streamHeight)
|
m_StreamHeight(streamHeight),
|
||||||
|
m_AbsoluteMouseMode(prefs.absoluteMouseMode)
|
||||||
{
|
{
|
||||||
// Allow gamepad input when the app doesn't have focus
|
// Allow gamepad input when the app doesn't have focus
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||||
|
|
||||||
// If mouse acceleration is enabled, use relative mode warp (which
|
// If absolute mouse mode is enabled, use relative mode warp (which
|
||||||
// is via normal motion events that are influenced by mouse acceleration).
|
// is via normal motion events that are influenced by mouse acceleration).
|
||||||
// Otherwise, we'll use raw input capture which is straight from the device
|
// Otherwise, we'll use raw input capture which is straight from the device
|
||||||
// without modification by the OS.
|
// without modification by the OS.
|
||||||
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
||||||
prefs.mouseAcceleration ? "1" : "0",
|
prefs.absoluteMouseMode ? "1" : "0",
|
||||||
SDL_HINT_OVERRIDE);
|
SDL_HINT_OVERRIDE);
|
||||||
|
|
||||||
#if defined(Q_OS_DARWIN) && !SDL_VERSION_ATLEAST(2, 0, 10)
|
#if defined(Q_OS_DARWIN) && !SDL_VERSION_ATLEAST(2, 0, 10)
|
||||||
@@ -86,6 +88,14 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
|||||||
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_XBOX, "0");
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_XBOX, "0");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
|
// Enabling extended input reports allows rumble to function on Bluetooth PS4
|
||||||
|
// controllers, but breaks DirectInput applications. We will enable it because
|
||||||
|
// it's likely that working rumble is what the user is expecting. If they don't
|
||||||
|
// want this behavior, they can override it with the environment variable.
|
||||||
|
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, "1");
|
||||||
|
#endif
|
||||||
|
|
||||||
// We must initialize joystick explicitly before gamecontroller in order
|
// We must initialize joystick explicitly before gamecontroller in order
|
||||||
// to ensure we receive gamecontroller attach events for gamepads where
|
// to ensure we receive gamecontroller attach events for gamepads where
|
||||||
// SDL doesn't have a built-in mapping. By starting joystick first, we
|
// SDL doesn't have a built-in mapping. By starting joystick first, we
|
||||||
@@ -131,13 +141,23 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
|||||||
m_GamepadMask = getAttachedGamepadMask();
|
m_GamepadMask = getAttachedGamepadMask();
|
||||||
|
|
||||||
SDL_zero(m_GamepadState);
|
SDL_zero(m_GamepadState);
|
||||||
SDL_zero(m_TouchDownEvent);
|
SDL_zero(m_LastTouchDownEvent);
|
||||||
SDL_zero(m_CumulativeDelta);
|
SDL_zero(m_LastTouchUpEvent);
|
||||||
|
|
||||||
SDL_AtomicSet(&m_MouseDeltaX, 0);
|
SDL_AtomicSet(&m_MouseDeltaX, 0);
|
||||||
SDL_AtomicSet(&m_MouseDeltaY, 0);
|
SDL_AtomicSet(&m_MouseDeltaY, 0);
|
||||||
|
|
||||||
m_MouseMoveTimer = SDL_AddTimer(MOUSE_POLLING_INTERVAL, SdlInputHandler::mouseMoveTimerCallback, this);
|
Uint32 pollingInterval = QString(qgetenv("MOUSE_POLLING_INTERVAL")).toUInt();
|
||||||
|
if (pollingInterval == 0) {
|
||||||
|
pollingInterval = MOUSE_POLLING_INTERVAL;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Using custom mouse polling interval: %u ms",
|
||||||
|
pollingInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_MouseMoveTimer = SDL_AddTimer(pollingInterval, SdlInputHandler::mouseMoveTimerCallback, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SdlInputHandler::~SdlInputHandler()
|
SdlInputHandler::~SdlInputHandler()
|
||||||
@@ -158,9 +178,7 @@ SdlInputHandler::~SdlInputHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_RemoveTimer(m_MouseMoveTimer);
|
SDL_RemoveTimer(m_MouseMoveTimer);
|
||||||
SDL_RemoveTimer(m_LeftButtonReleaseTimer);
|
SDL_RemoveTimer(m_LongPressTimer);
|
||||||
SDL_RemoveTimer(m_RightButtonReleaseTimer);
|
|
||||||
SDL_RemoveTimer(m_DragTimer);
|
|
||||||
|
|
||||||
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
#if !SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
|
SDL_QuitSubSystem(SDL_INIT_HAPTIC);
|
||||||
@@ -218,8 +236,8 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check for the unbind combo (Ctrl+Alt+Shift+Z)
|
// Check for the unbind combo (Ctrl+Alt+Shift+Z) unless on EGLFS which has no window manager
|
||||||
else if (event->keysym.sym == SDLK_z) {
|
else if (event->keysym.sym == SDLK_z && QGuiApplication::platformName() != "eglfs") {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected mouse capture toggle combo (SDLK)");
|
"Detected mouse capture toggle combo (SDLK)");
|
||||||
|
|
||||||
@@ -231,7 +249,22 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
raiseAllKeys();
|
raiseAllKeys();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (event->keysym.sym == SDLK_x) {
|
// Check for the mouse mode combo (Ctrl+Alt+Shift+M) unless on EGLFS which has no window manager
|
||||||
|
else if (event->keysym.sym == SDLK_m && QGuiApplication::platformName() != "eglfs") {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Detected mouse mode toggle combo (SDLK)");
|
||||||
|
|
||||||
|
// Uncapture input
|
||||||
|
setCaptureActive(false);
|
||||||
|
|
||||||
|
// Toggle mouse mode
|
||||||
|
m_AbsoluteMouseMode = !m_AbsoluteMouseMode;
|
||||||
|
|
||||||
|
// Recapture input
|
||||||
|
setCaptureActive(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (event->keysym.sym == SDLK_x && QGuiApplication::platformName() != "eglfs") {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected full-screen toggle combo (SDLK)");
|
"Detected full-screen toggle combo (SDLK)");
|
||||||
Session::s_ActiveSession->toggleFullscreen();
|
Session::s_ActiveSession->toggleFullscreen();
|
||||||
@@ -241,6 +274,7 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
raiseAllKeys();
|
raiseAllKeys();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Check for overlay combo (Ctrl+Alt+Shift+S)
|
||||||
else if (event->keysym.sym == SDLK_s) {
|
else if (event->keysym.sym == SDLK_s) {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected stats toggle combo (SDLK)");
|
"Detected stats toggle combo (SDLK)");
|
||||||
@@ -267,7 +301,7 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check for the unbind combo (Ctrl+Alt+Shift+Z)
|
// Check for the unbind combo (Ctrl+Alt+Shift+Z)
|
||||||
else if (event->keysym.scancode == SDL_SCANCODE_Z) {
|
else if (event->keysym.scancode == SDL_SCANCODE_Z && QGuiApplication::platformName() != "eglfs") {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected mouse capture toggle combo (scancode)");
|
"Detected mouse capture toggle combo (scancode)");
|
||||||
|
|
||||||
@@ -279,8 +313,8 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
raiseAllKeys();
|
raiseAllKeys();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Check for the full-screen combo (Ctrl+Alt+Shift+X)
|
// Check for the full-screen combo (Ctrl+Alt+Shift+X) unless on EGLFS which has no window manager
|
||||||
else if (event->keysym.scancode == SDL_SCANCODE_X) {
|
else if (event->keysym.scancode == SDL_SCANCODE_X && QGuiApplication::platformName() != "eglfs") {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected full-screen toggle combo (scancode)");
|
"Detected full-screen toggle combo (scancode)");
|
||||||
Session::s_ActiveSession->toggleFullscreen();
|
Session::s_ActiveSession->toggleFullscreen();
|
||||||
@@ -290,6 +324,21 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
raiseAllKeys();
|
raiseAllKeys();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Check for the mouse mode toggle combo (Ctrl+Alt+Shift+M) unless on EGLFS which has no window manager
|
||||||
|
else if (event->keysym.scancode == SDL_SCANCODE_M && QGuiApplication::platformName() != "eglfs") {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Detected mouse mode toggle combo (scancode)");
|
||||||
|
|
||||||
|
// Uncapture input
|
||||||
|
setCaptureActive(false);
|
||||||
|
|
||||||
|
// Toggle mouse mode
|
||||||
|
m_AbsoluteMouseMode = !m_AbsoluteMouseMode;
|
||||||
|
|
||||||
|
// Recapture input
|
||||||
|
setCaptureActive(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (event->keysym.scancode == SDL_SCANCODE_S) {
|
else if (event->keysym.scancode == SDL_SCANCODE_S) {
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Detected stats toggle combo (scancode)");
|
"Detected stats toggle combo (scancode)");
|
||||||
@@ -305,8 +354,9 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isCaptureActive()) {
|
if (event->repeat) {
|
||||||
// Not capturing
|
// Ignore repeat key down events
|
||||||
|
SDL_assert(event->state == SDL_PRESSED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,6 +371,9 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
if (event->keysym.mod & KMOD_SHIFT) {
|
if (event->keysym.mod & KMOD_SHIFT) {
|
||||||
modifiers |= MODIFIER_SHIFT;
|
modifiers |= MODIFIER_SHIFT;
|
||||||
}
|
}
|
||||||
|
if (event->keysym.mod & KMOD_GUI) {
|
||||||
|
modifiers |= MODIFIER_META;
|
||||||
|
}
|
||||||
|
|
||||||
// Set keycode. We explicitly use scancode here because GFE will try to correct
|
// Set keycode. We explicitly use scancode here because GFE will try to correct
|
||||||
// for AZERTY layouts on the host but it depends on receiving VK_ values matching
|
// for AZERTY layouts on the host but it depends on receiving VK_ values matching
|
||||||
@@ -461,6 +514,16 @@ void SdlInputHandler::handleKeyEvent(SDL_KeyboardEvent* event)
|
|||||||
case SDL_SCANCODE_RALT:
|
case SDL_SCANCODE_RALT:
|
||||||
keyCode = 0xA5;
|
keyCode = 0xA5;
|
||||||
break;
|
break;
|
||||||
|
// Until we can fully capture these on all platforms (without conflicting with
|
||||||
|
// OS-provided shortcuts), we should avoid passing them through to the host.
|
||||||
|
#if 0
|
||||||
|
case SDL_SCANCODE_LGUI:
|
||||||
|
keyCode = 0x5B;
|
||||||
|
break;
|
||||||
|
case SDL_SCANCODE_RGUI:
|
||||||
|
keyCode = 0x5C;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case SDL_SCANCODE_AC_BACK:
|
case SDL_SCANCODE_AC_BACK:
|
||||||
keyCode = 0xA6;
|
keyCode = 0xA6;
|
||||||
break;
|
break;
|
||||||
@@ -544,25 +607,23 @@ void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event)
|
|||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
|
|
||||||
// Capture the mouse again if clicked when unbound.
|
if (event->which == SDL_TOUCH_MOUSEID) {
|
||||||
// We start capture on left button released instead of
|
// Ignore synthetic mouse events
|
||||||
// pressed to avoid sending an errant mouse button released
|
|
||||||
// event to the host when clicking into our window (since
|
|
||||||
// the pressed event was consumed by this code).
|
|
||||||
if (event->button == SDL_BUTTON_LEFT &&
|
|
||||||
event->state == SDL_RELEASED &&
|
|
||||||
!isCaptureActive()) {
|
|
||||||
setCaptureActive(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!isCaptureActive()) {
|
else if (!isCaptureActive()) {
|
||||||
|
if (event->button == SDL_BUTTON_LEFT && event->state == SDL_RELEASED) {
|
||||||
|
// Capture the mouse again if clicked when unbound.
|
||||||
|
// We start capture on left button released instead of
|
||||||
|
// pressed to avoid sending an errant mouse button released
|
||||||
|
// event to the host when clicking into our window (since
|
||||||
|
// the pressed event was consumed by this code).
|
||||||
|
setCaptureActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Not capturing
|
// Not capturing
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (event->which == SDL_TOUCH_MOUSEID) {
|
|
||||||
// Ignore synthetic mouse events
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (event->button)
|
switch (event->button)
|
||||||
{
|
{
|
||||||
@@ -594,7 +655,7 @@ void SdlInputHandler::handleMouseButtonEvent(SDL_MouseButtonEvent* event)
|
|||||||
button);
|
button);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdlInputHandler::handleMouseMotionEvent(SDL_MouseMotionEvent* event)
|
void SdlInputHandler::handleMouseMotionEvent(SDL_Window* window, SDL_MouseMotionEvent* event)
|
||||||
{
|
{
|
||||||
if (!isCaptureActive()) {
|
if (!isCaptureActive()) {
|
||||||
// Not capturing
|
// Not capturing
|
||||||
@@ -605,10 +666,32 @@ void SdlInputHandler::handleMouseMotionEvent(SDL_MouseMotionEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Batch until the next mouse polling window or we'll get awful
|
if (m_AbsoluteMouseMode) {
|
||||||
// input lag everything except GFE 3.14 and 3.15.
|
SDL_Rect src, dst;
|
||||||
SDL_AtomicAdd(&m_MouseDeltaX, event->xrel);
|
|
||||||
SDL_AtomicAdd(&m_MouseDeltaY, event->yrel);
|
src.x = src.y = 0;
|
||||||
|
src.w = m_StreamWidth;
|
||||||
|
src.h = m_StreamHeight;
|
||||||
|
|
||||||
|
dst.x = dst.y = 0;
|
||||||
|
SDL_GetWindowSize(window, &dst.w, &dst.h);
|
||||||
|
|
||||||
|
// Use the stream and window sizes to determine the video region
|
||||||
|
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||||
|
|
||||||
|
// Clamp motion to the video region
|
||||||
|
short x = qMin(qMax(event->x - dst.x, 0), dst.w);
|
||||||
|
short y = qMin(qMax(event->y - dst.y, 0), dst.h);
|
||||||
|
|
||||||
|
// Send the mouse position update
|
||||||
|
LiSendMousePositionEvent(x, y, dst.w, dst.h);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Batch until the next mouse polling window or we'll get awful
|
||||||
|
// input lag everything except GFE 3.14 and 3.15.
|
||||||
|
SDL_AtomicAdd(&m_MouseDeltaX, event->xrel);
|
||||||
|
SDL_AtomicAdd(&m_MouseDeltaY, event->yrel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event)
|
void SdlInputHandler::handleMouseWheelEvent(SDL_MouseWheelEvent* event)
|
||||||
@@ -658,32 +741,11 @@ void SdlInputHandler::sendGamepadState(GamepadState* state)
|
|||||||
state->rsY);
|
state->rsY);
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint32 SdlInputHandler::releaseLeftButtonTimerCallback(Uint32, void*)
|
Uint32 SdlInputHandler::longPressTimerCallback(Uint32, void*)
|
||||||
{
|
{
|
||||||
|
// Raise the left click and start a right click
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||||
return 0;
|
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
||||||
}
|
|
||||||
|
|
||||||
Uint32 SdlInputHandler::releaseRightButtonTimerCallback(Uint32, void*)
|
|
||||||
{
|
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uint32 SdlInputHandler::dragTimerCallback(Uint32, void *param)
|
|
||||||
{
|
|
||||||
auto me = reinterpret_cast<SdlInputHandler*>(param);
|
|
||||||
|
|
||||||
// Check how many fingers are down now to decide
|
|
||||||
// which button to hold down
|
|
||||||
if (me->m_NumFingersDown == 2) {
|
|
||||||
me->m_DragButton = BUTTON_RIGHT;
|
|
||||||
}
|
|
||||||
else if (me->m_NumFingersDown == 1) {
|
|
||||||
me->m_DragButton = BUTTON_LEFT;
|
|
||||||
}
|
|
||||||
|
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, me->m_DragButton);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -950,6 +1012,13 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
|
|||||||
state = &m_GamepadState[i];
|
state = &m_GamepadState[i];
|
||||||
if (m_MultiController) {
|
if (m_MultiController) {
|
||||||
state->index = i;
|
state->index = i;
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 12)
|
||||||
|
// This will change indicators on the controller to show the assigned
|
||||||
|
// player index. For Xbox 360 controllers, that means updating the LED
|
||||||
|
// ring to light up the corresponding quadrant for this player.
|
||||||
|
SDL_GameControllerSetPlayerIndex(controller, state->index);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Always player 1 in single controller mode
|
// Always player 1 in single controller mode
|
||||||
@@ -960,8 +1029,10 @@ void SdlInputHandler::handleControllerDeviceEvent(SDL_ControllerDeviceEvent* eve
|
|||||||
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
state->jsId = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(state->controller));
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
||||||
// Perform a no-op rumble to see if haptics are supported
|
// Perform a tiny rumble to see if haptics are supported.
|
||||||
hapticCaps = SDL_GameControllerRumble(controller, 0, 0, 0) == 0 ?
|
// NB: We cannot use zeros for rumble intensity or SDL will not actually call the JS driver
|
||||||
|
// and we'll get a (potentially false) success value returned.
|
||||||
|
hapticCaps = SDL_GameControllerRumble(controller, 1, 1, 1) == 0 ?
|
||||||
ML_HAPTIC_GC_RUMBLE : 0;
|
ML_HAPTIC_GC_RUMBLE : 0;
|
||||||
#else
|
#else
|
||||||
state->haptic = SDL_HapticOpenFromJoystick(SDL_GameControllerGetJoystick(state->controller));
|
state->haptic = SDL_HapticOpenFromJoystick(SDL_GameControllerGetJoystick(state->controller));
|
||||||
@@ -1148,10 +1219,8 @@ void SdlInputHandler::rumble(unsigned short controllerNumber, unsigned short low
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SdlInputHandler::handleTouchFingerEvent(SDL_TouchFingerEvent* event)
|
void SdlInputHandler::handleTouchFingerEvent(SDL_Window* window, SDL_TouchFingerEvent* event)
|
||||||
{
|
{
|
||||||
int fingerIndex = -1;
|
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 10)
|
#if SDL_VERSION_ATLEAST(2, 0, 10)
|
||||||
if (SDL_GetTouchDeviceType(event->touchId) != SDL_TOUCH_DEVICE_DIRECT) {
|
if (SDL_GetTouchDeviceType(event->touchId) != SDL_TOUCH_DEVICE_DIRECT) {
|
||||||
// Ignore anything that isn't a touchscreen. We may get callbacks
|
// Ignore anything that isn't a touchscreen. We may get callbacks
|
||||||
@@ -1173,128 +1242,74 @@ void SdlInputHandler::handleTouchFingerEvent(SDL_TouchFingerEvent* event)
|
|||||||
// leave the client area during a drag motion.
|
// leave the client area during a drag motion.
|
||||||
// dx and dy are deltas from the last touch event, not the first touch down.
|
// dx and dy are deltas from the last touch event, not the first touch down.
|
||||||
|
|
||||||
// Determine the index of this finger using our list
|
// Ignore touch down events with more than one finger
|
||||||
// of fingers that are currently active on screen.
|
if (event->type == SDL_FINGERDOWN && SDL_GetNumTouchFingers(event->touchId) > 1) {
|
||||||
// This is also required to handle finger up which
|
|
||||||
// where the finger will not be in SDL_GetTouchFinger()
|
|
||||||
// anymore.
|
|
||||||
if (event->type != SDL_FINGERDOWN) {
|
|
||||||
for (int i = 0; i < MAX_FINGERS; i++) {
|
|
||||||
if (event->fingerId == m_TouchDownEvent[i].fingerId) {
|
|
||||||
fingerIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Resolve the new finger by determining the ID of each
|
|
||||||
// finger on the display.
|
|
||||||
int numTouchFingers = SDL_GetNumTouchFingers(event->touchId);
|
|
||||||
for (int i = 0; i < numTouchFingers; i++) {
|
|
||||||
SDL_Finger* finger = SDL_GetTouchFinger(event->touchId, i);
|
|
||||||
SDL_assert(finger != nullptr);
|
|
||||||
if (finger != nullptr) {
|
|
||||||
if (finger->id == event->fingerId) {
|
|
||||||
fingerIndex = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fingerIndex < 0 || fingerIndex >= MAX_FINGERS) {
|
|
||||||
// Too many fingers
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle cursor motion based on the position of the
|
// Ignore touch move and touch up events from the non-primary finger
|
||||||
// primary finger on screen
|
if (event->type != SDL_FINGERDOWN && event->fingerId != m_LastTouchDownEvent.fingerId) {
|
||||||
if (fingerIndex == 0) {
|
return;
|
||||||
// The event x and y values are relative to our window width
|
|
||||||
// and height. However, we want to scale them to be relative
|
|
||||||
// to the host resolution. Fortunately this is easy since we
|
|
||||||
// already have normalized values. We'll just multiply them
|
|
||||||
// by the stream dimensions to get real X and Y values rather
|
|
||||||
// than the client window dimensions.
|
|
||||||
short deltaX = static_cast<short>(event->dx * m_StreamWidth);
|
|
||||||
short deltaY = static_cast<short>(event->dy * m_StreamHeight);
|
|
||||||
if (deltaX != 0 || deltaY != 0) {
|
|
||||||
LiSendMouseMoveEvent(deltaX, deltaY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a drag timer when primary or secondary
|
SDL_Rect src, dst;
|
||||||
// fingers go down
|
int windowWidth, windowHeight;
|
||||||
if (event->type == SDL_FINGERDOWN &&
|
|
||||||
(fingerIndex == 0 || fingerIndex == 1)) {
|
SDL_GetWindowSize(window, &windowWidth, &windowHeight);
|
||||||
SDL_RemoveTimer(m_DragTimer);
|
|
||||||
m_DragTimer = SDL_AddTimer(DRAG_ACTIVATION_DELAY,
|
src.x = src.y = 0;
|
||||||
dragTimerCallback,
|
src.w = m_StreamWidth;
|
||||||
this);
|
src.h = m_StreamHeight;
|
||||||
|
|
||||||
|
dst.x = dst.y = 0;
|
||||||
|
dst.w = windowWidth;
|
||||||
|
dst.h = windowHeight;
|
||||||
|
|
||||||
|
// Use the stream and window sizes to determine the video region
|
||||||
|
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||||
|
|
||||||
|
if (qSqrt(qPow(event->x - m_LastTouchDownEvent.x, 2) + qPow(event->y - m_LastTouchDownEvent.y, 2)) > LONG_PRESS_ACTIVATION_DELTA) {
|
||||||
|
// Moved too far since touch down. Cancel the long press timer.
|
||||||
|
SDL_RemoveTimer(m_LongPressTimer);
|
||||||
|
m_LongPressTimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->type == SDL_FINGERMOTION) {
|
// Don't reposition for finger down events within the deadzone. This makes double-clicking easier.
|
||||||
// Count the total cumulative dx/dy that the finger
|
if (event->type != SDL_FINGERDOWN ||
|
||||||
// has moved.
|
event->timestamp - m_LastTouchUpEvent.timestamp > DOUBLE_TAP_DEAD_ZONE_DELAY ||
|
||||||
m_CumulativeDelta[fingerIndex] += qAbs(event->x);
|
qSqrt(qPow(event->x - m_LastTouchUpEvent.x, 2) + qPow(event->y - m_LastTouchUpEvent.y, 2)) > DOUBLE_TAP_DEAD_ZONE_DELTA) {
|
||||||
m_CumulativeDelta[fingerIndex] += qAbs(event->y);
|
// Scale window-relative events to be video-relative and clamp to video region
|
||||||
|
short x = qMin(qMax((int)(event->x * windowWidth), dst.x), dst.x + dst.w);
|
||||||
|
short y = qMin(qMax((int)(event->y * windowHeight), dst.y), dst.y + dst.h);
|
||||||
|
|
||||||
// If it's outside the deadzone delta, cancel drags and taps
|
// Update the cursor position relative to the video region
|
||||||
if (m_CumulativeDelta[fingerIndex] > DEAD_ZONE_DELTA) {
|
LiSendMousePositionEvent(x - dst.x, y - dst.y, dst.w, dst.h);
|
||||||
SDL_RemoveTimer(m_DragTimer);
|
|
||||||
m_DragTimer = 0;
|
|
||||||
|
|
||||||
// This effectively cancels the tap logic below
|
|
||||||
m_TouchDownEvent[fingerIndex].timestamp = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event->type == SDL_FINGERUP) {
|
|
||||||
// Cancel the drag timer on finger up
|
|
||||||
SDL_RemoveTimer(m_DragTimer);
|
|
||||||
m_DragTimer = 0;
|
|
||||||
|
|
||||||
// Release any drag
|
|
||||||
if (m_DragButton != 0) {
|
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, m_DragButton);
|
|
||||||
m_DragButton = 0;
|
|
||||||
}
|
|
||||||
// 2 finger tap
|
|
||||||
else if (event->timestamp - m_TouchDownEvent[1].timestamp < 250) {
|
|
||||||
// Zero timestamp of the primary finger to ensure we won't
|
|
||||||
// generate a left click if the primary finger comes up soon.
|
|
||||||
m_TouchDownEvent[0].timestamp = 0;
|
|
||||||
|
|
||||||
// Press down the right mouse button
|
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_RIGHT);
|
|
||||||
|
|
||||||
// Queue a timer to release it in 100 ms
|
|
||||||
SDL_RemoveTimer(m_RightButtonReleaseTimer);
|
|
||||||
m_RightButtonReleaseTimer = SDL_AddTimer(TAP_BUTTON_RELEASE_DELAY,
|
|
||||||
releaseRightButtonTimerCallback,
|
|
||||||
nullptr);
|
|
||||||
}
|
|
||||||
// 1 finger tap
|
|
||||||
else if (event->timestamp - m_TouchDownEvent[0].timestamp < 250) {
|
|
||||||
// Press down the left mouse button
|
|
||||||
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
|
||||||
|
|
||||||
// Queue a timer to release it in 100 ms
|
|
||||||
SDL_RemoveTimer(m_LeftButtonReleaseTimer);
|
|
||||||
m_LeftButtonReleaseTimer = SDL_AddTimer(TAP_BUTTON_RELEASE_DELAY,
|
|
||||||
releaseLeftButtonTimerCallback,
|
|
||||||
nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_NumFingersDown = SDL_GetNumTouchFingers(event->touchId);
|
|
||||||
|
|
||||||
if (event->type == SDL_FINGERDOWN) {
|
if (event->type == SDL_FINGERDOWN) {
|
||||||
m_TouchDownEvent[fingerIndex] = *event;
|
m_LastTouchDownEvent = *event;
|
||||||
m_CumulativeDelta[fingerIndex] = 0;
|
|
||||||
|
// Start/restart the long press timer
|
||||||
|
SDL_RemoveTimer(m_LongPressTimer);
|
||||||
|
m_LongPressTimer = SDL_AddTimer(LONG_PRESS_ACTIVATION_DELAY,
|
||||||
|
longPressTimerCallback,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
// Left button down on finger down
|
||||||
|
LiSendMouseButtonEvent(BUTTON_ACTION_PRESS, BUTTON_LEFT);
|
||||||
}
|
}
|
||||||
else if (event->type == SDL_FINGERUP) {
|
else if (event->type == SDL_FINGERUP) {
|
||||||
m_TouchDownEvent[fingerIndex] = {};
|
m_LastTouchUpEvent = *event;
|
||||||
|
|
||||||
|
// Cancel the long press timer
|
||||||
|
SDL_RemoveTimer(m_LongPressTimer);
|
||||||
|
m_LongPressTimer = 0;
|
||||||
|
|
||||||
|
// Left button up on finger up
|
||||||
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT);
|
||||||
|
|
||||||
|
// Raise right button too in case we triggered a long press gesture
|
||||||
|
LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1335,6 +1350,51 @@ void SdlInputHandler::raiseAllKeys()
|
|||||||
m_KeysDown.clear();
|
m_KeysDown.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SdlInputHandler::notifyFocusGained(SDL_Window* window)
|
||||||
|
{
|
||||||
|
// Capture mouse cursor when user actives the window by clicking on
|
||||||
|
// window's client area (borders and title bar excluded).
|
||||||
|
// Without this you would have to click the window twice (once to
|
||||||
|
// activate it, second time to enable capture). With this you need to
|
||||||
|
// click it only once.
|
||||||
|
//
|
||||||
|
// On Linux, the button press event is delivered after the focus gain
|
||||||
|
// so this is not neccessary (and leads to a click sent to the host
|
||||||
|
// when focusing the window by clicking).
|
||||||
|
//
|
||||||
|
// By excluding window's borders and title bar out, lets user still
|
||||||
|
// interact with them without mouse capture kicking in.
|
||||||
|
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
||||||
|
int mouseX, mouseY;
|
||||||
|
Uint32 mouseState = SDL_GetGlobalMouseState(&mouseX, &mouseY);
|
||||||
|
if (mouseState & SDL_BUTTON(SDL_BUTTON_LEFT)) {
|
||||||
|
int x, y, width, height;
|
||||||
|
SDL_GetWindowPosition(window, &x, &y);
|
||||||
|
SDL_GetWindowSize(window, &width, &height);
|
||||||
|
if (mouseX > x && mouseX < x+width && mouseY > y && mouseY < y+height) {
|
||||||
|
setCaptureActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
Q_UNUSED(window);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void SdlInputHandler::notifyFocusLost(SDL_Window* window)
|
||||||
|
{
|
||||||
|
// Release mouse cursor when another window is activated (e.g. by using ALT+TAB).
|
||||||
|
// This lets user to interact with our window's title bar and with the buttons in it.
|
||||||
|
// Doing this while the window is full-screen breaks the transition out of FS
|
||||||
|
// (desktop and exclusive), so we must check for that before releasing mouse capture.
|
||||||
|
if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) && !m_AbsoluteMouseMode) {
|
||||||
|
setCaptureActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Raise all keys that are currently pressed. If we don't do this, certain keys
|
||||||
|
// used in shortcuts that cause focus loss (such as Alt+Tab) may get stuck down.
|
||||||
|
raiseAllKeys();
|
||||||
|
}
|
||||||
|
|
||||||
bool SdlInputHandler::isCaptureActive()
|
bool SdlInputHandler::isCaptureActive()
|
||||||
{
|
{
|
||||||
if (SDL_GetRelativeMouseMode()) {
|
if (SDL_GetRelativeMouseMode()) {
|
||||||
@@ -1348,8 +1408,8 @@ bool SdlInputHandler::isCaptureActive()
|
|||||||
void SdlInputHandler::setCaptureActive(bool active)
|
void SdlInputHandler::setCaptureActive(bool active)
|
||||||
{
|
{
|
||||||
if (active) {
|
if (active) {
|
||||||
// Try to activate SDL's relative mouse mode
|
// If we're in relative mode, try to activate SDL's relative mouse mode
|
||||||
if (SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
|
if (m_AbsoluteMouseMode || SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
|
||||||
// Relative mouse mode didn't work, so we'll use fake capture
|
// Relative mouse mode didn't work, so we'll use fake capture
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
m_FakeCaptureActive = true;
|
m_FakeCaptureActive = true;
|
||||||
|
|||||||
+11
-16
@@ -47,7 +47,7 @@ public:
|
|||||||
|
|
||||||
void handleMouseButtonEvent(SDL_MouseButtonEvent* event);
|
void handleMouseButtonEvent(SDL_MouseButtonEvent* event);
|
||||||
|
|
||||||
void handleMouseMotionEvent(SDL_MouseMotionEvent* event);
|
void handleMouseMotionEvent(SDL_Window* window, SDL_MouseMotionEvent* event);
|
||||||
|
|
||||||
void handleMouseWheelEvent(SDL_MouseWheelEvent* event);
|
void handleMouseWheelEvent(SDL_MouseWheelEvent* event);
|
||||||
|
|
||||||
@@ -61,12 +61,16 @@ public:
|
|||||||
|
|
||||||
void rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor);
|
void rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor);
|
||||||
|
|
||||||
void handleTouchFingerEvent(SDL_TouchFingerEvent* event);
|
void handleTouchFingerEvent(SDL_Window* window, SDL_TouchFingerEvent* event);
|
||||||
|
|
||||||
int getAttachedGamepadMask();
|
int getAttachedGamepadMask();
|
||||||
|
|
||||||
void raiseAllKeys();
|
void raiseAllKeys();
|
||||||
|
|
||||||
|
void notifyFocusGained(SDL_Window* window);
|
||||||
|
|
||||||
|
void notifyFocusLost(SDL_Window* window);
|
||||||
|
|
||||||
bool isCaptureActive();
|
bool isCaptureActive();
|
||||||
|
|
||||||
void setCaptureActive(bool active);
|
void setCaptureActive(bool active);
|
||||||
@@ -81,13 +85,7 @@ private:
|
|||||||
void sendGamepadState(GamepadState* state);
|
void sendGamepadState(GamepadState* state);
|
||||||
|
|
||||||
static
|
static
|
||||||
Uint32 releaseLeftButtonTimerCallback(Uint32 interval, void* param);
|
Uint32 longPressTimerCallback(Uint32 interval, void* param);
|
||||||
|
|
||||||
static
|
|
||||||
Uint32 releaseRightButtonTimerCallback(Uint32 interval, void* param);
|
|
||||||
|
|
||||||
static
|
|
||||||
Uint32 dragTimerCallback(Uint32 interval, void* param);
|
|
||||||
|
|
||||||
static
|
static
|
||||||
Uint32 mouseMoveTimerCallback(Uint32 interval, void* param);
|
Uint32 mouseMoveTimerCallback(Uint32 interval, void* param);
|
||||||
@@ -105,15 +103,12 @@ private:
|
|||||||
QSet<short> m_KeysDown;
|
QSet<short> m_KeysDown;
|
||||||
bool m_FakeCaptureActive;
|
bool m_FakeCaptureActive;
|
||||||
|
|
||||||
SDL_TouchFingerEvent m_TouchDownEvent[MAX_FINGERS];
|
SDL_TouchFingerEvent m_LastTouchDownEvent;
|
||||||
float m_CumulativeDelta[MAX_FINGERS];
|
SDL_TouchFingerEvent m_LastTouchUpEvent;
|
||||||
SDL_TimerID m_LeftButtonReleaseTimer;
|
SDL_TimerID m_LongPressTimer;
|
||||||
SDL_TimerID m_RightButtonReleaseTimer;
|
|
||||||
SDL_TimerID m_DragTimer;
|
|
||||||
char m_DragButton;
|
|
||||||
int m_NumFingersDown;
|
|
||||||
int m_StreamWidth;
|
int m_StreamWidth;
|
||||||
int m_StreamHeight;
|
int m_StreamHeight;
|
||||||
|
bool m_AbsoluteMouseMode;
|
||||||
|
|
||||||
static const int k_ButtonMap[];
|
static const int k_ButtonMap[];
|
||||||
};
|
};
|
||||||
+166
-84
@@ -30,6 +30,8 @@
|
|||||||
#include <QSvgRenderer>
|
#include <QSvgRenderer>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QCursor>
|
||||||
|
|
||||||
CONNECTION_LISTENER_CALLBACKS Session::k_ConnCallbacks = {
|
CONNECTION_LISTENER_CALLBACKS Session::k_ConnCallbacks = {
|
||||||
Session::clStageStarting,
|
Session::clStageStarting,
|
||||||
@@ -37,8 +39,6 @@ CONNECTION_LISTENER_CALLBACKS Session::k_ConnCallbacks = {
|
|||||||
Session::clStageFailed,
|
Session::clStageFailed,
|
||||||
nullptr,
|
nullptr,
|
||||||
Session::clConnectionTerminated,
|
Session::clConnectionTerminated,
|
||||||
nullptr,
|
|
||||||
nullptr,
|
|
||||||
Session::clLogMessage,
|
Session::clLogMessage,
|
||||||
Session::clRumble,
|
Session::clRumble,
|
||||||
Session::clConnectionStatusUpdate
|
Session::clConnectionStatusUpdate
|
||||||
@@ -56,7 +56,7 @@ void Session::clStageStarting(int stage)
|
|||||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::clStageFailed(int stage, long errorCode)
|
void Session::clStageFailed(int stage, int errorCode)
|
||||||
{
|
{
|
||||||
// We know this is called on the same thread as LiStartConnection()
|
// We know this is called on the same thread as LiStartConnection()
|
||||||
// which happens to be the main thread, so it's cool to interact
|
// which happens to be the main thread, so it's cool to interact
|
||||||
@@ -65,7 +65,7 @@ void Session::clStageFailed(int stage, long errorCode)
|
|||||||
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::clConnectionTerminated(long errorCode)
|
void Session::clConnectionTerminated(int errorCode)
|
||||||
{
|
{
|
||||||
// Display the termination dialog if this was not intended
|
// Display the termination dialog if this was not intended
|
||||||
if (errorCode != 0) {
|
if (errorCode != 0) {
|
||||||
@@ -74,7 +74,7 @@ void Session::clConnectionTerminated(long errorCode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Connection terminated: %ld",
|
"Connection terminated: %d",
|
||||||
errorCode);
|
errorCode);
|
||||||
|
|
||||||
// Push a quit event to the main loop
|
// Push a quit event to the main loop
|
||||||
@@ -250,6 +250,25 @@ int Session::drSubmitDecodeUnit(PDECODE_UNIT du)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Session::getDecoderInfo(SDL_Window* window,
|
||||||
|
bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution)
|
||||||
|
{
|
||||||
|
IVideoDecoder* decoder;
|
||||||
|
|
||||||
|
if (!chooseDecoder(StreamingPreferences::VDS_AUTO,
|
||||||
|
window, VIDEO_FORMAT_H264, 1920, 1080, 60,
|
||||||
|
true, false, true, decoder)) {
|
||||||
|
isHardwareAccelerated = isFullScreenOnly = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isHardwareAccelerated = decoder->isHardwareAccelerated();
|
||||||
|
isFullScreenOnly = decoder->isAlwaysFullScreen();
|
||||||
|
maxResolution = decoder->getDecoderMaxResolution();
|
||||||
|
|
||||||
|
delete decoder;
|
||||||
|
}
|
||||||
|
|
||||||
bool Session::isHardwareDecodeAvailable(SDL_Window* window,
|
bool Session::isHardwareDecodeAvailable(SDL_Window* window,
|
||||||
StreamingPreferences::VideoDecoderSelection vds,
|
StreamingPreferences::VideoDecoderSelection vds,
|
||||||
int videoFormat, int width, int height, int frameRate)
|
int videoFormat, int width, int height, int frameRate)
|
||||||
@@ -375,6 +394,9 @@ bool Session::initialize()
|
|||||||
case StreamingPreferences::AC_51_SURROUND:
|
case StreamingPreferences::AC_51_SURROUND:
|
||||||
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_51_SURROUND;
|
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_51_SURROUND;
|
||||||
break;
|
break;
|
||||||
|
case StreamingPreferences::AC_71_SURROUND:
|
||||||
|
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_71_SURROUND;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LiInitializeAudioCallbacks(&m_AudioCallbacks);
|
LiInitializeAudioCallbacks(&m_AudioCallbacks);
|
||||||
@@ -384,8 +406,11 @@ bool Session::initialize()
|
|||||||
m_AudioCallbacks.capabilities = getAudioRendererCapabilities(m_StreamConfig.audioConfiguration);
|
m_AudioCallbacks.capabilities = getAudioRendererCapabilities(m_StreamConfig.audioConfiguration);
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Audio configuration: %d",
|
"Audio channel count: %d",
|
||||||
m_StreamConfig.audioConfiguration);
|
CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration));
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Audio channel mask: %X",
|
||||||
|
CHANNEL_MASK_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration));
|
||||||
|
|
||||||
switch (m_Preferences->videoCodecConfig)
|
switch (m_Preferences->videoCodecConfig)
|
||||||
{
|
{
|
||||||
@@ -441,6 +466,17 @@ bool Session::initialize()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !SDL_VERSION_ATLEAST(2, 0, 11)
|
||||||
|
// HACK: Using a full-screen window breaks mouse capture on the Pi's LXDE
|
||||||
|
// GUI environment. Force the session to use windowed mode (which won't
|
||||||
|
// really matter anyway because the MMAL renderer always draws full-screen).
|
||||||
|
if (qgetenv("DESKTOP_SESSION") == "LXDE-pi") {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Forcing windowed mode on LXDE-Pi");
|
||||||
|
m_FullScreenFlag = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Check for validation errors/warnings and emit
|
// Check for validation errors/warnings and emit
|
||||||
// signals for them, if appropriate
|
// signals for them, if appropriate
|
||||||
bool ret = validateLaunch(testWindow);
|
bool ret = validateLaunch(testWindow);
|
||||||
@@ -481,8 +517,18 @@ bool Session::validateLaunch(SDL_Window* testWindow)
|
|||||||
{
|
{
|
||||||
QStringList warningList;
|
QStringList warningList;
|
||||||
|
|
||||||
|
if (m_Preferences->absoluteMouseMode && !m_App.isAppCollectorGame) {
|
||||||
|
emitLaunchWarning("Your selection to enable remote desktop mouse mode may cause problems in games.");
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Preferences->videoDecoderSelection == StreamingPreferences::VDS_FORCE_SOFTWARE) {
|
if (m_Preferences->videoDecoderSelection == StreamingPreferences::VDS_FORCE_SOFTWARE) {
|
||||||
emitLaunchWarning("Your settings selection to force software decoding may cause poor streaming performance.");
|
if (m_Preferences->videoCodecConfig == StreamingPreferences::VCC_FORCE_HEVC_HDR) {
|
||||||
|
emitLaunchWarning("HDR is not supported with software decoding.");
|
||||||
|
m_StreamConfig.enableHdr = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
emitLaunchWarning("Your settings selection to force software decoding may cause poor streaming performance.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Preferences->unsupportedFps && m_StreamConfig.fps > 60) {
|
if (m_Preferences->unsupportedFps && m_StreamConfig.fps > 60) {
|
||||||
@@ -569,12 +615,12 @@ bool Session::validateLaunch(SDL_Window* testWindow)
|
|||||||
// Test if audio works at the specified audio configuration
|
// Test if audio works at the specified audio configuration
|
||||||
bool audioTestPassed = testAudio(m_StreamConfig.audioConfiguration);
|
bool audioTestPassed = testAudio(m_StreamConfig.audioConfiguration);
|
||||||
|
|
||||||
// Gracefully degrade to stereo if 5.1 doesn't work
|
// Gracefully degrade to stereo if surround sound doesn't work
|
||||||
if (!audioTestPassed && m_StreamConfig.audioConfiguration == AUDIO_CONFIGURATION_51_SURROUND) {
|
if (!audioTestPassed && CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(m_StreamConfig.audioConfiguration) > 2) {
|
||||||
audioTestPassed = testAudio(AUDIO_CONFIGURATION_STEREO);
|
audioTestPassed = testAudio(AUDIO_CONFIGURATION_STEREO);
|
||||||
if (audioTestPassed) {
|
if (audioTestPassed) {
|
||||||
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
m_StreamConfig.audioConfiguration = AUDIO_CONFIGURATION_STEREO;
|
||||||
emitLaunchWarning("5.1 surround sound is not supported by the current audio device.");
|
emitLaunchWarning("Your selected surround sound setting is not supported by the current audio device.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,6 +635,18 @@ bool Session::validateLaunch(SDL_Window* testWindow)
|
|||||||
emitLaunchWarning("An attached gamepad has no mapping and won't be usable. Visit the Moonlight help to resolve this.");
|
emitLaunchWarning("An attached gamepad has no mapping and won't be usable. Visit the Moonlight help to resolve this.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NVENC will fail to initialize when using dimensions over 4096 and H.264.
|
||||||
|
if (m_StreamConfig.width > 4096 || m_StreamConfig.height > 4096) {
|
||||||
|
if (m_Computer->maxLumaPixelsHEVC == 0) {
|
||||||
|
emit displayLaunchError("Your host PC's GPU doesn't support streaming video resolutions over 4K.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (!m_StreamConfig.supportsHevc) {
|
||||||
|
emit displayLaunchError("Video resolutions over 4K are only supported by the HEVC codec.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_Preferences->videoDecoderSelection == StreamingPreferences::VDS_FORCE_HARDWARE &&
|
if (m_Preferences->videoDecoderSelection == StreamingPreferences::VDS_FORCE_HARDWARE &&
|
||||||
!m_StreamConfig.enableHdr && // HEVC Main10 was already checked for hardware decode support above
|
!m_StreamConfig.enableHdr && // HEVC Main10 was already checked for hardware decode support above
|
||||||
!isHardwareDecodeAvailable(testWindow,
|
!isHardwareDecodeAvailable(testWindow,
|
||||||
@@ -809,10 +867,18 @@ void Session::toggleFullscreen()
|
|||||||
bool fullScreen = !(SDL_GetWindowFlags(m_Window) & m_FullScreenFlag);
|
bool fullScreen = !(SDL_GetWindowFlags(m_Window) & m_FullScreenFlag);
|
||||||
|
|
||||||
if (fullScreen) {
|
if (fullScreen) {
|
||||||
|
if (m_FullScreenFlag == SDL_WINDOW_FULLSCREEN) {
|
||||||
|
// Confine the cursor to the window
|
||||||
|
SDL_SetWindowGrab(m_Window, SDL_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_SetWindowResizable(m_Window, SDL_FALSE);
|
SDL_SetWindowResizable(m_Window, SDL_FALSE);
|
||||||
SDL_SetWindowFullscreen(m_Window, m_FullScreenFlag);
|
SDL_SetWindowFullscreen(m_Window, m_FullScreenFlag);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Unconfine the cursor
|
||||||
|
SDL_SetWindowGrab(m_Window, SDL_FALSE);
|
||||||
|
|
||||||
SDL_SetWindowFullscreen(m_Window, 0);
|
SDL_SetWindowFullscreen(m_Window, 0);
|
||||||
SDL_SetWindowResizable(m_Window, SDL_TRUE);
|
SDL_SetWindowResizable(m_Window, SDL_TRUE);
|
||||||
|
|
||||||
@@ -891,6 +957,18 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prefs.fps > 60) {
|
||||||
|
// Using SOPS with FPS values over 60 causes GFE to fall back
|
||||||
|
// to 720p60. On previous GFE versions, we could avoid this by
|
||||||
|
// forcing the FPS value to 60 when launching the stream, but
|
||||||
|
// now on GFE 3.20.3 that seems to trigger some sort of
|
||||||
|
// frame rate limiter that locks the game to 60 FPS.
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Disabling SOPS for %d FPS stream",
|
||||||
|
prefs.fps);
|
||||||
|
enableGameOptimizations = false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
NvHTTP http(m_Computer->activeAddress, m_Computer->serverCert);
|
NvHTTP http(m_Computer->activeAddress, m_Computer->serverCert);
|
||||||
if (m_Computer->currentGameId != 0) {
|
if (m_Computer->currentGameId != 0) {
|
||||||
@@ -934,17 +1012,28 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
hostInfo.serverInfoGfeVersion = siGfeVersion.data();
|
hostInfo.serverInfoGfeVersion = siGfeVersion.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
// isReachableOverVpn() does network I/O, so we only attempt to check
|
if (m_Preferences->packetSize != 0) {
|
||||||
// VPN reachability if we've already contacted the PC successfully
|
// Override default packet size and remote streaming detection
|
||||||
if (m_Computer->isReachableOverVpn()) {
|
// NB: Using STREAM_CFG_AUTO will cap our packet size at 1024 for remote hosts.
|
||||||
// It looks like our route to this PC is over a VPN.
|
m_StreamConfig.streamingRemotely = STREAM_CFG_LOCAL;
|
||||||
// Treat it as remote even if the target address is in RFC 1918 address space.
|
m_StreamConfig.packetSize = m_Preferences->packetSize;
|
||||||
m_StreamConfig.streamingRemotely = STREAM_CFG_REMOTE;
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
m_StreamConfig.packetSize = 1024;
|
"Using custom packet size: %d bytes",
|
||||||
|
m_Preferences->packetSize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_StreamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
// isReachableOverVpn() does network I/O, so we only attempt to check
|
||||||
m_StreamConfig.packetSize = 1392;
|
// VPN reachability if we've already contacted the PC successfully
|
||||||
|
if (m_Computer->isReachableOverVpn()) {
|
||||||
|
// It looks like our route to this PC is over a VPN.
|
||||||
|
// Treat it as remote even if the target address is in RFC 1918 address space.
|
||||||
|
m_StreamConfig.streamingRemotely = STREAM_CFG_REMOTE;
|
||||||
|
m_StreamConfig.packetSize = 1024;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_StreamConfig.streamingRemotely = STREAM_CFG_AUTO;
|
||||||
|
m_StreamConfig.packetSize = 1392;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int err = LiStartConnection(&hostInfo, &m_StreamConfig, &k_ConnCallbacks,
|
int err = LiStartConnection(&hostInfo, &m_StreamConfig, &k_ConnCallbacks,
|
||||||
@@ -968,6 +1057,13 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
getWindowDimensions(x, y, width, height);
|
getWindowDimensions(x, y, width, height);
|
||||||
|
|
||||||
|
#ifdef STEAM_LINK
|
||||||
|
// We need a little delay before creating the window or we will trigger some kind
|
||||||
|
// of graphics driver bug on Steam Link that causes a jagged overlay to appear in
|
||||||
|
// the top right corner randomly.
|
||||||
|
SDL_Delay(500);
|
||||||
|
#endif
|
||||||
|
|
||||||
m_Window = SDL_CreateWindow("Moonlight",
|
m_Window = SDL_CreateWindow("Moonlight",
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
@@ -1022,6 +1118,11 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
SDL_SetWindowResizable(m_Window, SDL_TRUE);
|
SDL_SetWindowResizable(m_Window, SDL_TRUE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (m_FullScreenFlag == SDL_WINDOW_FULLSCREEN) {
|
||||||
|
// Confine the cursor to the window
|
||||||
|
SDL_SetWindowGrab(m_Window, SDL_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
// Update the window display mode based on our current monitor
|
// Update the window display mode based on our current monitor
|
||||||
updateOptimalWindowDisplayMode();
|
updateOptimalWindowDisplayMode();
|
||||||
|
|
||||||
@@ -1029,18 +1130,35 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
SDL_SetWindowFullscreen(m_Window, m_FullScreenFlag);
|
SDL_SetWindowFullscreen(m_Window, m_FullScreenFlag);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_DEBUG
|
bool needsFirstEnterCapture = false;
|
||||||
// Capture the mouse by default on release builds only.
|
|
||||||
// This prevents the mouse from becoming trapped inside
|
// Capture the mouse in relative mode by default on release builds only.
|
||||||
// Moonlight when it's halted at a debug break.
|
// This prevents the mouse from becoming trapped inside Moonlight when
|
||||||
if (m_Preferences->windowMode != StreamingPreferences::WM_WINDOWED) {
|
// it's halted at a debug break.
|
||||||
// HACK: This doesn't work on Wayland until we render a frame, so
|
#ifdef QT_DEBUG
|
||||||
// just don't do it for now.
|
if (prefs.absoluteMouseMode)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
// HACK: For Wayland, we wait until we get the first SDL_WINDOWEVENT_ENTER
|
||||||
|
// event where it seems to work consistently on GNOME. This doesn't work for
|
||||||
|
// XWayland though.
|
||||||
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) {
|
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0) {
|
||||||
m_InputHandler->setCaptureActive(true);
|
// We know we aren't running on native Wayland now, but
|
||||||
|
// we still may be running on XWayland.
|
||||||
|
if (!WMUtils::isRunningWayland()) {
|
||||||
|
// Neither Wayland or XWayland: capture now
|
||||||
|
m_InputHandler->setCaptureActive(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// XWayland: mouse capture doesn't work reliably, so let the user
|
||||||
|
// engage the mouse capture via clicking or using the hotkey.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Native Wayland: Capture on SDL_WINDOWEVENT_ENTER
|
||||||
|
needsFirstEnterCapture = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// Stop text input. SDL enables it by default
|
// Stop text input. SDL enables it by default
|
||||||
// when we initialize the video subsystem, but this
|
// when we initialize the video subsystem, but this
|
||||||
@@ -1051,6 +1169,11 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
// Disable the screen saver
|
// Disable the screen saver
|
||||||
SDL_DisableScreenSaver();
|
SDL_DisableScreenSaver();
|
||||||
|
|
||||||
|
// Hide Qt's fake mouse cursor on EGLFS systems
|
||||||
|
if (QGuiApplication::platformName() == "eglfs") {
|
||||||
|
QGuiApplication::setOverrideCursor(QCursor(Qt::BlankCursor));
|
||||||
|
}
|
||||||
|
|
||||||
// Set timer resolution to 1 ms on Windows for greater
|
// Set timer resolution to 1 ms on Windows for greater
|
||||||
// sleep precision and more accurate callback timing.
|
// sleep precision and more accurate callback timing.
|
||||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1");
|
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "1");
|
||||||
@@ -1096,43 +1219,17 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_WINDOWEVENT:
|
case SDL_WINDOWEVENT:
|
||||||
// Capture mouse cursor when user actives the window by clicking on
|
|
||||||
// window's client area (borders and title bar excluded).
|
|
||||||
// Without this you would have to click the window twice (once to
|
|
||||||
// activate it, second time to enable capture). With this you need to
|
|
||||||
// click it only once.
|
|
||||||
// On Linux, the button press event is delivered after the focus gain
|
|
||||||
// so this is not neccessary (and leads to a click sent to the host
|
|
||||||
// when focusing the window by clicking).
|
|
||||||
// By excluding window's borders and title bar out, lets user still
|
|
||||||
// interact with them without mouse capture kicking in.
|
|
||||||
#if defined(Q_OS_WIN32) || defined(Q_OS_DARWIN)
|
|
||||||
if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
|
if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
|
||||||
int mouseX, mouseY;
|
m_InputHandler->notifyFocusGained(m_Window);
|
||||||
Uint32 mouseState = SDL_GetGlobalMouseState(&mouseX, &mouseY);
|
}
|
||||||
if (mouseState & SDL_BUTTON(SDL_BUTTON_LEFT)) {
|
else if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
|
||||||
int x, y, width, height;
|
m_InputHandler->notifyFocusLost(m_Window);
|
||||||
SDL_GetWindowPosition(m_Window, &x, &y);
|
|
||||||
SDL_GetWindowSize(m_Window, &width, &height);
|
|
||||||
if (mouseX > x && mouseX < x+width && mouseY > y && mouseY < y+height) {
|
|
||||||
m_InputHandler->setCaptureActive(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (event.window.event == SDL_WINDOWEVENT_FOCUS_LOST) {
|
// Capture the mouse on SDL_WINDOWEVENT_ENTER if needed
|
||||||
// Release mouse cursor when another window is activated (e.g. by using ALT+TAB).
|
if (needsFirstEnterCapture && event.window.event == SDL_WINDOWEVENT_ENTER) {
|
||||||
// This lets user to interact with our window's title bar and with the buttons in it.
|
m_InputHandler->setCaptureActive(true);
|
||||||
// Doing this while the window is full-screen breaks the transition out of FS
|
needsFirstEnterCapture = false;
|
||||||
// (desktop and exclusive), so we must check for that before releasing mouse capture.
|
|
||||||
if (!(SDL_GetWindowFlags(m_Window) & SDL_WINDOW_FULLSCREEN)) {
|
|
||||||
m_InputHandler->setCaptureActive(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Raise all keys that are currently pressed. If we don't do this, certain keys
|
|
||||||
// used in shortcuts that cause focus loss (such as Alt+Tab) may get stuck down.
|
|
||||||
m_InputHandler->raiseAllKeys();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We want to recreate the decoder for resizes (full-screen toggles) and the initial shown event.
|
// We want to recreate the decoder for resizes (full-screen toggles) and the initial shown event.
|
||||||
@@ -1230,7 +1327,7 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
m_InputHandler->handleMouseButtonEvent(&event.button);
|
m_InputHandler->handleMouseButtonEvent(&event.button);
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION:
|
||||||
m_InputHandler->handleMouseMotionEvent(&event.motion);
|
m_InputHandler->handleMouseMotionEvent(m_Window, &event.motion);
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEWHEEL:
|
case SDL_MOUSEWHEEL:
|
||||||
m_InputHandler->handleMouseWheelEvent(&event.wheel);
|
m_InputHandler->handleMouseWheelEvent(&event.wheel);
|
||||||
@@ -1252,7 +1349,7 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||||||
case SDL_FINGERDOWN:
|
case SDL_FINGERDOWN:
|
||||||
case SDL_FINGERMOTION:
|
case SDL_FINGERMOTION:
|
||||||
case SDL_FINGERUP:
|
case SDL_FINGERUP:
|
||||||
m_InputHandler->handleTouchFingerEvent(&event.tfinger);
|
m_InputHandler->handleTouchFingerEvent(m_Window, &event.tfinger);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1261,8 +1358,12 @@ DispatchDeferredCleanup:
|
|||||||
// Uncapture the mouse and hide the window immediately,
|
// Uncapture the mouse and hide the window immediately,
|
||||||
// so we can return to the Qt GUI ASAP.
|
// so we can return to the Qt GUI ASAP.
|
||||||
m_InputHandler->setCaptureActive(false);
|
m_InputHandler->setCaptureActive(false);
|
||||||
|
SDL_SetWindowGrab(m_Window, SDL_FALSE);
|
||||||
SDL_EnableScreenSaver();
|
SDL_EnableScreenSaver();
|
||||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "0");
|
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "0");
|
||||||
|
if (QGuiApplication::platformName() == "eglfs") {
|
||||||
|
QGuiApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
// Raise any keys that are still down
|
// Raise any keys that are still down
|
||||||
m_InputHandler->raiseAllKeys();
|
m_InputHandler->raiseAllKeys();
|
||||||
@@ -1282,25 +1383,6 @@ DispatchDeferredCleanup:
|
|||||||
m_VideoDecoder = nullptr;
|
m_VideoDecoder = nullptr;
|
||||||
SDL_AtomicUnlock(&m_DecoderLock);
|
SDL_AtomicUnlock(&m_DecoderLock);
|
||||||
|
|
||||||
if (strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) {
|
|
||||||
// HACK: SDL (as of 2.0.10) has a bug that causes Mutter not to destroy the window
|
|
||||||
// surface when in full-screen unless we render more frames after we request
|
|
||||||
// to exit full-screen. The amount of frames required is variable but 500 ms
|
|
||||||
// of frames seems sufficient in my testing.
|
|
||||||
SDL_SetWindowFullscreen(m_Window, 0);
|
|
||||||
SDL_Renderer* renderer = SDL_CreateRenderer(m_Window, -1, SDL_RENDERER_PRESENTVSYNC);
|
|
||||||
if (renderer != nullptr) {
|
|
||||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
SDL_RenderClear(renderer);
|
|
||||||
SDL_RenderPresent(renderer);
|
|
||||||
SDL_Delay(50);
|
|
||||||
}
|
|
||||||
SDL_DestroyRenderer(renderer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This must be called after the decoder is deleted, because
|
// This must be called after the decoder is deleted, because
|
||||||
// the renderer may want to interact with the window
|
// the renderer may want to interact with the window
|
||||||
SDL_DestroyWindow(m_Window);
|
SDL_DestroyWindow(m_Window);
|
||||||
|
|||||||
+10
-6
@@ -25,9 +25,8 @@ public:
|
|||||||
Q_INVOKABLE void exec(int displayOriginX, int displayOriginY);
|
Q_INVOKABLE void exec(int displayOriginX, int displayOriginY);
|
||||||
|
|
||||||
static
|
static
|
||||||
bool isHardwareDecodeAvailable(SDL_Window* window,
|
void getDecoderInfo(SDL_Window* window,
|
||||||
StreamingPreferences::VideoDecoderSelection vds,
|
bool& isHardwareAccelerated, bool& isFullScreenOnly, QSize& maxResolution);
|
||||||
int videoFormat, int width, int height, int frameRate);
|
|
||||||
|
|
||||||
static Session* get()
|
static Session* get()
|
||||||
{
|
{
|
||||||
@@ -42,7 +41,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void stageStarting(QString stage);
|
void stageStarting(QString stage);
|
||||||
|
|
||||||
void stageFailed(QString stage, long errorCode);
|
void stageFailed(QString stage, int errorCode);
|
||||||
|
|
||||||
void connectionStarted();
|
void connectionStarted();
|
||||||
|
|
||||||
@@ -78,6 +77,11 @@ private:
|
|||||||
|
|
||||||
void updateOptimalWindowDisplayMode();
|
void updateOptimalWindowDisplayMode();
|
||||||
|
|
||||||
|
static
|
||||||
|
bool isHardwareDecodeAvailable(SDL_Window* window,
|
||||||
|
StreamingPreferences::VideoDecoderSelection vds,
|
||||||
|
int videoFormat, int width, int height, int frameRate);
|
||||||
|
|
||||||
static
|
static
|
||||||
bool chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
|
bool chooseDecoder(StreamingPreferences::VideoDecoderSelection vds,
|
||||||
SDL_Window* window, int videoFormat, int width, int height,
|
SDL_Window* window, int videoFormat, int width, int height,
|
||||||
@@ -89,10 +93,10 @@ private:
|
|||||||
void clStageStarting(int stage);
|
void clStageStarting(int stage);
|
||||||
|
|
||||||
static
|
static
|
||||||
void clStageFailed(int stage, long errorCode);
|
void clStageFailed(int stage, int errorCode);
|
||||||
|
|
||||||
static
|
static
|
||||||
void clConnectionTerminated(long errorCode);
|
void clConnectionTerminated(int errorCode);
|
||||||
|
|
||||||
static
|
static
|
||||||
void clLogMessage(const char* format, ...);
|
void clLogMessage(const char* format, ...);
|
||||||
|
|||||||
@@ -12,14 +12,12 @@ void StreamUtils::scaleSourceToDestinationSurface(SDL_Rect* src, SDL_Rect* dst)
|
|||||||
int dstW = dst->h * src->w / src->h;
|
int dstW = dst->h * src->w / src->h;
|
||||||
|
|
||||||
if (dstH > dst->h) {
|
if (dstH > dst->h) {
|
||||||
dst->y = 0;
|
dst->x += (dst->w - dstW) / 2;
|
||||||
dst->x = (dst->w - dstW) / 2;
|
|
||||||
dst->w = dstW;
|
dst->w = dstW;
|
||||||
SDL_assert(dst->w * src->h / src->w <= dst->h);
|
SDL_assert(dst->w * src->h / src->w <= dst->h);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dst->x = 0;
|
dst->y += (dst->h - dstH) / 2;
|
||||||
dst->y = (dst->h - dstH) / 2;
|
|
||||||
dst->h = dstH;
|
dst->h = dstH;
|
||||||
SDL_assert(dst->h * src->w / src->h <= dst->w);
|
SDL_assert(dst->h * src->w / src->h <= dst->w);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,10 @@ public:
|
|||||||
virtual ~IVideoDecoder() {}
|
virtual ~IVideoDecoder() {}
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
|
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
|
||||||
virtual bool isHardwareAccelerated() = 0;
|
virtual bool isHardwareAccelerated() = 0;
|
||||||
|
virtual bool isAlwaysFullScreen() = 0;
|
||||||
virtual int getDecoderCapabilities() = 0;
|
virtual int getDecoderCapabilities() = 0;
|
||||||
virtual int getDecoderColorspace() = 0;
|
virtual int getDecoderColorspace() = 0;
|
||||||
|
virtual QSize getDecoderMaxResolution() = 0;
|
||||||
virtual int submitDecodeUnit(PDECODE_UNIT du) = 0;
|
virtual int submitDecodeUnit(PDECODE_UNIT du) = 0;
|
||||||
virtual void renderFrameOnMainThread() = 0;
|
virtual void renderFrameOnMainThread() = 0;
|
||||||
};
|
};
|
||||||
@@ -28,7 +28,7 @@ bool CUDARenderer::initialize(PDECODER_PARAMETERS)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CUDARenderer::prepareDecoderContext(AVCodecContext* context)
|
bool CUDARenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||||
{
|
{
|
||||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public:
|
|||||||
CUDARenderer();
|
CUDARenderer();
|
||||||
virtual ~CUDARenderer() override;
|
virtual ~CUDARenderer() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS) override;
|
virtual bool initialize(PDECODER_PARAMETERS) override;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||||
virtual void renderFrame(AVFrame* frame) override;
|
virtual void renderFrame(AVFrame* frame) override;
|
||||||
virtual bool needsTestFrame() override;
|
virtual bool needsTestFrame() override;
|
||||||
virtual bool isDirectRenderingSupported() override;
|
virtual bool isDirectRenderingSupported() override;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ DrmRenderer::~DrmRenderer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DrmRenderer::prepareDecoderContext(AVCodecContext*)
|
bool DrmRenderer::prepareDecoderContext(AVCodecContext*, AVDictionary**)
|
||||||
{
|
{
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
|
|
||||||
@@ -194,6 +194,12 @@ enum AVPixelFormat DrmRenderer::getPreferredPixelFormat(int)
|
|||||||
return AV_PIX_FMT_DRM_PRIME;
|
return AV_PIX_FMT_DRM_PRIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DrmRenderer::getRendererAttributes()
|
||||||
|
{
|
||||||
|
// This renderer can only draw in full-screen
|
||||||
|
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
void DrmRenderer::renderFrame(AVFrame* frame)
|
void DrmRenderer::renderFrame(AVFrame* frame)
|
||||||
{
|
{
|
||||||
AVDRMFrameDescriptor* drmFrame = (AVDRMFrameDescriptor*)frame->data[0];
|
AVDRMFrameDescriptor* drmFrame = (AVDRMFrameDescriptor*)frame->data[0];
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ public:
|
|||||||
DrmRenderer();
|
DrmRenderer();
|
||||||
virtual ~DrmRenderer() override;
|
virtual ~DrmRenderer() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||||
virtual void renderFrame(AVFrame* frame) override;
|
virtual void renderFrame(AVFrame* frame) override;
|
||||||
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override;
|
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override;
|
||||||
|
virtual int getRendererAttributes() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_DrmFd;
|
int m_DrmFd;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ AVBufferRef* DXVA2Renderer::ffPoolAlloc(void* opaque, int)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DXVA2Renderer::prepareDecoderContext(AVCodecContext* context)
|
bool DXVA2Renderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||||
{
|
{
|
||||||
// m_DXVAContext.workaround and report_id already initialized elsewhere
|
// m_DXVAContext.workaround and report_id already initialized elsewhere
|
||||||
m_DXVAContext.decoder = m_Decoder;
|
m_DXVAContext.decoder = m_Decoder;
|
||||||
@@ -546,14 +546,34 @@ bool DXVA2Renderer::initializeDevice(SDL_Window* window, bool enableVsync)
|
|||||||
d3dpp.hDeviceWindow = info.info.win.window;
|
d3dpp.hDeviceWindow = info.info.win.window;
|
||||||
d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
|
d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
|
||||||
|
|
||||||
|
if (m_VideoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
||||||
|
// Verify 10-bit A2R10G10B10 color support. This is only available
|
||||||
|
// as a display format in full-screen exclusive mode on DX9.
|
||||||
|
hr = d3d9ex->CheckDeviceType(adapterIndex,
|
||||||
|
D3DDEVTYPE_HAL,
|
||||||
|
D3DFMT_A2R10G10B10,
|
||||||
|
D3DFMT_A2R10G10B10,
|
||||||
|
FALSE);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"GPU/driver doesn't support A2R10G10B10");
|
||||||
|
d3d9ex->Release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((windowFlags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
|
if ((windowFlags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN) {
|
||||||
d3dpp.Windowed = false;
|
d3dpp.Windowed = false;
|
||||||
d3dpp.BackBufferWidth = currentMode.Width;
|
d3dpp.BackBufferWidth = currentMode.Width;
|
||||||
d3dpp.BackBufferHeight = currentMode.Height;
|
d3dpp.BackBufferHeight = currentMode.Height;
|
||||||
d3dpp.FullScreen_RefreshRateInHz = currentMode.RefreshRate;
|
d3dpp.FullScreen_RefreshRateInHz = currentMode.RefreshRate;
|
||||||
|
|
||||||
// TODO: Need to select 10-bit color format for HDR
|
if (m_VideoFormat == VIDEO_FORMAT_H265_MAIN10) {
|
||||||
d3dpp.BackBufferFormat = currentMode.Format;
|
d3dpp.BackBufferFormat = currentMode.Format = D3DFMT_A2R10G10B10;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
d3dpp.BackBufferFormat = currentMode.Format;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
d3dpp.Windowed = true;
|
d3dpp.Windowed = true;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
DXVA2Renderer();
|
DXVA2Renderer();
|
||||||
virtual ~DXVA2Renderer() override;
|
virtual ~DXVA2Renderer() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||||
virtual void renderFrame(AVFrame* frame) override;
|
virtual void renderFrame(AVFrame* frame) override;
|
||||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
||||||
virtual int getDecoderColorspace() override;
|
virtual int getDecoderColorspace() override;
|
||||||
|
|||||||
@@ -22,9 +22,16 @@ MmalRenderer::~MmalRenderer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MmalRenderer::prepareDecoderContext(AVCodecContext*)
|
bool MmalRenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary** options)
|
||||||
{
|
{
|
||||||
/* Nothing to do */
|
// FFmpeg defaults this to 10 which is too large to fit in the default 64 MB VRAM split.
|
||||||
|
// Reducing to 2 seems to work fine for our bitstreams (max of 1 buffered frame needed).
|
||||||
|
av_dict_set_int(options, "extra_buffers", 2, 0);
|
||||||
|
|
||||||
|
// MMAL seems to dislike certain initial width and height values, but it seems okay
|
||||||
|
// with getting zero for the width and height. We'll zero them all the time to be safe.
|
||||||
|
context->width = 0;
|
||||||
|
context->height = 0;
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Using MMAL renderer");
|
"Using MMAL renderer");
|
||||||
@@ -82,7 +89,7 @@ bool MmalRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
dr.alpha = 255;
|
dr.alpha = 255;
|
||||||
|
|
||||||
dr.set |= MMAL_DISPLAY_SET_FULLSCREEN;
|
dr.set |= MMAL_DISPLAY_SET_FULLSCREEN;
|
||||||
dr.fullscreen = (SDL_GetWindowFlags(params->window) & SDL_WINDOW_FULLSCREEN) != 0;
|
dr.fullscreen = true;
|
||||||
|
|
||||||
{
|
{
|
||||||
SDL_Rect src, dst;
|
SDL_Rect src, dst;
|
||||||
@@ -125,6 +132,12 @@ enum AVPixelFormat MmalRenderer::getPreferredPixelFormat(int videoFormat)
|
|||||||
return AV_PIX_FMT_MMAL;
|
return AV_PIX_FMT_MMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MmalRenderer::getRendererAttributes()
|
||||||
|
{
|
||||||
|
// This renderer can only draw in full-screen and maxes out at 1080p
|
||||||
|
return RENDERER_ATTRIBUTE_FULLSCREEN_ONLY | RENDERER_ATTRIBUTE_1080P_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
bool MmalRenderer::needsTestFrame()
|
bool MmalRenderer::needsTestFrame()
|
||||||
{
|
{
|
||||||
// We won't be able to decode if the GPU memory is 64 MB or lower,
|
// We won't be able to decode if the GPU memory is 64 MB or lower,
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ public:
|
|||||||
MmalRenderer();
|
MmalRenderer();
|
||||||
virtual ~MmalRenderer() override;
|
virtual ~MmalRenderer() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||||
virtual void renderFrame(AVFrame* frame) override;
|
virtual void renderFrame(AVFrame* frame) override;
|
||||||
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override;
|
virtual enum AVPixelFormat getPreferredPixelFormat(int videoFormat) override;
|
||||||
virtual bool needsTestFrame() override;
|
virtual bool needsTestFrame() override;
|
||||||
|
virtual int getRendererAttributes() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void InputPortCallback(MMAL_PORT_T* port, MMAL_BUFFER_HEADER_T* buffer);
|
static void InputPortCallback(MMAL_PORT_T* port, MMAL_BUFFER_HEADER_T* buffer);
|
||||||
|
|||||||
@@ -9,16 +9,13 @@ extern "C" {
|
|||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define RENDERER_ATTRIBUTE_FULLSCREEN_ONLY 0x01
|
||||||
|
#define RENDERER_ATTRIBUTE_1080P_MAX 0x02
|
||||||
|
|
||||||
class IFFmpegRenderer : public Overlay::IOverlayRenderer {
|
class IFFmpegRenderer : public Overlay::IOverlayRenderer {
|
||||||
public:
|
public:
|
||||||
enum FramePacingConstraint {
|
|
||||||
PACING_FORCE_OFF,
|
|
||||||
PACING_FORCE_ON,
|
|
||||||
PACING_ANY
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
|
virtual bool initialize(PDECODER_PARAMETERS params) = 0;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) = 0;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) = 0;
|
||||||
virtual void renderFrame(AVFrame* frame) = 0;
|
virtual void renderFrame(AVFrame* frame) = 0;
|
||||||
|
|
||||||
virtual bool needsTestFrame() {
|
virtual bool needsTestFrame() {
|
||||||
@@ -31,16 +28,16 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual int getRendererAttributes() {
|
||||||
|
// No special attributes by default
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int getDecoderColorspace() {
|
virtual int getDecoderColorspace() {
|
||||||
// Rec 601 is default
|
// Rec 601 is default
|
||||||
return COLORSPACE_REC_601;
|
return COLORSPACE_REC_601;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual FramePacingConstraint getFramePacingConstraint() {
|
|
||||||
// No pacing preference
|
|
||||||
return PACING_ANY;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool isRenderThreadSupported() {
|
virtual bool isRenderThreadSupported() {
|
||||||
// Render thread is supported by default
|
// Render thread is supported by default
|
||||||
return true;
|
return true;
|
||||||
@@ -62,6 +59,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) {
|
||||||
|
// By default, we only support the preferred pixel format
|
||||||
|
return getPreferredPixelFormat(videoFormat) == pixelFormat;
|
||||||
|
}
|
||||||
|
|
||||||
// IOverlayRenderer
|
// IOverlayRenderer
|
||||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override {
|
virtual void notifyOverlayUpdated(Overlay::OverlayType) override {
|
||||||
// Nothing
|
// Nothing
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "sdlvid.h"
|
#include "sdlvid.h"
|
||||||
|
|
||||||
#include "streaming/session.h"
|
#include "streaming/session.h"
|
||||||
|
#include "streaming/streamutils.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -58,7 +59,7 @@ SdlRenderer::~SdlRenderer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SdlRenderer::prepareDecoderContext(AVCodecContext*)
|
bool SdlRenderer::prepareDecoderContext(AVCodecContext*, AVDictionary**)
|
||||||
{
|
{
|
||||||
/* Nothing to do */
|
/* Nothing to do */
|
||||||
|
|
||||||
@@ -127,14 +128,19 @@ bool SdlRenderer::isRenderThreadSupported()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SdlRenderer::getDecoderCapabilities()
|
bool SdlRenderer::isPixelFormatSupported(int, AVPixelFormat pixelFormat)
|
||||||
{
|
{
|
||||||
// Slice up to 4 times for parallel decode, once slice per core
|
// Remember to keep this in sync with SdlRenderer::renderFrame()!
|
||||||
int slices = qMin(MAX_SLICES, SDL_GetCPUCount());
|
switch (pixelFormat)
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
{
|
||||||
"Encoder configured for %d slices per frame",
|
case AV_PIX_FMT_YUV420P:
|
||||||
slices);
|
case AV_PIX_FMT_NV12:
|
||||||
return CAPABILITY_SLICES_PER_FRAME(slices);
|
case AV_PIX_FMT_NV21:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
||||||
@@ -171,9 +177,18 @@ bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The window may be smaller than the stream size, so ensure our
|
// Calculate the video region size, scaling to fill the window while
|
||||||
// logical rendering surface size is equal to the stream size
|
// preserving the aspect ratio of the video stream.
|
||||||
SDL_RenderSetLogicalSize(m_Renderer, params->width, params->height);
|
SDL_Rect src, dst;
|
||||||
|
src.x = src.y = 0;
|
||||||
|
src.w = params->width;
|
||||||
|
src.h = params->height;
|
||||||
|
dst.x = dst.y = 0;
|
||||||
|
SDL_GetWindowSize(params->window, &dst.w, &dst.h);
|
||||||
|
StreamUtils::scaleSourceToDestinationSurface(&src, &dst);
|
||||||
|
|
||||||
|
// Ensure the viewport is set to the desired video region
|
||||||
|
SDL_RenderSetViewport(m_Renderer, &dst);
|
||||||
|
|
||||||
// Draw a black frame until the video stream starts rendering
|
// Draw a black frame until the video stream starts rendering
|
||||||
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
SDL_SetRenderDrawColor(m_Renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
|
||||||
@@ -281,6 +296,7 @@ void SdlRenderer::renderFrame(AVFrame* frame)
|
|||||||
if (m_Texture == nullptr) {
|
if (m_Texture == nullptr) {
|
||||||
Uint32 sdlFormat;
|
Uint32 sdlFormat;
|
||||||
|
|
||||||
|
// Remember to keep this in sync with SdlRenderer::isPixelFormatSupported()!
|
||||||
switch (frame->format)
|
switch (frame->format)
|
||||||
{
|
{
|
||||||
case AV_PIX_FMT_YUV420P:
|
case AV_PIX_FMT_YUV420P:
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ public:
|
|||||||
SdlRenderer();
|
SdlRenderer();
|
||||||
virtual ~SdlRenderer() override;
|
virtual ~SdlRenderer() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||||
virtual void renderFrame(AVFrame* frame) override;
|
virtual void renderFrame(AVFrame* frame) override;
|
||||||
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
virtual void notifyOverlayUpdated(Overlay::OverlayType) override;
|
||||||
virtual bool isRenderThreadSupported() override;
|
virtual bool isRenderThreadSupported() override;
|
||||||
virtual int getDecoderCapabilities() override;
|
virtual bool isPixelFormatSupported(int videoFormat, enum AVPixelFormat pixelFormat) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void renderOverlay(Overlay::OverlayType type);
|
void renderOverlay(Overlay::OverlayType type);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "vaapi.h"
|
#include "vaapi.h"
|
||||||
|
#include "utils.h"
|
||||||
#include <streaming/streamutils.h>
|
#include <streaming/streamutils.h>
|
||||||
|
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
@@ -10,7 +11,8 @@
|
|||||||
|
|
||||||
VAAPIRenderer::VAAPIRenderer()
|
VAAPIRenderer::VAAPIRenderer()
|
||||||
: m_HwContext(nullptr),
|
: m_HwContext(nullptr),
|
||||||
m_DrmFd(-1)
|
m_DrmFd(-1),
|
||||||
|
m_BlacklistedForDirectRendering(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -36,26 +38,139 @@ VAAPIRenderer::~VAAPIRenderer()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
VAAPIRenderer::validateDriver(VADisplay display)
|
||||||
|
{
|
||||||
|
const char* vendorString = vaQueryVendorString(display);
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Validating VAAPI driver: %s",
|
||||||
|
vendorString ? vendorString : "<unknown>");
|
||||||
|
|
||||||
|
if (isDirectRenderingSupported()) {
|
||||||
|
int entrypointCount;
|
||||||
|
VAEntrypoint entrypoints[vaMaxNumEntrypoints(display)];
|
||||||
|
VAStatus status = vaQueryConfigEntrypoints(display, VAProfileNone, entrypoints, &entrypointCount);
|
||||||
|
if (status == VA_STATUS_SUCCESS) {
|
||||||
|
for (int i = 0; i < entrypointCount; i++) {
|
||||||
|
// Without VAEntrypointVideoProc support, the driver will crash inside vaPutSurface()
|
||||||
|
if (entrypoints[i] == VAEntrypointVideoProc) {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"VAEntrypointVideoProc is supported");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"VAAPI driver doesn't support VAEntrypointVideoProc!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Indirect rendering can use any driver
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VADisplay
|
||||||
|
VAAPIRenderer::openDisplay(SDL_Window* window)
|
||||||
|
{
|
||||||
|
SDL_SysWMinfo info;
|
||||||
|
VADisplay display;
|
||||||
|
|
||||||
|
SDL_VERSION(&info.version);
|
||||||
|
|
||||||
|
if (!SDL_GetWindowWMInfo(window, &info)) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"SDL_GetWindowWMInfo() failed: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_WindowSystem = info.subsystem;
|
||||||
|
if (info.subsystem == SDL_SYSWM_X11) {
|
||||||
|
m_XWindow = info.info.x11.window;
|
||||||
|
#ifdef HAVE_LIBVA_X11
|
||||||
|
display = vaGetDisplay(info.info.x11.display);
|
||||||
|
if (display == nullptr) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Unable to open X11 display for VAAPI");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Moonlight not compiled with VAAPI X11 support!");
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (info.subsystem == SDL_SYSWM_WAYLAND) {
|
||||||
|
#ifdef HAVE_LIBVA_WAYLAND
|
||||||
|
display = vaGetDisplayWl(info.info.wl.display);
|
||||||
|
if (display == nullptr) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Unable to open Wayland display for VAAPI");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Moonlight not compiled with VAAPI Wayland support!");
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
// TODO: Upstream a better solution for SDL_GetWindowWMInfo on KMSDRM
|
||||||
|
else if (strcmp(SDL_GetCurrentVideoDriver(), "KMSDRM") == 0) {
|
||||||
|
#ifdef HAVE_LIBVA_DRM
|
||||||
|
if (m_DrmFd < 0) {
|
||||||
|
const char* device = SDL_getenv("DRM_DEV");
|
||||||
|
|
||||||
|
if (device == nullptr) {
|
||||||
|
device = "/dev/dri/card0";
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Opening DRM device: %s",
|
||||||
|
device);
|
||||||
|
|
||||||
|
m_DrmFd = open(device, O_RDWR | O_CLOEXEC);
|
||||||
|
if (m_DrmFd < 0) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Failed to open DRM device: %d",
|
||||||
|
errno);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
display = vaGetDisplayDRM(m_DrmFd);
|
||||||
|
if (display == nullptr) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Unable to open DRM display for VAAPI");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Moonlight not compiled with VAAPI DRM support!");
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Unsupported VAAPI rendering subsystem: %d",
|
||||||
|
info.subsystem);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return display;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
SDL_SysWMinfo info;
|
|
||||||
|
|
||||||
m_VideoWidth = params->width;
|
m_VideoWidth = params->width;
|
||||||
m_VideoHeight = params->height;
|
m_VideoHeight = params->height;
|
||||||
|
|
||||||
SDL_GetWindowSize(params->window, &m_DisplayWidth, &m_DisplayHeight);
|
SDL_GetWindowSize(params->window, &m_DisplayWidth, &m_DisplayHeight);
|
||||||
|
|
||||||
SDL_VERSION(&info.version);
|
|
||||||
|
|
||||||
if (!SDL_GetWindowWMInfo(params->window, &info)) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"SDL_GetWindowWMInfo() failed: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_HwContext = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
|
m_HwContext = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
|
||||||
if (!m_HwContext) {
|
if (!m_HwContext) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
@@ -66,79 +181,113 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
AVHWDeviceContext* deviceContext = (AVHWDeviceContext*)m_HwContext->data;
|
||||||
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
AVVAAPIDeviceContext* vaDeviceContext = (AVVAAPIDeviceContext*)deviceContext->hwctx;
|
||||||
|
|
||||||
m_WindowSystem = info.subsystem;
|
vaDeviceContext->display = openDisplay(params->window);
|
||||||
if (info.subsystem == SDL_SYSWM_X11) {
|
if (vaDeviceContext->display == nullptr) {
|
||||||
#ifdef HAVE_LIBVA_X11
|
// openDisplay() logs the error
|
||||||
m_XWindow = info.info.x11.window;
|
|
||||||
vaDeviceContext->display = vaGetDisplay(info.info.x11.display);
|
|
||||||
if (!vaDeviceContext->display) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Unable to open X11 display for VAAPI");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Moonlight not compiled with VAAPI X11 support!");
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else if (info.subsystem == SDL_SYSWM_WAYLAND) {
|
|
||||||
#ifdef HAVE_LIBVA_WAYLAND
|
|
||||||
vaDeviceContext->display = vaGetDisplayWl(info.info.wl.display);
|
|
||||||
if (!vaDeviceContext->display) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Unable to open Wayland display for VAAPI");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Moonlight not compiled with VAAPI Wayland support!");
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
// TODO: Upstream a better solution for SDL_GetWindowWMInfo on KMSDRM
|
|
||||||
else if (strcmp(SDL_GetCurrentVideoDriver(), "KMSDRM") == 0) {
|
|
||||||
#ifdef HAVE_LIBVA_DRM
|
|
||||||
const char* device = SDL_getenv("DRM_DEV");
|
|
||||||
|
|
||||||
if (device == nullptr) {
|
|
||||||
device = "/dev/dri/card0";
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Opening DRM device: %s",
|
|
||||||
device);
|
|
||||||
|
|
||||||
m_DrmFd = open(device, O_RDWR | O_CLOEXEC);
|
|
||||||
if (m_DrmFd < 0) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Failed to open DRM device: %d",
|
|
||||||
errno);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
vaDeviceContext->display = vaGetDisplayDRM(m_DrmFd);
|
|
||||||
if (!vaDeviceContext->display) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Unable to open DRM display for VAAPI");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Moonlight not compiled with VAAPI DRM support!");
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Unsupported VAAPI rendering subsystem: %d",
|
|
||||||
info.subsystem);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int major, minor;
|
int major, minor;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
bool setPathVar = false;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||||
|
if (status == VA_STATUS_SUCCESS && !validateDriver(vaDeviceContext->display)) {
|
||||||
|
vaTerminate(vaDeviceContext->display);
|
||||||
|
vaDeviceContext->display = openDisplay(params->window);
|
||||||
|
status = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
|
||||||
|
}
|
||||||
|
if (status != VA_STATUS_SUCCESS && qEnvironmentVariableIsEmpty("LIBVA_DRIVER_NAME")) {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Trying fallback VAAPI driver names");
|
||||||
|
|
||||||
|
// It would be nice to use vaSetDriverName() here, but there's no way to unset
|
||||||
|
// it and get back to the default driver selection logic once we've overridden
|
||||||
|
// the driver name using that API. As a result, we must use LIBVA_DRIVER_NAME.
|
||||||
|
|
||||||
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
|
// The iHD driver supports newer hardware like Ice Lake and Comet Lake.
|
||||||
|
// It should be picked by default on those platforms, but that doesn't
|
||||||
|
// always seem to be the case for some reason.
|
||||||
|
qputenv("LIBVA_DRIVER_NAME", "iHD");
|
||||||
|
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||||
|
if (status == VA_STATUS_SUCCESS && !validateDriver(vaDeviceContext->display)) {
|
||||||
|
vaTerminate(vaDeviceContext->display);
|
||||||
|
vaDeviceContext->display = openDisplay(params->window);
|
||||||
|
status = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
|
// The Iris driver in Mesa 20.0 returns a bogus VA driver (iris_drv_video.so)
|
||||||
|
// even though the correct driver is still i965. If we hit this path, we'll
|
||||||
|
// explicitly try i965 to handle this case.
|
||||||
|
qputenv("LIBVA_DRIVER_NAME", "i965");
|
||||||
|
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||||
|
if (status == VA_STATUS_SUCCESS && !validateDriver(vaDeviceContext->display)) {
|
||||||
|
vaTerminate(vaDeviceContext->display);
|
||||||
|
vaDeviceContext->display = openDisplay(params->window);
|
||||||
|
status = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
|
// The RadeonSI driver is compatible with XWayland but can't be detected by libva
|
||||||
|
// so try it too if all else fails.
|
||||||
|
qputenv("LIBVA_DRIVER_NAME", "radeonsi");
|
||||||
|
status = vaInitialize(vaDeviceContext->display, &major, &minor);
|
||||||
|
if (status == VA_STATUS_SUCCESS && !validateDriver(vaDeviceContext->display)) {
|
||||||
|
vaTerminate(vaDeviceContext->display);
|
||||||
|
vaDeviceContext->display = openDisplay(params->window);
|
||||||
|
status = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
|
// Unset LIBVA_DRIVER_NAME if none of the drivers we tried worked. This ensures
|
||||||
|
// we will get a fresh start using the default driver selection behavior after
|
||||||
|
// setting LIBVA_DRIVERS_PATH in the code below.
|
||||||
|
qunsetenv("LIBVA_DRIVER_NAME");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == VA_STATUS_SUCCESS) {
|
||||||
|
// Success!
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (qEnvironmentVariableIsEmpty("LIBVA_DRIVERS_PATH")) {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Trying fallback VAAPI driver paths");
|
||||||
|
|
||||||
|
qputenv("LIBVA_DRIVERS_PATH",
|
||||||
|
#if Q_PROCESSOR_WORDSIZE == 8
|
||||||
|
"/usr/lib64/dri:" // Fedora x86_64
|
||||||
|
"/usr/lib64/va/drivers:" // Gentoo x86_64
|
||||||
|
#endif
|
||||||
|
"/usr/lib/dri:" // Arch i386 & x86_64, Fedora i386
|
||||||
|
"/usr/lib/va/drivers:" // Gentoo i386
|
||||||
|
#if defined(Q_PROCESSOR_X86_64)
|
||||||
|
"/usr/lib/x86_64-linux-gnu/dri:" // Ubuntu/Debian x86_64
|
||||||
|
#elif defined(Q_PROCESSOR_X86_32)
|
||||||
|
"/usr/lib/i386-linux-gnu/dri:" // Ubuntu/Debian i386
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
setPathVar = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (setPathVar) {
|
||||||
|
// Unset LIBVA_DRIVERS_PATH if we set it ourselves
|
||||||
|
// and we didn't find any working VAAPI drivers.
|
||||||
|
qunsetenv("LIBVA_DRIVERS_PATH");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Give up
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (status != VA_STATUS_SUCCESS) {
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Failed to initialize VAAPI: %d",
|
"Failed to initialize VAAPI: %d",
|
||||||
@@ -151,6 +300,7 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
major, minor);
|
major, minor);
|
||||||
|
|
||||||
const char* vendorString = vaQueryVendorString(vaDeviceContext->display);
|
const char* vendorString = vaQueryVendorString(vaDeviceContext->display);
|
||||||
|
QString vendorStr(vendorString);
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Driver: %s",
|
"Driver: %s",
|
||||||
vendorString ? vendorString : "<unknown>");
|
vendorString ? vendorString : "<unknown>");
|
||||||
@@ -159,9 +309,8 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
// to be leaked for each submitted frame. The Flatpak runtime has a VDPAU
|
// to be leaked for each submitted frame. The Flatpak runtime has a VDPAU
|
||||||
// driver in place that works well, so use that instead on AMD systems. If
|
// driver in place that works well, so use that instead on AMD systems. If
|
||||||
// we're using Wayland, we have no choice but to use VAAPI because VDPAU
|
// we're using Wayland, we have no choice but to use VAAPI because VDPAU
|
||||||
// is only supported under X11.
|
// is only supported under X11 or XWayland.
|
||||||
if (vendorString && qgetenv("FORCE_VAAPI") != "1" && m_WindowSystem == SDL_SYSWM_X11) {
|
if (qgetenv("FORCE_VAAPI") != "1" && !WMUtils::isRunningWayland()) {
|
||||||
QString vendorStr(vendorString);
|
|
||||||
if (vendorStr.contains("AMD", Qt::CaseInsensitive) ||
|
if (vendorStr.contains("AMD", Qt::CaseInsensitive) ||
|
||||||
vendorStr.contains("Radeon", Qt::CaseInsensitive)) {
|
vendorStr.contains("Radeon", Qt::CaseInsensitive)) {
|
||||||
// Fail and let VDPAU pick this up
|
// Fail and let VDPAU pick this up
|
||||||
@@ -171,6 +320,12 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (WMUtils::isRunningWayland()) {
|
||||||
|
// The iHD VAAPI driver can initialize on XWayland but it crashes in
|
||||||
|
// vaPutSurface() so we must also not directly render on XWayland.
|
||||||
|
m_BlacklistedForDirectRendering = vendorStr.contains("iHD");
|
||||||
|
}
|
||||||
|
|
||||||
// This will populate the driver_quirks
|
// This will populate the driver_quirks
|
||||||
err = av_hwdevice_ctx_init(m_HwContext);
|
err = av_hwdevice_ctx_init(m_HwContext);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
@@ -192,7 +347,7 @@ VAAPIRenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
VAAPIRenderer::prepareDecoderContext(AVCodecContext* context)
|
VAAPIRenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||||
{
|
{
|
||||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||||
|
|
||||||
@@ -216,7 +371,7 @@ VAAPIRenderer::isDirectRenderingSupported()
|
|||||||
{
|
{
|
||||||
// Many Wayland renderers don't support YUV surfaces, so use
|
// Many Wayland renderers don't support YUV surfaces, so use
|
||||||
// another frontend renderer to draw our frames.
|
// another frontend renderer to draw our frames.
|
||||||
return m_WindowSystem == SDL_SYSWM_X11;
|
return m_WindowSystem == SDL_SYSWM_X11 && !m_BlacklistedForDirectRendering;
|
||||||
}
|
}
|
||||||
|
|
||||||
int VAAPIRenderer::getDecoderColorspace()
|
int VAAPIRenderer::getDecoderColorspace()
|
||||||
|
|||||||
@@ -34,16 +34,20 @@ public:
|
|||||||
VAAPIRenderer();
|
VAAPIRenderer();
|
||||||
virtual ~VAAPIRenderer() override;
|
virtual ~VAAPIRenderer() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||||
virtual void renderFrame(AVFrame* frame) override;
|
virtual void renderFrame(AVFrame* frame) override;
|
||||||
virtual bool needsTestFrame() override;
|
virtual bool needsTestFrame() override;
|
||||||
virtual bool isDirectRenderingSupported() override;
|
virtual bool isDirectRenderingSupported() override;
|
||||||
virtual int getDecoderColorspace() override;
|
virtual int getDecoderColorspace() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool validateDriver(VADisplay display);
|
||||||
|
VADisplay openDisplay(SDL_Window* window);
|
||||||
|
|
||||||
int m_WindowSystem;
|
int m_WindowSystem;
|
||||||
AVBufferRef* m_HwContext;
|
AVBufferRef* m_HwContext;
|
||||||
int m_DrmFd;
|
int m_DrmFd;
|
||||||
|
bool m_BlacklistedForDirectRendering;
|
||||||
|
|
||||||
#ifdef HAVE_LIBVA_X11
|
#ifdef HAVE_LIBVA_X11
|
||||||
Window m_XWindow;
|
Window m_XWindow;
|
||||||
|
|||||||
@@ -64,6 +64,21 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
int err;
|
int err;
|
||||||
VdpStatus status;
|
VdpStatus status;
|
||||||
SDL_SysWMinfo info;
|
SDL_SysWMinfo info;
|
||||||
|
static const char* driverPathsToTry[] = {
|
||||||
|
#if Q_PROCESSOR_WORDSIZE == 8
|
||||||
|
"/usr/lib64",
|
||||||
|
"/usr/lib64/vdpau", // Fedora x86_64
|
||||||
|
#endif
|
||||||
|
"/usr/lib",
|
||||||
|
"/usr/lib/vdpau", // Fedora i386
|
||||||
|
#if defined(Q_PROCESSOR_X86_64)
|
||||||
|
"/usr/lib/x86_64-linux-gnu",
|
||||||
|
"/usr/lib/x86_64-linux-gnu/vdpau", // Ubuntu/Debian x86_64
|
||||||
|
#elif defined(Q_PROCESSOR_X86_32)
|
||||||
|
"/usr/lib/i386-linux-gnu",
|
||||||
|
"/usr/lib/i386-linux-gnu/vdpau", // Ubuntu/Debian i386
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
m_VideoWidth = params->width;
|
m_VideoWidth = params->width;
|
||||||
m_VideoHeight = params->height;
|
m_VideoHeight = params->height;
|
||||||
@@ -71,6 +86,32 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
err = av_hwdevice_ctx_create(&m_HwContext,
|
err = av_hwdevice_ctx_create(&m_HwContext,
|
||||||
AV_HWDEVICE_TYPE_VDPAU,
|
AV_HWDEVICE_TYPE_VDPAU,
|
||||||
nullptr, nullptr, 0);
|
nullptr, nullptr, 0);
|
||||||
|
|
||||||
|
if (err < 0 && qEnvironmentVariableIsEmpty("VDPAU_DRIVER_PATH")) {
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Trying fallback VDPAU driver paths");
|
||||||
|
|
||||||
|
// Unlike libva, libvdpau doesn't support multiple paths in
|
||||||
|
// their VDPAU_DRIVER_PATH variable, so we must try them all
|
||||||
|
// one at a time.
|
||||||
|
for (auto& driverPath : driverPathsToTry) {
|
||||||
|
qputenv("VDPAU_DRIVER_PATH", driverPath);
|
||||||
|
err = av_hwdevice_ctx_create(&m_HwContext,
|
||||||
|
AV_HWDEVICE_TYPE_VDPAU,
|
||||||
|
nullptr, nullptr, 0);
|
||||||
|
if (err == 0) {
|
||||||
|
// Success!
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err < 0) {
|
||||||
|
// Unset VDPAU_DRIVER_PATH if we set it ourselves
|
||||||
|
// and we didn't find any working VDPAU drivers.
|
||||||
|
qunsetenv("VDPAU_DRIVER_PATH");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Failed to create VDPAU context: %d",
|
"Failed to create VDPAU context: %d",
|
||||||
@@ -225,7 +266,7 @@ bool VDPAURenderer::initialize(PDECODER_PARAMETERS params)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VDPAURenderer::prepareDecoderContext(AVCodecContext* context)
|
bool VDPAURenderer::prepareDecoderContext(AVCodecContext* context, AVDictionary**)
|
||||||
{
|
{
|
||||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
VDPAURenderer();
|
VDPAURenderer();
|
||||||
virtual ~VDPAURenderer() override;
|
virtual ~VDPAURenderer() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override;
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary** options) override;
|
||||||
virtual void renderFrame(AVFrame* frame) override;
|
virtual void renderFrame(AVFrame* frame) override;
|
||||||
virtual bool needsTestFrame() override;
|
virtual bool needsTestFrame() override;
|
||||||
virtual int getDecoderColorspace() override;
|
virtual int getDecoderColorspace() override;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
m_FormatDesc(nullptr),
|
m_FormatDesc(nullptr),
|
||||||
m_StreamView(nullptr),
|
m_StreamView(nullptr),
|
||||||
m_DisplayLink(nullptr),
|
m_DisplayLink(nullptr),
|
||||||
|
m_ColorSpace(nullptr),
|
||||||
m_VsyncMutex(nullptr),
|
m_VsyncMutex(nullptr),
|
||||||
m_VsyncPassed(nullptr)
|
m_VsyncPassed(nullptr)
|
||||||
{
|
{
|
||||||
@@ -54,6 +55,10 @@ public:
|
|||||||
CFRelease(m_FormatDesc);
|
CFRelease(m_FormatDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ColorSpace != nullptr) {
|
||||||
|
CGColorSpaceRelease(m_ColorSpace);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < Overlay::OverlayMax; i++) {
|
for (int i = 0; i < Overlay::OverlayMax; i++) {
|
||||||
if (m_OverlayTextFields[i] != nullptr) {
|
if (m_OverlayTextFields[i] != nullptr) {
|
||||||
[m_OverlayTextFields[i] removeFromSuperview];
|
[m_OverlayTextFields[i] removeFromSuperview];
|
||||||
@@ -154,6 +159,91 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Strip the attachments added by VT. They are likely wrong.
|
||||||
|
CVBufferRemoveAllAttachments(pixBuf);
|
||||||
|
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferChromaSubsamplingKey,
|
||||||
|
kCVImageBufferChromaSubsampling_420,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
|
||||||
|
switch (frame->color_primaries) {
|
||||||
|
case AVCOL_PRI_BT709:
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferColorPrimariesKey,
|
||||||
|
kCVImageBufferColorPrimaries_ITU_R_709_2,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
case AVCOL_PRI_SMPTE170M:
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferColorPrimariesKey,
|
||||||
|
kCVImageBufferColorPrimaries_SMPTE_C,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
case AVCOL_PRI_BT2020:
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferColorPrimariesKey,
|
||||||
|
kCVImageBufferColorPrimaries_ITU_R_2020,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frame->color_trc) {
|
||||||
|
case AVCOL_TRC_BT709:
|
||||||
|
case AVCOL_TRC_SMPTE170M:
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferTransferFunctionKey,
|
||||||
|
kCVImageBufferTransferFunction_ITU_R_709_2,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
case AVCOL_TRC_BT2020_10:
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferTransferFunctionKey,
|
||||||
|
kCVImageBufferTransferFunction_ITU_R_2020,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frame->colorspace) {
|
||||||
|
case AVCOL_SPC_BT709:
|
||||||
|
if (m_ColorSpace == nullptr) {
|
||||||
|
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_709);
|
||||||
|
}
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferYCbCrMatrixKey,
|
||||||
|
kCVImageBufferYCbCrMatrix_ITU_R_709_2,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
case AVCOL_SPC_BT2020_NCL:
|
||||||
|
if (m_ColorSpace == nullptr) {
|
||||||
|
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceITUR_2020);
|
||||||
|
}
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferYCbCrMatrixKey,
|
||||||
|
kCVImageBufferYCbCrMatrix_ITU_R_2020,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
case AVCOL_SPC_SMPTE170M:
|
||||||
|
if (m_ColorSpace == nullptr) {
|
||||||
|
m_ColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||||
|
}
|
||||||
|
CVBufferSetAttachment(pixBuf,
|
||||||
|
kCVImageBufferYCbCrMatrixKey,
|
||||||
|
kCVImageBufferYCbCrMatrix_ITU_R_601_4,
|
||||||
|
kCVAttachmentMode_ShouldPropagate);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ColorSpace != nullptr) {
|
||||||
|
CVBufferSetAttachment(pixBuf, kCVImageBufferCGColorSpaceKey, m_ColorSpace, kCVAttachmentMode_ShouldPropagate);
|
||||||
|
}
|
||||||
|
|
||||||
// If the format has changed or doesn't exist yet, construct it with the
|
// If the format has changed or doesn't exist yet, construct it with the
|
||||||
// pixel buffer data
|
// pixel buffer data
|
||||||
if (!m_FormatDesc || !CMVideoFormatDescriptionMatchesImageBuffer(m_FormatDesc, pixBuf)) {
|
if (!m_FormatDesc || !CMVideoFormatDescriptionMatchesImageBuffer(m_FormatDesc, pixBuf)) {
|
||||||
@@ -357,10 +447,10 @@ public:
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Overlay::OverlayDebug:
|
case Overlay::OverlayDebug:
|
||||||
[m_OverlayTextFields[type] setAlignment:NSLeftTextAlignment];
|
[m_OverlayTextFields[type] setAlignment:NSTextAlignmentLeft];
|
||||||
break;
|
break;
|
||||||
case Overlay::OverlayStatusUpdate:
|
case Overlay::OverlayStatusUpdate:
|
||||||
[m_OverlayTextFields[type] setAlignment:NSRightTextAlignment];
|
[m_OverlayTextFields[type] setAlignment:NSTextAlignmentRight];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -410,7 +500,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool prepareDecoderContext(AVCodecContext* context) override
|
virtual bool prepareDecoderContext(AVCodecContext* context, AVDictionary**) override
|
||||||
{
|
{
|
||||||
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
context->hw_device_ctx = av_buffer_ref(m_HwContext);
|
||||||
|
|
||||||
@@ -429,6 +519,12 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getDecoderColorspace() override
|
||||||
|
{
|
||||||
|
// macOS seems to handle Rec 601 best
|
||||||
|
return COLORSPACE_REC_601;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AVBufferRef* m_HwContext;
|
AVBufferRef* m_HwContext;
|
||||||
AVSampleBufferDisplayLayer* m_DisplayLayer;
|
AVSampleBufferDisplayLayer* m_DisplayLayer;
|
||||||
@@ -436,6 +532,7 @@ private:
|
|||||||
NSView* m_StreamView;
|
NSView* m_StreamView;
|
||||||
NSTextField* m_OverlayTextFields[Overlay::OverlayMax];
|
NSTextField* m_OverlayTextFields[Overlay::OverlayMax];
|
||||||
CVDisplayLinkRef m_DisplayLink;
|
CVDisplayLinkRef m_DisplayLink;
|
||||||
|
CGColorSpaceRef m_ColorSpace;
|
||||||
SDL_mutex* m_VsyncMutex;
|
SDL_mutex* m_VsyncMutex;
|
||||||
SDL_cond* m_VsyncPassed;
|
SDL_cond* m_VsyncPassed;
|
||||||
};
|
};
|
||||||
|
|||||||
+192
-34
@@ -45,9 +45,25 @@ bool FFmpegVideoDecoder::isHardwareAccelerated()
|
|||||||
(m_VideoDecoderCtx->codec->capabilities & AV_CODEC_CAP_HARDWARE) != 0;
|
(m_VideoDecoderCtx->codec->capabilities & AV_CODEC_CAP_HARDWARE) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FFmpegVideoDecoder::isAlwaysFullScreen()
|
||||||
|
{
|
||||||
|
return m_BackendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_FULLSCREEN_ONLY;
|
||||||
|
}
|
||||||
|
|
||||||
int FFmpegVideoDecoder::getDecoderCapabilities()
|
int FFmpegVideoDecoder::getDecoderCapabilities()
|
||||||
{
|
{
|
||||||
return m_BackendRenderer->getDecoderCapabilities();
|
int capabilities = m_BackendRenderer->getDecoderCapabilities();
|
||||||
|
|
||||||
|
if (!isHardwareAccelerated()) {
|
||||||
|
// Slice up to 4 times for parallel CPU decoding, once slice per core
|
||||||
|
int slices = qMin(MAX_SLICES, SDL_GetCPUCount());
|
||||||
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Encoder configured for %d slices per frame",
|
||||||
|
slices);
|
||||||
|
capabilities |= CAPABILITY_SLICES_PER_FRAME(slices);
|
||||||
|
}
|
||||||
|
|
||||||
|
return capabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FFmpegVideoDecoder::getDecoderColorspace()
|
int FFmpegVideoDecoder::getDecoderColorspace()
|
||||||
@@ -55,6 +71,17 @@ int FFmpegVideoDecoder::getDecoderColorspace()
|
|||||||
return m_FrontendRenderer->getDecoderColorspace();
|
return m_FrontendRenderer->getDecoderColorspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSize FFmpegVideoDecoder::getDecoderMaxResolution()
|
||||||
|
{
|
||||||
|
if (m_BackendRenderer->getRendererAttributes() & RENDERER_ATTRIBUTE_1080P_MAX) {
|
||||||
|
return QSize(1920, 1080);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// No known maximum
|
||||||
|
return QSize(0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
||||||
const enum AVPixelFormat* pixFmts)
|
const enum AVPixelFormat* pixFmts)
|
||||||
{
|
{
|
||||||
@@ -62,7 +89,7 @@ enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
|||||||
const enum AVPixelFormat *p;
|
const enum AVPixelFormat *p;
|
||||||
|
|
||||||
for (p = pixFmts; *p != -1; p++) {
|
for (p = pixFmts; *p != -1; p++) {
|
||||||
// Only match our hardware decoding codec or SW pixel
|
// Only match our hardware decoding codec or preferred SW pixel
|
||||||
// format (if not using hardware decoding). It's crucial
|
// format (if not using hardware decoding). It's crucial
|
||||||
// to override the default get_format() which will try
|
// to override the default get_format() which will try
|
||||||
// to gracefully fall back to software decode and break us.
|
// to gracefully fall back to software decode and break us.
|
||||||
@@ -73,6 +100,15 @@ enum AVPixelFormat FFmpegVideoDecoder::ffGetFormat(AVCodecContext* context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Failed to match the preferred pixel formats. Try non-preferred options for non-hwaccel decoders.
|
||||||
|
if (decoder->m_HwDecodeCfg == nullptr) {
|
||||||
|
for (p = pixFmts; *p != -1; p++) {
|
||||||
|
if (decoder->m_FrontendRenderer->isPixelFormatSupported(decoder->m_VideoFormat, *p)) {
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return AV_PIX_FMT_NONE;
|
return AV_PIX_FMT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,8 +120,11 @@ FFmpegVideoDecoder::FFmpegVideoDecoder(bool testOnly)
|
|||||||
m_FrontendRenderer(nullptr),
|
m_FrontendRenderer(nullptr),
|
||||||
m_ConsecutiveFailedDecodes(0),
|
m_ConsecutiveFailedDecodes(0),
|
||||||
m_Pacer(nullptr),
|
m_Pacer(nullptr),
|
||||||
|
m_FramesIn(0),
|
||||||
|
m_FramesOut(0),
|
||||||
m_LastFrameNumber(0),
|
m_LastFrameNumber(0),
|
||||||
m_StreamFps(0),
|
m_StreamFps(0),
|
||||||
|
m_VideoFormat(0),
|
||||||
m_NeedsSpsFixup(false),
|
m_NeedsSpsFixup(false),
|
||||||
m_TestOnly(testOnly)
|
m_TestOnly(testOnly)
|
||||||
{
|
{
|
||||||
@@ -164,23 +203,6 @@ bool FFmpegVideoDecoder::createFrontendRenderer(PDECODER_PARAMETERS params)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine whether the frontend renderer prefers frame pacing
|
|
||||||
auto vsyncConstraint = m_FrontendRenderer->getFramePacingConstraint();
|
|
||||||
if (vsyncConstraint == IFFmpegRenderer::PACING_FORCE_OFF && params->enableFramePacing) {
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Frame pacing is forcefully disabled by the frontend renderer");
|
|
||||||
params->enableFramePacing = false;
|
|
||||||
}
|
|
||||||
else if (vsyncConstraint == IFFmpegRenderer::PACING_FORCE_ON && !params->enableFramePacing) {
|
|
||||||
// FIXME: This duplicates logic in Session.cpp
|
|
||||||
int displayHz = StreamUtils::getDisplayRefreshRate(params->window);
|
|
||||||
if (displayHz + 5 >= params->frameRate) {
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Frame pacing is forcefully enabled by the frontend renderer");
|
|
||||||
params->enableFramePacing = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,6 +217,7 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_StreamFps = params->frameRate;
|
m_StreamFps = params->frameRate;
|
||||||
|
m_VideoFormat = params->videoFormat;
|
||||||
|
|
||||||
// Don't bother initializing Pacer if we're not actually going to render
|
// Don't bother initializing Pacer if we're not actually going to render
|
||||||
if (!testFrame) {
|
if (!testFrame) {
|
||||||
@@ -243,8 +266,10 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
|||||||
m_VideoDecoderCtx->pix_fmt = m_FrontendRenderer->getPreferredPixelFormat(params->videoFormat);
|
m_VideoDecoderCtx->pix_fmt = m_FrontendRenderer->getPreferredPixelFormat(params->videoFormat);
|
||||||
m_VideoDecoderCtx->get_format = ffGetFormat;
|
m_VideoDecoderCtx->get_format = ffGetFormat;
|
||||||
|
|
||||||
|
AVDictionary* options = nullptr;
|
||||||
|
|
||||||
// Allow the backend renderer to attach data to this decoder
|
// Allow the backend renderer to attach data to this decoder
|
||||||
if (!m_BackendRenderer->prepareDecoderContext(m_VideoDecoderCtx)) {
|
if (!m_BackendRenderer->prepareDecoderContext(m_VideoDecoderCtx, &options)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +280,8 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
|||||||
SDL_assert(m_VideoDecoderCtx->opaque == nullptr);
|
SDL_assert(m_VideoDecoderCtx->opaque == nullptr);
|
||||||
m_VideoDecoderCtx->opaque = this;
|
m_VideoDecoderCtx->opaque = this;
|
||||||
|
|
||||||
int err = avcodec_open2(m_VideoDecoderCtx, decoder, nullptr);
|
int err = avcodec_open2(m_VideoDecoderCtx, decoder, &options);
|
||||||
|
av_dict_free(&options);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
"Unable to open decoder for format: %x",
|
"Unable to open decoder for format: %x",
|
||||||
@@ -289,7 +315,42 @@ bool FFmpegVideoDecoder::completeInitialization(AVCodec* decoder, PDECODER_PARAM
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = avcodec_send_packet(m_VideoDecoderCtx, &m_Pkt);
|
AVFrame* frame = av_frame_alloc();
|
||||||
|
if (!frame) {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Failed to allocate frame");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some decoders won't output on the first frame, so we'll submit
|
||||||
|
// a few test frames if we get an EAGAIN error.
|
||||||
|
for (int retries = 0; retries < 5; retries++) {
|
||||||
|
// Most FFmpeg decoders process input using a "push" model.
|
||||||
|
// We'll see those fail here if the format is not supported.
|
||||||
|
err = avcodec_send_packet(m_VideoDecoderCtx, &m_Pkt);
|
||||||
|
if (err < 0) {
|
||||||
|
av_frame_free(&frame);
|
||||||
|
char errorstring[512];
|
||||||
|
av_strerror(err, errorstring, sizeof(errorstring));
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Test decode failed: %s", errorstring);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A few FFmpeg decoders (h264_mmal) process here using a "pull" model.
|
||||||
|
// Those decoders will fail here if the format is not supported.
|
||||||
|
err = avcodec_receive_frame(m_VideoDecoderCtx, frame);
|
||||||
|
if (err == AVERROR(EAGAIN)) {
|
||||||
|
// Wait a little while to let the hardware work
|
||||||
|
SDL_Delay(100);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Done!
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
av_frame_free(&frame);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
char errorstring[512];
|
char errorstring[512];
|
||||||
av_strerror(err, errorstring, sizeof(errorstring));
|
av_strerror(err, errorstring, sizeof(errorstring));
|
||||||
@@ -488,11 +549,61 @@ bool FFmpegVideoDecoder::tryInitializeRenderer(AVCodec* decoder,
|
|||||||
|
|
||||||
bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
||||||
{
|
{
|
||||||
AVCodec* decoder;
|
|
||||||
|
|
||||||
// Increase log level until the first frame is decoded
|
// Increase log level until the first frame is decoded
|
||||||
av_log_set_level(AV_LOG_DEBUG);
|
av_log_set_level(AV_LOG_DEBUG);
|
||||||
|
|
||||||
|
// First try decoders that the user has manually specified via environment variables.
|
||||||
|
// These must output surfaces in one of the formats that the SDL renderer supports,
|
||||||
|
// which is currently:
|
||||||
|
// - AV_PIX_FMT_YUV420P (preferred)
|
||||||
|
// - AV_PIX_FMT_NV12
|
||||||
|
// - AV_PIX_FMT_NV21
|
||||||
|
// These formats should cover most/all decoders that output in a standard YUV format.
|
||||||
|
{
|
||||||
|
QString h264DecoderHint = qgetenv("H264_DECODER_HINT");
|
||||||
|
if (!h264DecoderHint.isEmpty() && (params->videoFormat & VIDEO_FORMAT_MASK_H264)) {
|
||||||
|
QByteArray decoderString = h264DecoderHint.toLocal8Bit();
|
||||||
|
AVCodec* customAvcDecoder = avcodec_find_decoder_by_name(decoderString.constData());
|
||||||
|
|
||||||
|
if (customAvcDecoder != nullptr &&
|
||||||
|
tryInitializeRenderer(customAvcDecoder, params, nullptr,
|
||||||
|
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Using custom H.264 decoder (H264_DECODER_HINT): %s",
|
||||||
|
decoderString.constData());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Custom H.264 decoder (H264_DECODER_HINT) failed to load: %s",
|
||||||
|
decoderString.constData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
QString hevcDecoderHint = qgetenv("HEVC_DECODER_HINT");
|
||||||
|
if (!hevcDecoderHint.isEmpty() && (params->videoFormat & VIDEO_FORMAT_MASK_H265)) {
|
||||||
|
QByteArray decoderString = hevcDecoderHint.toLocal8Bit();
|
||||||
|
AVCodec* customHevcDecoder = avcodec_find_decoder_by_name(decoderString.constData());
|
||||||
|
|
||||||
|
if (customHevcDecoder != nullptr &&
|
||||||
|
tryInitializeRenderer(customHevcDecoder, params, nullptr,
|
||||||
|
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||||
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Using custom HEVC decoder (HEVC_DECODER_HINT): %s",
|
||||||
|
decoderString.constData());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
"Custom HEVC decoder (HEVC_DECODER_HINT) failed to load: %s",
|
||||||
|
decoderString.constData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AVCodec* decoder;
|
||||||
|
|
||||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||||
decoder = avcodec_find_decoder(AV_CODEC_ID_H264);
|
decoder = avcodec_find_decoder(AV_CODEC_ID_H264);
|
||||||
}
|
}
|
||||||
@@ -543,20 +654,58 @@ bool FFmpegVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DRM
|
#ifdef HAVE_DRM
|
||||||
// RKMPP is a hardware accelerated decoder that outputs DRI PRIME buffers
|
{
|
||||||
AVCodec* rkmppDecoder;
|
// RKMPP is a hardware accelerated decoder that outputs DRI PRIME buffers
|
||||||
|
AVCodec* rkmppDecoder;
|
||||||
|
|
||||||
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||||
rkmppDecoder = avcodec_find_decoder_by_name("h264_rkmpp");
|
rkmppDecoder = avcodec_find_decoder_by_name("h264_rkmpp");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
rkmppDecoder = avcodec_find_decoder_by_name("hevc_rkmpp");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rkmppDecoder != nullptr &&
|
||||||
|
tryInitializeRenderer(rkmppDecoder, params, nullptr,
|
||||||
|
[]() -> IFFmpegRenderer* { return new DrmRenderer(); })) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
#endif
|
||||||
rkmppDecoder = avcodec_find_decoder_by_name("hevc_rkmpp");
|
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
{
|
||||||
|
AVCodec* nvmpiDecoder;
|
||||||
|
|
||||||
|
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||||
|
nvmpiDecoder = avcodec_find_decoder_by_name("h264_nvmpi");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nvmpiDecoder = avcodec_find_decoder_by_name("hevc_nvmpi");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nvmpiDecoder != nullptr &&
|
||||||
|
tryInitializeRenderer(nvmpiDecoder, params, nullptr,
|
||||||
|
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rkmppDecoder != nullptr &&
|
{
|
||||||
tryInitializeRenderer(rkmppDecoder, params, nullptr,
|
AVCodec* v4l2Decoder;
|
||||||
[]() -> IFFmpegRenderer* { return new DrmRenderer(); })) {
|
|
||||||
return true;
|
if (params->videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||||
|
v4l2Decoder = avcodec_find_decoder_by_name("h264_v4l2m2m");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
v4l2Decoder = avcodec_find_decoder_by_name("hevc_v4l2m2m");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (v4l2Decoder != nullptr &&
|
||||||
|
tryInitializeRenderer(v4l2Decoder, params, nullptr,
|
||||||
|
[]() -> IFFmpegRenderer* { return new SdlRenderer(); })) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -719,6 +868,8 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
|||||||
return DR_NEED_IDR;
|
return DR_NEED_IDR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_FramesIn++;
|
||||||
|
|
||||||
AVFrame* frame = av_frame_alloc();
|
AVFrame* frame = av_frame_alloc();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
// Failed to allocate a frame but we did submit,
|
// Failed to allocate a frame but we did submit,
|
||||||
@@ -730,6 +881,8 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
|||||||
|
|
||||||
err = avcodec_receive_frame(m_VideoDecoderCtx, frame);
|
err = avcodec_receive_frame(m_VideoDecoderCtx, frame);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
|
m_FramesOut++;
|
||||||
|
|
||||||
// Reset failed decodes count if we reached this far
|
// Reset failed decodes count if we reached this far
|
||||||
m_ConsecutiveFailedDecodes = 0;
|
m_ConsecutiveFailedDecodes = 0;
|
||||||
|
|
||||||
@@ -745,6 +898,11 @@ int FFmpegVideoDecoder::submitDecodeUnit(PDECODE_UNIT du)
|
|||||||
// Count time in avcodec_send_packet() and avcodec_receive_frame()
|
// Count time in avcodec_send_packet() and avcodec_receive_frame()
|
||||||
// as time spent decoding
|
// as time spent decoding
|
||||||
m_ActiveWndVideoStats.totalDecodeTime += SDL_GetTicks() - beforeDecode;
|
m_ActiveWndVideoStats.totalDecodeTime += SDL_GetTicks() - beforeDecode;
|
||||||
|
|
||||||
|
// Also count the frame-to-frame delay if the decoder is delaying frames
|
||||||
|
// until a subsequent frame is submitted.
|
||||||
|
m_ActiveWndVideoStats.totalDecodeTime += (m_FramesIn - m_FramesOut) * (1000 / m_StreamFps);
|
||||||
|
|
||||||
m_ActiveWndVideoStats.decodedFrames++;
|
m_ActiveWndVideoStats.decodedFrames++;
|
||||||
|
|
||||||
// Queue the frame for rendering (or render now if pacer is disabled)
|
// Queue the frame for rendering (or render now if pacer is disabled)
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ public:
|
|||||||
virtual ~FFmpegVideoDecoder() override;
|
virtual ~FFmpegVideoDecoder() override;
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
virtual bool initialize(PDECODER_PARAMETERS params) override;
|
||||||
virtual bool isHardwareAccelerated() override;
|
virtual bool isHardwareAccelerated() override;
|
||||||
|
virtual bool isAlwaysFullScreen() override;
|
||||||
virtual int getDecoderCapabilities() override;
|
virtual int getDecoderCapabilities() override;
|
||||||
virtual int getDecoderColorspace() override;
|
virtual int getDecoderColorspace() override;
|
||||||
|
virtual QSize getDecoderMaxResolution() override;
|
||||||
virtual int submitDecodeUnit(PDECODE_UNIT du) override;
|
virtual int submitDecodeUnit(PDECODE_UNIT du) override;
|
||||||
virtual void renderFrameOnMainThread() override;
|
virtual void renderFrameOnMainThread() override;
|
||||||
|
|
||||||
@@ -61,8 +63,12 @@ private:
|
|||||||
VIDEO_STATS m_LastWndVideoStats;
|
VIDEO_STATS m_LastWndVideoStats;
|
||||||
VIDEO_STATS m_GlobalVideoStats;
|
VIDEO_STATS m_GlobalVideoStats;
|
||||||
|
|
||||||
|
int m_FramesIn;
|
||||||
|
int m_FramesOut;
|
||||||
|
|
||||||
int m_LastFrameNumber;
|
int m_LastFrameNumber;
|
||||||
int m_StreamFps;
|
int m_StreamFps;
|
||||||
|
int m_VideoFormat;
|
||||||
bool m_NeedsSpsFixup;
|
bool m_NeedsSpsFixup;
|
||||||
bool m_TestOnly;
|
bool m_TestOnly;
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ SLVideoDecoder::isHardwareAccelerated()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SLVideoDecoder::isAlwaysFullScreen()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
SLVideoDecoder::getDecoderCapabilities()
|
SLVideoDecoder::getDecoderCapabilities()
|
||||||
{
|
{
|
||||||
@@ -37,6 +42,11 @@ SLVideoDecoder::getDecoderColorspace()
|
|||||||
return COLORSPACE_REC_709;
|
return COLORSPACE_REC_709;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSize SLVideoDecoder::getDecoderMaxResolution()
|
||||||
|
{
|
||||||
|
return QSize(1920, 1080);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SLVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
SLVideoDecoder::initialize(PDECODER_PARAMETERS params)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,8 +11,10 @@ public:
|
|||||||
virtual ~SLVideoDecoder();
|
virtual ~SLVideoDecoder();
|
||||||
virtual bool initialize(PDECODER_PARAMETERS params);
|
virtual bool initialize(PDECODER_PARAMETERS params);
|
||||||
virtual bool isHardwareAccelerated();
|
virtual bool isHardwareAccelerated();
|
||||||
|
virtual bool isAlwaysFullScreen();
|
||||||
virtual int getDecoderCapabilities();
|
virtual int getDecoderCapabilities();
|
||||||
virtual int getDecoderColorspace();
|
virtual int getDecoderColorspace();
|
||||||
|
virtual QSize getDecoderMaxResolution();
|
||||||
virtual int submitDecodeUnit(PDECODE_UNIT du);
|
virtual int submitDecodeUnit(PDECODE_UNIT du);
|
||||||
|
|
||||||
// Unused since rendering is done directly from the decode thread
|
// Unused since rendering is done directly from the decode thread
|
||||||
|
|||||||
@@ -3,3 +3,8 @@
|
|||||||
#define THROW_BAD_ALLOC_IF_NULL(x) \
|
#define THROW_BAD_ALLOC_IF_NULL(x) \
|
||||||
if ((x) == nullptr) throw std::bad_alloc()
|
if ((x) == nullptr) throw std::bad_alloc()
|
||||||
|
|
||||||
|
namespace WMUtils {
|
||||||
|
bool isRunningX11();
|
||||||
|
bool isRunningWayland();
|
||||||
|
bool isRunningWindowManager();
|
||||||
|
}
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.2.1
|
2.0.0
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
#ifdef HAS_X11
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_WAYLAND
|
||||||
|
#include <wayland-client.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool WMUtils::isRunningX11()
|
||||||
|
{
|
||||||
|
#ifdef HAS_X11
|
||||||
|
Display* display = XOpenDisplay(nullptr);
|
||||||
|
if (display != nullptr) {
|
||||||
|
XCloseDisplay(display);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WMUtils::isRunningWayland()
|
||||||
|
{
|
||||||
|
#ifdef HAS_WAYLAND
|
||||||
|
struct wl_display* display = wl_display_connect(nullptr);
|
||||||
|
if (display != nullptr) {
|
||||||
|
wl_display_disconnect(display);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WMUtils::isRunningWindowManager()
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
|
||||||
|
// Windows and macOS are always running a window manager
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
// On Unix OSes, look for Wayland or X
|
||||||
|
return WMUtils::isRunningWayland() || WMUtils::isRunningX11();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
version: 0.0.0.{build}
|
||||||
|
|
||||||
|
clone_depth: 1
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
|
QTDIR: C:\Qt\5.14\msvc2017_64
|
||||||
|
ARCH: x64
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: macOS
|
||||||
|
BUILD_TARGET: macos
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
|
QTDIR: C:\Qt\5.14\msvc2017
|
||||||
|
ARCH: x86
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604
|
||||||
|
BUILD_TARGET: steamlink
|
||||||
|
- APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1604
|
||||||
|
BUILD_TARGET: linux
|
||||||
|
FFMPEG_CONFIGURE_ARGS: --enable-pic --disable-static --enable-shared --disable-all --enable-avcodec --enable-decoder=h264 --enable-decoder=hevc --enable-nvdec --enable-hwaccel=h264_nvdec --enable-hwaccel=hevc_nvdec --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=h264_vdpau --enable-hwaccel=hevc_vdpau
|
||||||
|
|
||||||
|
install:
|
||||||
|
- sh: '[ "$BUILD_TARGET" != macos ] || nvm use node'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != macos ] || npm install --global create-dmg'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != steamlink ] || sudo apt install -y libc6:i386 libstdc++6:i386'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != steamlink ] || git clone --depth=1 https://github.com/ValveSoftware/steamlink-sdk.git $HOME/steamlink-sdk'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != linux ] || sudo add-apt-repository ppa:beineri/opt-qt-5.14.2-xenial'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != linux ] || sudo apt update'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != linux ] || sudo apt install -y qt514base qt514quickcontrols2 qt514svg qt514wayland nasm libgbm-dev libdrm-dev libfreetype6-dev libasound2-dev libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev wayland-protocols libopus-dev libvdpau-dev'
|
||||||
|
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export SDL2_VER=2.0.12 && wget https://www.libsdl.org/release/SDL2-$SDL2_VER.tar.gz && tar -xvf SDL2-$SDL2_VER.tar.gz && cd SDL2-$SDL2_VER && ./configure && make -j$(nproc) && sudo make install && cd ..; fi'
|
||||||
|
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export SDL2_TTF_VER=2.0.15 && wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$SDL2_TTF_VER.tar.gz && tar -xvf SDL2_ttf-$SDL2_TTF_VER.tar.gz && cd SDL2_ttf-$SDL2_TTF_VER && ./configure && make -j$(nproc) && sudo make install && cd ..; fi'
|
||||||
|
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export LIBVA_VER=2.7.1 && wget https://github.com/intel/libva/releases/download/$LIBVA_VER/libva-$LIBVA_VER.tar.bz2 && tar -xvf libva-$LIBVA_VER.tar.bz2 && cd libva-$LIBVA_VER && ./configure && make -j$(nproc) && sudo make install && cd ..; fi'
|
||||||
|
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export NVHDR_VER=8.1.24.11 && wget https://github.com/FFmpeg/nv-codec-headers/releases/download/n$NVHDR_VER/nv-codec-headers-$NVHDR_VER.tar.gz && tar -xvf nv-codec-headers-$NVHDR_VER.tar.gz && cd nv-codec-headers-$NVHDR_VER && sudo make install && cd ..; fi'
|
||||||
|
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then export FFMPEG_VER=4.2.2 && wget https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VER.tar.bz2 && tar -xvf ffmpeg-$FFMPEG_VER.tar.bz2 && cd ffmpeg-$FFMPEG_VER && ./configure $FFMPEG_CONFIGURE_ARGS && make -j$(nproc) && sudo make install && sudo ldconfig && cd ..; fi'
|
||||||
|
- sh: 'if [[ "$BUILD_TARGET" = linux ]]; then mkdir $HOME/bin && wget -O $HOME/bin/linuxdeployqt https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage && chmod a+x $HOME/bin/linuxdeployqt; fi'
|
||||||
|
|
||||||
|
before_build:
|
||||||
|
- 'git submodule update --init --recursive'
|
||||||
|
- cmd: 'set PATH=%PATH%;%QTDIR%\bin;%ProgramFiles(x86)%\WiX Toolset v3.11\bin'
|
||||||
|
- cmd: 'set /p VERSION=<app\version.txt'
|
||||||
|
- sh: 'export VERSION=`cat app/version.txt`'
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- cmd: 'scripts\generate-installers.bat Debug %ARCH%'
|
||||||
|
- cmd: 'scripts\generate-installers.bat Release %ARCH%'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != linux ] || source /opt/qt514/bin/qt514-env.sh'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != linux ] || PATH=$PATH:$HOME/bin scripts/build-appimage.sh'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != macos ] || scripts/generate-dmg.sh Release'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != steamlink ] || STEAMLINK_SDK_PATH=$HOME/steamlink-sdk scripts/build-steamlink-app.sh'
|
||||||
|
|
||||||
|
after_build:
|
||||||
|
- cmd: 'appveyor PushArtifact build\installer-%ARCH%-Release\MoonlightSetup-%ARCH%-%VERSION%.exe -FileName MoonlightSetup-%ARCH%-r%APPVEYOR_BUILD_NUMBER%.exe'
|
||||||
|
- cmd: 'appveyor PushArtifact build\installer-%ARCH%-Release\MoonlightPortable-%ARCH%-%VERSION%.zip -FileName MoonlightPortable-%ARCH%-r%APPVEYOR_BUILD_NUMBER%.zip'
|
||||||
|
- cmd: 'appveyor PushArtifact build\symbols-%ARCH%-Release\MoonlightDebuggingSymbols-%ARCH%-%VERSION%.zip -FileName MoonlightDebuggingSymbols-%ARCH%-r%APPVEYOR_BUILD_NUMBER%.zip'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != steamlink ] || appveyor PushArtifact build/installer-release/Moonlight-SteamLink-$VERSION.zip -FileName Moonlight-SteamLink-r$APPVEYOR_BUILD_NUMBER.zip'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != macos ] || appveyor PushArtifact build/installer-Release/Moonlight-$VERSION.dmg -FileName Moonlight-r$APPVEYOR_BUILD_NUMBER.dmg'
|
||||||
|
- sh: '[ "$BUILD_TARGET" != linux ] || appveyor PushArtifact build/installer-release/Moonlight-$VERSION-x86_64.AppImage -FileName Moonlight-r$APPVEYOR_BUILD_NUMBER-x86_64.AppImage'
|
||||||
|
|
||||||
|
deploy: off
|
||||||
+5
-1
@@ -9,5 +9,9 @@ CONFIG(release, debug|release) {
|
|||||||
DEFINES += NDEBUG
|
DEFINES += NDEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
# Enable ASan if desired
|
# Enable ASan for Linux or macOS
|
||||||
#CONFIG += sanitizer sanitize_address
|
#CONFIG += sanitizer sanitize_address
|
||||||
|
|
||||||
|
# Enable ASan for Windows
|
||||||
|
#QMAKE_CFLAGS += /fsanitize=address /MD
|
||||||
|
#LIBS += clang_rt.asan_dynamic-i386.lib clang_rt.asan_dynamic_runtime_thunk-i386.lib
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
Versions/Current/Resources
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
HIDAPI Authors:
|
||||||
|
|
||||||
|
Alan Ott <alan@signal11.us>:
|
||||||
|
Original Author and Maintainer
|
||||||
|
Linux, Windows, and Mac implementations
|
||||||
|
|
||||||
|
Ludovic Rousseau <rousseau@debian.org>:
|
||||||
|
Formatting for Doxygen documentation
|
||||||
|
Bug fixes
|
||||||
|
Correctness fixes
|
||||||
|
|
||||||
|
|
||||||
|
For a comprehensive list of contributions, see the commit list at github:
|
||||||
|
https://github.com/libusb/hidapi/commits/master
|
||||||
|
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>BuildMachineOSBuild</key>
|
||||||
|
<string>19E287</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>hidapi</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>org.libsdl.hidapi</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>hidapi</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleSupportedPlatforms</key>
|
||||||
|
<array>
|
||||||
|
<string>MacOSX</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>DTCompiler</key>
|
||||||
|
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||||
|
<key>DTPlatformBuild</key>
|
||||||
|
<string>11C505</string>
|
||||||
|
<key>DTPlatformVersion</key>
|
||||||
|
<string>GM</string>
|
||||||
|
<key>DTSDKBuild</key>
|
||||||
|
<string>19B90</string>
|
||||||
|
<key>DTSDKName</key>
|
||||||
|
<string>macosx10.15</string>
|
||||||
|
<key>DTXcode</key>
|
||||||
|
<string>1130</string>
|
||||||
|
<key>DTXcodeBuild</key>
|
||||||
|
<string>11C505</string>
|
||||||
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
<string>10.6</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
Copyright (c) 2010, Alan Ott, Signal 11 Software
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Signal 11 Software nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
+674
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
HIDAPI - Multi-Platform library for
|
||||||
|
communication with HID devices.
|
||||||
|
|
||||||
|
Copyright 2009, Alan Ott, Signal 11 Software.
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
This software may be used by anyone for any reason so
|
||||||
|
long as the copyright notice in the source files
|
||||||
|
remains intact.
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
HIDAPI can be used under one of three licenses.
|
||||||
|
|
||||||
|
1. The GNU General Public License, version 3.0, in LICENSE-gpl3.txt
|
||||||
|
2. A BSD-Style License, in LICENSE-bsd.txt.
|
||||||
|
3. The more liberal original HIDAPI license. LICENSE-orig.txt
|
||||||
|
|
||||||
|
The license chosen is at the discretion of the user of HIDAPI. For example:
|
||||||
|
1. An author of GPL software would likely use HIDAPI under the terms of the
|
||||||
|
GPL.
|
||||||
|
|
||||||
|
2. An author of commercial closed-source software would likely use HIDAPI
|
||||||
|
under the terms of the BSD-style license or the original HIDAPI license.
|
||||||
|
|
||||||
+218
@@ -0,0 +1,218 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>files</key>
|
||||||
|
<dict>
|
||||||
|
<key>Resources/AUTHORS.txt</key>
|
||||||
|
<data>
|
||||||
|
MKG+c/Ng8ZXbj7p1G5WReTJm06Y=
|
||||||
|
</data>
|
||||||
|
<key>Resources/Info.plist</key>
|
||||||
|
<data>
|
||||||
|
xIjchI5RXIIqR9iBwzwdhWVeJmQ=
|
||||||
|
</data>
|
||||||
|
<key>Resources/LICENSE-bsd.txt</key>
|
||||||
|
<data>
|
||||||
|
fd5CtMb9r65yLY0HVWttnbpNKWM=
|
||||||
|
</data>
|
||||||
|
<key>Resources/LICENSE-gpl3.txt</key>
|
||||||
|
<data>
|
||||||
|
hiS82uVbru8AzRHV38+mD2hxCgI=
|
||||||
|
</data>
|
||||||
|
<key>Resources/LICENSE-orig.txt</key>
|
||||||
|
<data>
|
||||||
|
ZgR9vPP9aJyZRyJm9a0UHFPW8sY=
|
||||||
|
</data>
|
||||||
|
<key>Resources/LICENSE.txt</key>
|
||||||
|
<data>
|
||||||
|
9VS7iq5RUyXd9/XSbbwcYpQMum4=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>files2</key>
|
||||||
|
<dict>
|
||||||
|
<key>Headers/hidapi.h</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
k64XAQ+3r97nmyIHwE8OT8womds=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
lVEZqQL+xakdQRDnxHo2VwkisMieptRP2Im3DPsMMAs=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/AUTHORS.txt</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
MKG+c/Ng8ZXbj7p1G5WReTJm06Y=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
syens6RZflkCVW7D6EB8vdHiiKvUYjt7S1bRTUnoTss=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/Info.plist</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
xIjchI5RXIIqR9iBwzwdhWVeJmQ=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
8Rqw3j5YT+AoPOKV4JE3RuVPPDb4jHtT4tpmG0phLYc=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/LICENSE-bsd.txt</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
fd5CtMb9r65yLY0HVWttnbpNKWM=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
MOsb7ym0b4unq4tBYDXb2TywNKRUgd2XgVuUQoRYLNI=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/LICENSE-gpl3.txt</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
hiS82uVbru8AzRHV38+mD2hxCgI=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/LICENSE-orig.txt</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
ZgR9vPP9aJyZRyJm9a0UHFPW8sY=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
+1Q2qmPRtxqN+/dOyvGltOHsTff4AHTRH+yZKE9pyl8=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
<key>Resources/LICENSE.txt</key>
|
||||||
|
<dict>
|
||||||
|
<key>hash</key>
|
||||||
|
<data>
|
||||||
|
9VS7iq5RUyXd9/XSbbwcYpQMum4=
|
||||||
|
</data>
|
||||||
|
<key>hash2</key>
|
||||||
|
<data>
|
||||||
|
fTsIfDTzXU1TjjvN3R/49m6S+e8zaIGZlIKADd+ECRM=
|
||||||
|
</data>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>rules</key>
|
||||||
|
<dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version.plist$</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>rules2</key>
|
||||||
|
<dict>
|
||||||
|
<key>.*\.dSYM($|/)</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>11</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(.*/)?\.DS_Store$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>2000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^.*</key>
|
||||||
|
<true/>
|
||||||
|
<key>^Info\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^PkgInfo$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>optional</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1000</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>omit</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1100</real>
|
||||||
|
</dict>
|
||||||
|
<key>^Resources/Base\.lproj/</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>1010</real>
|
||||||
|
</dict>
|
||||||
|
<key>^[^/]+$</key>
|
||||||
|
<dict>
|
||||||
|
<key>nested</key>
|
||||||
|
<true/>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>10</real>
|
||||||
|
</dict>
|
||||||
|
<key>^embedded\.provisionprofile$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
<key>^version\.plist$</key>
|
||||||
|
<dict>
|
||||||
|
<key>weight</key>
|
||||||
|
<real>20</real>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Executable
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
|||||||
|
A
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
Versions/Current/hidapi
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
#include "SDL_loadso.h"
|
#include "SDL_loadso.h"
|
||||||
#include "SDL_log.h"
|
#include "SDL_log.h"
|
||||||
#include "SDL_messagebox.h"
|
#include "SDL_messagebox.h"
|
||||||
|
#include "SDL_metal.h"
|
||||||
#include "SDL_mutex.h"
|
#include "SDL_mutex.h"
|
||||||
#include "SDL_power.h"
|
#include "SDL_power.h"
|
||||||
#include "SDL_render.h"
|
#include "SDL_render.h"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -50,6 +50,9 @@ typedef enum
|
|||||||
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
|
SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate
|
||||||
dstRGB = srcRGB * dstRGB
|
dstRGB = srcRGB * dstRGB
|
||||||
dstA = dstA */
|
dstA = dstA */
|
||||||
|
SDL_BLENDMODE_MUL = 0x00000008, /**< color multiply
|
||||||
|
dstRGB = (srcRGB * dstRGB) + (dstRGB * (1-srcA))
|
||||||
|
dstA = (srcA * dstA) + (dstA * (1-srcA)) */
|
||||||
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
|
SDL_BLENDMODE_INVALID = 0x7FFFFFFF
|
||||||
|
|
||||||
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
|
/* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -74,6 +74,7 @@
|
|||||||
#define HAVE_STRCHR 1
|
#define HAVE_STRCHR 1
|
||||||
#define HAVE_STRRCHR 1
|
#define HAVE_STRRCHR 1
|
||||||
#define HAVE_STRSTR 1
|
#define HAVE_STRSTR 1
|
||||||
|
#define HAVE_STRTOK_R 1
|
||||||
#define HAVE_STRTOL 1
|
#define HAVE_STRTOL 1
|
||||||
#define HAVE_STRTOUL 1
|
#define HAVE_STRTOUL 1
|
||||||
#define HAVE_STRTOLL 1
|
#define HAVE_STRTOLL 1
|
||||||
@@ -130,14 +131,17 @@
|
|||||||
#define HAVE_SYSCONF 1
|
#define HAVE_SYSCONF 1
|
||||||
#define HAVE_SYSCTLBYNAME 1
|
#define HAVE_SYSCTLBYNAME 1
|
||||||
|
|
||||||
|
#define HAVE_GCC_ATOMICS 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
||||||
/* Enable various input drivers */
|
/* Enable various input drivers */
|
||||||
|
#define SDL_JOYSTICK_HIDAPI 1
|
||||||
#define SDL_JOYSTICK_IOKIT 1
|
#define SDL_JOYSTICK_IOKIT 1
|
||||||
#define SDL_JOYSTICK_HIDAPI 1
|
#define SDL_JOYSTICK_VIRTUAL 1
|
||||||
#define SDL_HAPTIC_IOKIT 1
|
#define SDL_HAPTIC_IOKIT 1
|
||||||
|
|
||||||
/* Enable the dummy sensor driver */
|
/* Enable the dummy sensor driver */
|
||||||
@@ -157,13 +161,13 @@
|
|||||||
#define SDL_VIDEO_DRIVER_COCOA 1
|
#define SDL_VIDEO_DRIVER_COCOA 1
|
||||||
#define SDL_VIDEO_DRIVER_DUMMY 1
|
#define SDL_VIDEO_DRIVER_DUMMY 1
|
||||||
#undef SDL_VIDEO_DRIVER_X11
|
#undef SDL_VIDEO_DRIVER_X11
|
||||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib"
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib"
|
||||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib"
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib"
|
||||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib"
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/opt/X11/lib/libXinerama.1.dylib"
|
||||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib"
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib"
|
||||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib"
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib"
|
||||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib"
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib"
|
||||||
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib"
|
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/opt/X11/lib/libXxf86vm.1.dylib"
|
||||||
#define SDL_VIDEO_DRIVER_X11_XDBE 1
|
#define SDL_VIDEO_DRIVER_X11_XDBE 1
|
||||||
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
|
#define SDL_VIDEO_DRIVER_X11_XINERAMA 1
|
||||||
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
|
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
|
||||||
@@ -191,9 +195,15 @@
|
|||||||
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
#define SDL_VIDEO_RENDER_OGL_ES2 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SDL_VIDEO_RENDER_METAL
|
|
||||||
/* Metal only supported on 64-bit architectures with 10.11+ */
|
/* Metal only supported on 64-bit architectures with 10.11+ */
|
||||||
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
|
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
|
||||||
|
#define SDL_PLATFORM_SUPPORTS_METAL 1
|
||||||
|
#else
|
||||||
|
#define SDL_PLATFORM_SUPPORTS_METAL 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SDL_VIDEO_RENDER_METAL
|
||||||
|
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||||
#define SDL_VIDEO_RENDER_METAL 1
|
#define SDL_VIDEO_RENDER_METAL 1
|
||||||
#else
|
#else
|
||||||
#define SDL_VIDEO_RENDER_METAL 0
|
#define SDL_VIDEO_RENDER_METAL 0
|
||||||
@@ -217,13 +227,22 @@
|
|||||||
#define SDL_VIDEO_OPENGL_GLX 1
|
#define SDL_VIDEO_OPENGL_GLX 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable Vulkan support */
|
/* Enable Vulkan and Metal support */
|
||||||
/* Metal/Vulkan Portability only supported on 64-bit architectures with 10.11+ */
|
#ifndef SDL_VIDEO_VULKAN
|
||||||
#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
|
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||||
#define SDL_VIDEO_VULKAN 1
|
#define SDL_VIDEO_VULKAN 1
|
||||||
#else
|
#else
|
||||||
#define SDL_VIDEO_VULKAN 0
|
#define SDL_VIDEO_VULKAN 0
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SDL_VIDEO_METAL
|
||||||
|
#if SDL_PLATFORM_SUPPORTS_METAL
|
||||||
|
#define SDL_VIDEO_METAL 1
|
||||||
|
#else
|
||||||
|
#define SDL_VIDEO_METAL 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Enable system power support */
|
/* Enable system power support */
|
||||||
#define SDL_POWER_MACOSX 1
|
#define SDL_POWER_MACOSX 1
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -73,8 +73,8 @@
|
|||||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||||
# endif
|
# endif
|
||||||
# if defined (_M_ARM64)
|
# if defined (_M_ARM64)
|
||||||
# include <armintr.h>
|
# include <arm64intr.h>
|
||||||
# include <arm_neon.h>
|
# include <arm64_neon.h>
|
||||||
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
# define __ARM_NEON 1 /* Set __ARM_NEON so that it can be used elsewhere, at compile time */
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@@ -186,6 +186,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void);
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function returns true if the CPU has ARM SIMD (ARMv6) features.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns true if the CPU has NEON (ARM SIMD) features.
|
* This function returns true if the CPU has NEON (ARM SIMD) features.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -42,10 +42,13 @@
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#define SDL_BYTEORDER __BYTE_ORDER
|
#define SDL_BYTEORDER __BYTE_ORDER
|
||||||
#else /* __linux__ */
|
#elif defined(__OpenBSD__)
|
||||||
|
#include <endian.h>
|
||||||
|
#define SDL_BYTEORDER BYTE_ORDER
|
||||||
|
#else
|
||||||
#if defined(__hppa__) || \
|
#if defined(__hppa__) || \
|
||||||
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
|
||||||
(defined(__MIPS__) && defined(__MISPEB__)) || \
|
(defined(__MIPS__) && defined(__MIPSEB__)) || \
|
||||||
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
|
||||||
defined(__sparc__)
|
defined(__sparc__)
|
||||||
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
#define SDL_BYTEORDER SDL_BIG_ENDIAN
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -37,9 +37,45 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Public functions */
|
/* Public functions */
|
||||||
/* SDL_SetError() unconditionally returns -1. */
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Set the error message for the current thread
|
||||||
|
*
|
||||||
|
* \return -1, there is no error handling for this function
|
||||||
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
extern DECLSPEC int SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the last error message that was set
|
||||||
|
*
|
||||||
|
* SDL API functions may set error messages and then succeed, so you should
|
||||||
|
* only use the error value if a function fails.
|
||||||
|
*
|
||||||
|
* This returns a pointer to a static buffer for convenience and should not
|
||||||
|
* be called by multiple threads simultaneously.
|
||||||
|
*
|
||||||
|
* \return a pointer to the last error message that was set
|
||||||
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
|
extern DECLSPEC const char *SDLCALL SDL_GetError(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get the last error message that was set for the current thread
|
||||||
|
*
|
||||||
|
* SDL API functions may set error messages and then succeed, so you should
|
||||||
|
* only use the error value if a function fails.
|
||||||
|
*
|
||||||
|
* \param errstr A buffer to fill with the last error message that was set
|
||||||
|
* for the current thread
|
||||||
|
* \param maxlen The size of the buffer pointed to by the errstr parameter
|
||||||
|
*
|
||||||
|
* \return errstr
|
||||||
|
*/
|
||||||
|
extern DECLSPEC char * SDLCALL SDL_GetErrorMsg(char *errstr, int maxlen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Clear the error message for the current thread
|
||||||
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
extern DECLSPEC void SDLCALL SDL_ClearError(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -442,6 +442,7 @@ typedef struct SDL_TouchFingerEvent
|
|||||||
float dx; /**< Normalized in the range -1...1 */
|
float dx; /**< Normalized in the range -1...1 */
|
||||||
float dy; /**< Normalized in the range -1...1 */
|
float dy; /**< Normalized in the range -1...1 */
|
||||||
float pressure; /**< Normalized in the range 0...1 */
|
float pressure; /**< Normalized in the range 0...1 */
|
||||||
|
Uint32 windowID; /**< The window underneath the finger, if any */
|
||||||
} SDL_TouchFingerEvent;
|
} SDL_TouchFingerEvent;
|
||||||
|
|
||||||
|
|
||||||
@@ -558,7 +559,7 @@ typedef union SDL_Event
|
|||||||
{
|
{
|
||||||
Uint32 type; /**< Event type, shared with all events */
|
Uint32 type; /**< Event type, shared with all events */
|
||||||
SDL_CommonEvent common; /**< Common event data */
|
SDL_CommonEvent common; /**< Common event data */
|
||||||
SDL_DisplayEvent display; /**< Window event data */
|
SDL_DisplayEvent display; /**< Display event data */
|
||||||
SDL_WindowEvent window; /**< Window event data */
|
SDL_WindowEvent window; /**< Window event data */
|
||||||
SDL_KeyboardEvent key; /**< Keyboard event data */
|
SDL_KeyboardEvent key; /**< Keyboard event data */
|
||||||
SDL_TextEditingEvent edit; /**< Text editing event data */
|
SDL_TextEditingEvent edit; /**< Text editing event data */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -57,6 +57,16 @@ extern "C" {
|
|||||||
struct _SDL_GameController;
|
struct _SDL_GameController;
|
||||||
typedef struct _SDL_GameController SDL_GameController;
|
typedef struct _SDL_GameController SDL_GameController;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SDL_CONTROLLER_TYPE_UNKNOWN = 0,
|
||||||
|
SDL_CONTROLLER_TYPE_XBOX360,
|
||||||
|
SDL_CONTROLLER_TYPE_XBOXONE,
|
||||||
|
SDL_CONTROLLER_TYPE_PS3,
|
||||||
|
SDL_CONTROLLER_TYPE_PS4,
|
||||||
|
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO,
|
||||||
|
SDL_CONTROLLER_TYPE_VIRTUAL
|
||||||
|
} SDL_GameControllerType;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -175,6 +185,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
|
extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type of a game controller.
|
||||||
|
* This can be called before any controllers are opened.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(int joystick_index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the mapping of a game controller.
|
* Get the mapping of a game controller.
|
||||||
* This can be called before any controllers are opened.
|
* This can be called before any controllers are opened.
|
||||||
@@ -199,11 +215,21 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
|
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL_JoystickID joyid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the SDL_GameController associated with a player index.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(int player_index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name for this currently opened controller
|
* Return the name for this currently opened controller
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
|
extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the type of this currently opened controller
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerGetType(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the player index of an opened game controller, or -1 if it's not available
|
* Get the player index of an opened game controller, or -1 if it's not available
|
||||||
*
|
*
|
||||||
@@ -211,6 +237,11 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
|
extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the player index of an opened game controller
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the USB vendor ID of an opened controller, if available.
|
* Get the USB vendor ID of an opened controller, if available.
|
||||||
* If the vendor ID isn't available this function returns 0.
|
* If the vendor ID isn't available this function returns 0.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -336,6 +336,23 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||||||
*/
|
*/
|
||||||
#define SDL_HAPTIC_SPHERICAL 2
|
#define SDL_HAPTIC_SPHERICAL 2
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Uses first axis only.
|
||||||
|
* For some device with only one axis (steering wheel,...),
|
||||||
|
* SDL_HAPTIC_CARTESIAN does not work. SDL_HAPTIC_FIRST_AXIS can be used in
|
||||||
|
* this case.
|
||||||
|
* Using SDL_HAPTIC_FIRST_AXIS is equivalent to :
|
||||||
|
* \code
|
||||||
|
* SDL_HapticDirection direction;
|
||||||
|
* direction.type = SDL_HAPTIC_CARTESIAN;
|
||||||
|
* direction.dir[0] = 1;
|
||||||
|
* direction.dir[1] = 0;
|
||||||
|
* direction.dir[2] = 0;
|
||||||
|
* \endcode
|
||||||
|
* \sa SDL_HapticDirection
|
||||||
|
*/
|
||||||
|
#define SDL_HAPTIC_FIRST_AXIS 3
|
||||||
|
|
||||||
/* @} *//* Direction encodings */
|
/* @} *//* Direction encodings */
|
||||||
|
|
||||||
/* @} *//* Haptic features */
|
/* @} *//* Haptic features */
|
||||||
@@ -444,6 +461,7 @@ typedef struct _SDL_Haptic SDL_Haptic;
|
|||||||
* \sa SDL_HAPTIC_POLAR
|
* \sa SDL_HAPTIC_POLAR
|
||||||
* \sa SDL_HAPTIC_CARTESIAN
|
* \sa SDL_HAPTIC_CARTESIAN
|
||||||
* \sa SDL_HAPTIC_SPHERICAL
|
* \sa SDL_HAPTIC_SPHERICAL
|
||||||
|
* \sa SDL_HAPTIC_FIRST_AXIS
|
||||||
* \sa SDL_HapticEffect
|
* \sa SDL_HapticEffect
|
||||||
* \sa SDL_HapticNumAxes
|
* \sa SDL_HapticNumAxes
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -164,6 +164,21 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
|
#define SDL_HINT_VIDEO_ALLOW_SCREENSAVER "SDL_VIDEO_ALLOW_SCREENSAVER"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether the graphics context is externally managed.
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - SDL will manage graphics contexts that are attached to windows.
|
||||||
|
* "1" - Disable graphics context management on windows.
|
||||||
|
*
|
||||||
|
* By default SDL will manage OpenGL contexts in certain situations. For example, on Android the
|
||||||
|
* context will be automatically saved and restored when pausing the application. Additionally, some
|
||||||
|
* platforms will assume usage of OpenGL if Vulkan isn't used. Setting this to "1" will prevent this
|
||||||
|
* behavior, which is desireable when the application manages the graphics context, such as
|
||||||
|
* an externally managed OpenGL context or attaching a Vulkan surface to the window.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VIDEO_EXTERNAL_CONTEXT "SDL_VIDEO_EXTERNAL_CONTEXT"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether the X11 VidMode extension should be used.
|
* \brief A variable controlling whether the X11 VidMode extension should be used.
|
||||||
*
|
*
|
||||||
@@ -197,6 +212,12 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
|
#define SDL_HINT_VIDEO_X11_XRANDR "SDL_VIDEO_X11_XRANDR"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable forcing the visual ID chosen for new X11 windows
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VIDEO_X11_WINDOW_VISUALID "SDL_VIDEO_X11_WINDOW_VISUALID"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
|
* \brief A variable controlling whether the X11 _NET_WM_PING protocol should be supported.
|
||||||
*
|
*
|
||||||
@@ -223,6 +244,17 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
|
#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether X11 should use GLX or EGL by default
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - Use GLX
|
||||||
|
* "1" - Use EGL
|
||||||
|
*
|
||||||
|
* By default SDL will use GLX when both are present.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
|
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
|
||||||
*
|
*
|
||||||
@@ -282,6 +314,17 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
|
#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether relative mouse motion is affected by renderer scaling
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - Relative motion is unaffected by DPI or renderer's logical size
|
||||||
|
* "1" - Relative motion is scaled according to DPI scaling and logical size
|
||||||
|
*
|
||||||
|
* By default relative mouse deltas are affected by DPI and renderer scaling
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
|
* \brief A variable controlling whether relative mouse mode is implemented using mouse warping
|
||||||
*
|
*
|
||||||
@@ -436,6 +479,24 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
|
#define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable that overrides the automatic controller type detection
|
||||||
|
*
|
||||||
|
* The variable should be comma separated entries, in the form: VID/PID=type
|
||||||
|
*
|
||||||
|
* The VID and PID should be hexadecimal with exactly 4 digits, e.g. 0x00fd
|
||||||
|
*
|
||||||
|
* The type should be one of:
|
||||||
|
* Xbox360
|
||||||
|
* XboxOne
|
||||||
|
* PS3
|
||||||
|
* PS4
|
||||||
|
* SwitchPro
|
||||||
|
*
|
||||||
|
* This hint affects what driver is used, and must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER)
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_GAMECONTROLLERTYPE "SDL_GAMECONTROLLERTYPE"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable that lets you manually hint extra gamecontroller db entries.
|
* \brief A variable that lets you manually hint extra gamecontroller db entries.
|
||||||
*
|
*
|
||||||
@@ -482,6 +543,29 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
|
#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief If set, game controller face buttons report their values according to their labels instead of their positional layout.
|
||||||
|
*
|
||||||
|
* For example, on Nintendo Switch controllers, normally you'd get:
|
||||||
|
*
|
||||||
|
* (Y)
|
||||||
|
* (X) (B)
|
||||||
|
* (A)
|
||||||
|
*
|
||||||
|
* but if this hint is set, you'll get:
|
||||||
|
*
|
||||||
|
* (X)
|
||||||
|
* (Y) (A)
|
||||||
|
* (B)
|
||||||
|
*
|
||||||
|
* The variable can be set to the following values:
|
||||||
|
* "0" - Report the face buttons by position, as though they were on an Xbox controller.
|
||||||
|
* "1" - Report the face buttons by label instead of position
|
||||||
|
*
|
||||||
|
* The default value is "1". This hint may be set at any time.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
|
* \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background.
|
||||||
*
|
*
|
||||||
@@ -561,10 +645,34 @@ extern "C" {
|
|||||||
* "0" - HIDAPI driver is not used
|
* "0" - HIDAPI driver is not used
|
||||||
* "1" - HIDAPI driver is used
|
* "1" - HIDAPI driver is used
|
||||||
*
|
*
|
||||||
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
|
* The default is "0" on Windows, otherwise the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||||
*/
|
*/
|
||||||
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
|
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated
|
||||||
|
* data from XInput.
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - HIDAPI Xbox driver will only use HIDAPI data
|
||||||
|
* "1" - HIDAPI Xbox driver will also pull data from XInput, providing better trigger axes, guide button
|
||||||
|
* presses, and rumble support
|
||||||
|
*
|
||||||
|
* The default is "1". This hint applies to any joysticks opened after setting the hint.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT "SDL_JOYSTICK_HIDAPI_CORRELATE_XINPUT"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used.
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - HIDAPI driver is not used
|
||||||
|
* "1" - HIDAPI driver is used
|
||||||
|
*
|
||||||
|
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE "SDL_JOYSTICK_HIDAPI_GAMECUBE"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
|
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
|
||||||
*
|
*
|
||||||
@@ -576,6 +684,15 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
|
#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
|
||||||
|
*
|
||||||
|
* This variable can be set to the following values:
|
||||||
|
* "0" - RAWINPUT drivers are not used
|
||||||
|
* "1" - RAWINPUT drivers are used (the default)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_JOYSTICK_RAWINPUT "SDL_JOYSTICK_RAWINPUT"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
|
* \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it.
|
||||||
@@ -913,7 +1030,8 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
|
* \brief Tell SDL not to catch the SIGINT or SIGTERM signals.
|
||||||
*
|
*
|
||||||
* This hint only applies to Unix-like platforms.
|
* This hint only applies to Unix-like platforms, and should set before
|
||||||
|
* any calls to SDL_Init()
|
||||||
*
|
*
|
||||||
* The variable can be set to the following values:
|
* The variable can be set to the following values:
|
||||||
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
|
* "0" - SDL will install a SIGINT and SIGTERM handler, and when it
|
||||||
@@ -1174,6 +1292,20 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
|
#define SDL_HINT_WAVE_FACT_CHUNK "SDL_WAVE_FACT_CHUNK"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \brief Override for SDL_GetDisplayUsableBounds()
|
||||||
|
*
|
||||||
|
* If set, this hint will override the expected results for
|
||||||
|
* SDL_GetDisplayUsableBounds() for display index 0. Generally you don't want
|
||||||
|
* to do this, but this allows an embedded system to request that some of the
|
||||||
|
* screen be reserved for other uses when paired with a well-behaved
|
||||||
|
* application.
|
||||||
|
*
|
||||||
|
* The contents of this hint must be 4 comma-separated integers, the first
|
||||||
|
* is the bounds x, then y, width and height, in that order.
|
||||||
|
*/
|
||||||
|
#define SDL_HINT_DISPLAY_USABLE_BOUNDS "SDL_DISPLAY_USABLE_BOUNDS"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief An enumeration of hint priorities
|
* \brief An enumeration of hint priorities
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -105,6 +105,7 @@ typedef enum
|
|||||||
SDL_JOYSTICK_POWER_MAX
|
SDL_JOYSTICK_POWER_MAX
|
||||||
} SDL_JoystickPowerLevel;
|
} SDL_JoystickPowerLevel;
|
||||||
|
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -192,7 +193,46 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
|
|||||||
/**
|
/**
|
||||||
* Return the SDL_Joystick associated with an instance id.
|
* Return the SDL_Joystick associated with an instance id.
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID joyid);
|
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID instance_id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the SDL_Joystick associated with a player index.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromPlayerIndex(int player_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attaches a new virtual joystick.
|
||||||
|
* Returns the joystick's device index, or -1 if an error occurred.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
|
||||||
|
int naxes,
|
||||||
|
int nbuttons,
|
||||||
|
int nhats);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detaches a virtual joystick
|
||||||
|
* Returns 0 on success, or -1 if an error occurred.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates whether or not a virtual-joystick is at a given device index.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set values on an opened, virtual-joystick's controls.
|
||||||
|
* Please note that values set here will not be applied until the next
|
||||||
|
* call to SDL_JoystickUpdate, which can either be called directly,
|
||||||
|
* or can be called indirectly through various other SDL APIS,
|
||||||
|
* including, but not limited to the following: SDL_PollEvent,
|
||||||
|
* SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.
|
||||||
|
*
|
||||||
|
* Returns 0 on success, -1 on error.
|
||||||
|
*/
|
||||||
|
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
|
||||||
|
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
|
||||||
|
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the name for this currently opened joystick.
|
* Return the name for this currently opened joystick.
|
||||||
@@ -207,6 +247,11 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick);
|
|||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
|
extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the player index of an opened joystick
|
||||||
|
*/
|
||||||
|
extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick * joystick, int player_index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the GUID for this opened joystick
|
* Return the GUID for this opened joystick
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -47,7 +47,7 @@ typedef Sint32 SDL_Keycode;
|
|||||||
#define SDLK_SCANCODE_MASK (1<<30)
|
#define SDLK_SCANCODE_MASK (1<<30)
|
||||||
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
|
||||||
|
|
||||||
enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SDLK_UNKNOWN = 0,
|
SDLK_UNKNOWN = 0,
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ enum
|
|||||||
|
|
||||||
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
|
SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND),
|
||||||
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
|
SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
|
||||||
};
|
} SDL_KeyCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Enumeration of valid key mods (possibly OR'd together).
|
* \brief Enumeration of valid key mods (possibly OR'd together).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
@@ -61,7 +61,7 @@ extern "C" {
|
|||||||
* at the VERBOSE level and all other categories are enabled at the
|
* at the VERBOSE level and all other categories are enabled at the
|
||||||
* CRITICAL level.
|
* CRITICAL level.
|
||||||
*/
|
*/
|
||||||
enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LOG_CATEGORY_APPLICATION,
|
||||||
SDL_LOG_CATEGORY_ERROR,
|
SDL_LOG_CATEGORY_ERROR,
|
||||||
@@ -94,7 +94,7 @@ enum
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
SDL_LOG_CATEGORY_CUSTOM
|
SDL_LOG_CATEGORY_CUSTOM
|
||||||
};
|
} SDL_LogCategory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief The predefined log priorities
|
* \brief The predefined log priorities
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Simple DirectMedia Layer
|
Simple DirectMedia Layer
|
||||||
Copyright (C) 1997-2019 Sam Lantinga <slouken@libsdl.org>
|
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
|||||||
Loaded 100 of 269 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user