mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
docs: add doxygen (#1004)
This commit is contained in:
117
CHANGELOG.md
117
CHANGELOG.md
@@ -1,18 +1,18 @@
|
||||
# Changelog
|
||||
|
||||
## [0.18.4] - 2023-02-20
|
||||
### Fixed
|
||||
**Fixed**
|
||||
- (Linux/AUR) Drop support of AUR package
|
||||
- (Docker) General enhancements to docker images
|
||||
|
||||
## [0.18.3] - 2023-02-13
|
||||
### Added
|
||||
**Added**
|
||||
- (Linux) Added PKGBUILD for Archlinux based distros to releases
|
||||
- (Linux) Added precompiled package for Archlinux based distros to releases
|
||||
- (Docker) Added archlinux docker image (x86_64 only)
|
||||
|
||||
## [0.18.2] - 2023-02-13
|
||||
### Fixed
|
||||
**Fixed**
|
||||
- (Video/KMV/Linux) Fixed wayland capture on Nvidia for KMS
|
||||
- (Video/Linux) Implement vaSyncBuffer stuf for libva <2.9.0
|
||||
- (UI) Fix issue where mime type was not being set for node_modules when using a reverse proxy
|
||||
@@ -21,7 +21,7 @@
|
||||
- (Video/AMF) Add missing encoder tunables
|
||||
|
||||
## [0.18.1] - 2023-01-31
|
||||
### Fixed
|
||||
**Fixed**
|
||||
- (Linux) Fixed missing dependencies for deb and rpm packages
|
||||
- (Linux) Use dynamic boost
|
||||
|
||||
@@ -30,13 +30,14 @@ Attention, this release contains critical security fixes. Please update as soon
|
||||
encouraging users to change your Sunshine password, especially if you expose the web UI (i.e. port 47790 by default)
|
||||
to the internet, or have ever uploaded your logs with verbose output to a public resource.
|
||||
|
||||
### Added
|
||||
**Added**
|
||||
- (Windows) Add support for Intel QuickSync
|
||||
- (Linux) Added aarch64 deb and rpm packages
|
||||
- (Windows) Add support for hybrid graphics systems, such as laptops with both integrated and discrete GPUs
|
||||
- (Linux) Add support for streaming from Steam Deck Gaming Mode
|
||||
- (Windows) Add HDR support, see https://docs.lizardbyte.dev/projects/sunshine/en/latest/about/usage.html#hdr-support
|
||||
### Fixed
|
||||
|
||||
**Fixed**
|
||||
- (Network) Refactor code for UPnP port forwarding
|
||||
- (Video) Enforce 10 FPS encoding frame rate minimum to improve static image quality
|
||||
- (Linux) deb and rpm packages are now specific to destination distro and version
|
||||
@@ -60,18 +61,20 @@ location which is problematic when running as a service or on a multi-user syste
|
||||
as a service, games and applications were launched as SYSTEM. This could lead to issues with save files and other game
|
||||
settings. In v0.17.0, games now run under your user account without elevated privileges.
|
||||
|
||||
### Breaking
|
||||
**Breaking**
|
||||
- (Apps) Removed automatic desktop entry (Re-add by adding an empty application named "Desktop" with no commands, "desktop.png" can be added as the image.)
|
||||
- (Windows) Improved user upgrade experience (Suggest to manually uninstall existing Sunshine version before this upgrade. Do NOT select to remove everything, if prompted. Make a backup of config files before uninstall.)
|
||||
- (Windows) Move config files to specific directory (files will be migrated automatically if using Windows installer)
|
||||
- (Dependencies) Fix npm path (breaking change for package maintainers)
|
||||
### Added
|
||||
|
||||
**Added**
|
||||
- (macOS) Added initial support for arm64 on macOS through Macports portfile
|
||||
- (Input) Added support for foreign keyboard input
|
||||
- (Misc) Logs inside the WebUI and log to file
|
||||
- (UI/Windows) Added an Apply button to configuration page when running as a service
|
||||
- (Input/Windows) Enable Mouse Keys while streaming for systems with no physical mouse
|
||||
### Fixed
|
||||
|
||||
**Fixed**
|
||||
- (Video) Improved capture performance
|
||||
- (Audio) Improved audio bitrate and quality handling
|
||||
- (Apps/Windows) Fixed PATH environment variable handling
|
||||
@@ -95,7 +98,8 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
- (Service/Windows) Self terminate/restart service if process hangs for 10 seconds
|
||||
- (Input/Windows) Fix Windows masked cursor blending with GPU encoders
|
||||
- (Video) Color conversion fixes and BT.2020 support
|
||||
### Dependencies
|
||||
|
||||
**Dependencies**
|
||||
- Bump ffmpeg from 4.4 to 5.1
|
||||
- ffmpeg_patches: add amfenc delay/buffering fix
|
||||
- CBS moved to ffmpeg submodules
|
||||
@@ -108,15 +112,17 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
- Bump @fortawesome/fontawesome-free from 6.2.0 to 6.2.1
|
||||
|
||||
## [0.16.0] - 2022-12-13
|
||||
### Added
|
||||
**Added**
|
||||
- Add cover finder
|
||||
- (Docker) Add arm64 docker image
|
||||
- (Flatpak) Add installation helper scripts
|
||||
- (Windows) Add support for Unicode input messages
|
||||
### Fixed
|
||||
|
||||
**Fixed**
|
||||
- (Linux) Reintroduce Ubuntu 20.04 and 22.04 specific deb packages
|
||||
- (Linux) Fixed udev and systemd file locations
|
||||
### Dependencies
|
||||
|
||||
**Dependencies**
|
||||
- Bump babel from 2.10.3 to 2.11.0
|
||||
- Bump sphinx-copybutton from 0.5.0 to 0.5.1
|
||||
- Bump KSXGitHub/github-actions-deploy-aur from 2.5.0 to 2.6.0
|
||||
@@ -124,23 +130,26 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
- Update moonlight-common-c
|
||||
- Use pre-built ffmpeg from LizardByte/build-deps for all sunshine builds (breaking change for third-party package maintainers)
|
||||
- Bump furo from 2022.9.29 to 2022.12.7
|
||||
### Misc
|
||||
|
||||
**Misc**
|
||||
- Misc org level workflow updates
|
||||
- Fix misc typos in docs
|
||||
- Fix winget release
|
||||
|
||||
## [0.15.0] - 2022-10-30
|
||||
### Added
|
||||
**Added**
|
||||
- (Windows) Add firewall rules scripts
|
||||
- (Windows) Automatically add and remove firewall rules at install/uninstall
|
||||
- (Windows) Automatically add and remove service at install/uninstall
|
||||
- (Docker) Official image added
|
||||
- (Linux) Add aarch64 flatpak package
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- (Windows/Linux/MacOS) - Move default config and apps file to assets directory
|
||||
- (MacOS) Bump boost to 1.80 for macport builds
|
||||
- (Linux) Remove backup and restore of config files
|
||||
### Fixed
|
||||
|
||||
**Fixed**
|
||||
- (Linux) - Create sunshine config directory if it doesn't exist
|
||||
- (Linux) Remove portable home and config directories for AppImage
|
||||
- (Windows) Include service install and uninstall scripts again
|
||||
@@ -151,27 +160,31 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
- (Linux) Fix CUDA RGBA to NV12 conversion
|
||||
|
||||
## [0.14.1] - 2022-08-09
|
||||
### Added
|
||||
**Added**
|
||||
- (Linux) Flatpak package added
|
||||
- (Linux) AUR package automated updates
|
||||
- (Windows) Winget package automated updates
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- (General) Moved repo to @LizardByte GitHub org
|
||||
- (WebUI) Fixed button spacing on home page
|
||||
- (WebUI) Added Discord WidgetBot Crate
|
||||
### Fixed
|
||||
|
||||
**Fixed**
|
||||
- (Linux/Mac) Default config and app files now copied to user home directory
|
||||
- (Windows) Default config and app files now copied to working directory
|
||||
|
||||
## [0.14.0] - 2022-06-15
|
||||
### Added
|
||||
|
||||
**Added**
|
||||
- (Documentation) Added Sphinx documentation available at https://sunshinestream.readthedocs.io/en/latest/
|
||||
- (Development) Initial support for Localization
|
||||
- (Linux) Add rpm package as release asset
|
||||
- (macOS) Add Portfile as release asset
|
||||
- (Windows) Add DwmFlush() call to improve capture
|
||||
- (Windows) Add Windows installer
|
||||
### Fixed
|
||||
|
||||
**Fixed**
|
||||
- (AMD) Fixed hwdevice being destroyed before context
|
||||
- (Linux) Added missing dependencies to AppImage
|
||||
- (Linux) Fixed rumble events causing game to freeze
|
||||
@@ -182,41 +195,44 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
- (Stream/Video) AVPacket fix
|
||||
|
||||
## [0.13.0] - 2022-02-27
|
||||
### Added
|
||||
**Added**
|
||||
- (macOS) Initial support for macOS (#40)
|
||||
|
||||
## [0.12.0] - 2022-02-13
|
||||
### Added
|
||||
**Added**
|
||||
- New command line argument `--version`
|
||||
- Custom png poster support
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- Correct software bitrate calculation
|
||||
- Increase vbv-bufsize to 1/10 of requested bitrate
|
||||
- Improvements to Web UI
|
||||
|
||||
## [0.11.1] - 2021-10-04
|
||||
### Changed
|
||||
**Changed**
|
||||
- (Linux) Fix search path for config file and assets
|
||||
|
||||
## [0.11.0] - 2021-10-04
|
||||
### Added
|
||||
**Added**
|
||||
- (Linux) Added support for wlroots based compositors on Wayland.
|
||||
- (Windows) Added an icon for the executable
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- Fixed a bug causing segfault when connecting multiple controllers.
|
||||
- (Linux) Improved NVENC, it now offloads converting images from RGB to NV12
|
||||
- (Linux) Fixed a bug causes stuttering
|
||||
|
||||
## [0.10.1] - 2021-08-21
|
||||
### Changed
|
||||
**Changed**
|
||||
- (Linux) Re-enabled KMS
|
||||
|
||||
## [0.10.0] - 2021-08-20
|
||||
### Added
|
||||
**Added**
|
||||
- Added support for Rumble with gamepads.
|
||||
- Added support for keyboard shortcuts <--- See the README for details.
|
||||
- (Windows) A very basic script has been added in Sunshine-Windows\tools <-- This will start Sunshine at boot with the highest privileges which is needed to display the login prompt.
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- Some cosmetic changes to the WebUI.
|
||||
- The first time the WebUI is opened, it will request the creation of a username/password pair from the user.
|
||||
- Fixed audio crackling introduced in version 0.8.0
|
||||
@@ -224,54 +240,58 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
- (Windows) Installing from debian package shouldn't overwrite your configuration files anymore. <-- It's recommended that you back up `/etc/sunshine/` before testing this.
|
||||
|
||||
## [0.9.0] - 2021-07-11
|
||||
### Added
|
||||
**Added**
|
||||
- Added audio encryption
|
||||
- (Linux) Added basic NVENC support on Linux
|
||||
- (Windows) The Windows version can now capture the lock screen and the UAC prompt as long as it's run through `PsExec.exe` https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- Sunshine will now accept expired or not-yet-valid certificates, as long as they are signed properly.
|
||||
- Fixed compatibility with iOS version of Moonlight
|
||||
- Drastically reduced chance of being forced to skip error correction due to video frame size
|
||||
- (Linux) sunshine.service will be installed automatically.
|
||||
|
||||
## [0.8.0] - 2021-06-30
|
||||
### Added
|
||||
**Added**
|
||||
- Added mDNS support: Moonlight will automatically find Sunshine.
|
||||
- Added UPnP support. It's off by default.
|
||||
|
||||
## [0.7.7] - 2021-06-24
|
||||
### Added
|
||||
**Added**
|
||||
- (Linux) Added installation package for Debian
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- Fixed incorrect scaling for absolute mouse coordinates when using multiple monitors.
|
||||
- Fixed incorrect colors when scaling for software encoder
|
||||
|
||||
## [0.7.1] - 2021-06-18
|
||||
### Changed
|
||||
**Changed**
|
||||
- (Linux) Fixed an issue where it was impossible to start sunshine on ubuntu 20.04
|
||||
|
||||
## [0.7.0] - 2021-06-16
|
||||
### Added
|
||||
**Added**
|
||||
- Added a Web Manager. Accessible through: https://localhost:47990 or https://<ip of your pc>:47990
|
||||
- (Linux) Added hardware encoding support for AMD on Linux
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- (Linux) Moved certificates and saved pairings generated during runtime to .config/sunshine on Linux
|
||||
|
||||
## [0.6.0] - 2021-05-26
|
||||
### Added
|
||||
**Added**
|
||||
- Added support for surround audio
|
||||
### Changed
|
||||
|
||||
**Changed**
|
||||
- Maintain aspect ratio when scaling video
|
||||
- Fix issue where Sunshine is forced to drop frames when they are too large
|
||||
|
||||
## [0.5.0] - 2021-05-13
|
||||
### Added
|
||||
**Added**
|
||||
- Added support for absolute mouse coordinates
|
||||
- (Linux) Added support for streaming specific monitor on Linux
|
||||
- (Windows) Added support for AMF on Windows
|
||||
|
||||
## [0.4.0] - 2020-05-03
|
||||
### Changed
|
||||
**Changed**
|
||||
- prep-cmd is now optional in apps.json
|
||||
- Fixed bug causing video artifacts
|
||||
- Fixed bug preventing Moonlight from closing app on exit
|
||||
@@ -280,25 +300,25 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
- Fixed bug causing crash when monitor has resolution 1366x768
|
||||
|
||||
## [0.3.1] - 2020-04-24
|
||||
### Changed
|
||||
**Changed**
|
||||
- Fix a memory leak.
|
||||
|
||||
## [0.3.0] - 2020-04-23
|
||||
### Changed
|
||||
**Changed**
|
||||
- Hardware acceleration on NVidia GPU's for Video encoding on Windows
|
||||
|
||||
## [0.2.0] - 2020-03-21
|
||||
### Changed
|
||||
**Changed**
|
||||
- Multicasting is now supported: You can set the maximum simultaneous connections with the configurable option: channels
|
||||
- Configuration variables can be overwritten on the command line: "name=value" --> it can be useful to set min_log_level=debug without modifying the configuration file
|
||||
- Switches to make testing the pairing mechanism more convenient has been added, see "sunshine --help" for details
|
||||
|
||||
## [0.1.1] - 2020-01-30
|
||||
### Added
|
||||
**Added**
|
||||
- (Linux) Added deb package and service for Linux
|
||||
|
||||
## [0.1.0] - 2020-01-27
|
||||
### Added
|
||||
**Added**
|
||||
- The first official release for Sunshine!
|
||||
|
||||
[0.1.0]: https://github.com/LizardByte/Sunshine/releases/tag/v0.1.0
|
||||
@@ -329,3 +349,4 @@ settings. In v0.17.0, games now run under your user account without elevated pri
|
||||
[0.18.1]: https://github.com/LizardByte/Sunshine/releases/tag/v0.18.1
|
||||
[0.18.2]: https://github.com/LizardByte/Sunshine/releases/tag/v0.18.2
|
||||
[0.18.3]: https://github.com/LizardByte/Sunshine/releases/tag/v0.18.3
|
||||
[0.18.4]: https://github.com/LizardByte/Sunshine/releases/tag/v0.18.4
|
||||
|
||||
2778
docs/Doxyfile
Normal file
2778
docs/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
breathe==4.35.0
|
||||
furo==2022.12.7
|
||||
m2r2==0.3.3.post2
|
||||
Sphinx==6.1.3
|
||||
|
||||
1
docs/source/about/changelog.rst
Normal file
1
docs/source/about/changelog.rst
Normal file
@@ -0,0 +1 @@
|
||||
.. mdinclude:: ../../../CHANGELOG.md
|
||||
@@ -1,3 +1 @@
|
||||
:github_url: https://github.com/LizardByte/Sunshine/tree/nightly/docs/DOCKER_README.md
|
||||
|
||||
.. mdinclude:: ../../../DOCKER_README.md
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
from datetime import datetime
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
|
||||
# -- Path setup --------------------------------------------------------------
|
||||
@@ -43,9 +44,11 @@ To use cmake method for obtaining version instead of regex,
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'breathe', # c++ support for sphinx with doxygen
|
||||
'm2r2', # enable markdown files
|
||||
'sphinx.ext.autosectionlabel',
|
||||
'sphinx.ext.todo', # enable to-do sections
|
||||
'sphinx.ext.graphviz', # enable graphs for breathe
|
||||
'sphinx.ext.viewcode', # add links to view source code
|
||||
'sphinx_copybutton', # add a copy button to code blocks
|
||||
]
|
||||
@@ -82,4 +85,12 @@ html_theme_options = {
|
||||
|
||||
# extension config options
|
||||
autosectionlabel_prefix_document = True # Make sure the target is unique
|
||||
breathe_default_project = 'src'
|
||||
breathe_implementation_filename_extensions = ['.c', '.cc', '.cpp', '.mm']
|
||||
breathe_order_parameters_first = False
|
||||
breathe_projects = dict(
|
||||
src="../build/doxyxml"
|
||||
)
|
||||
todo_include_todos = True
|
||||
|
||||
subprocess.run('doxygen', shell=True, cwd=source_dir)
|
||||
|
||||
@@ -14,11 +14,16 @@ Test clang-format locally.
|
||||
Sphinx
|
||||
------
|
||||
Sunshine uses `Sphinx <https://www.sphinx-doc.org/en/master/>`_ for documentation building. Sphinx, along with other
|
||||
required documentation depencies are included in the `./docs/requirements.txt` file. Python is required to build
|
||||
required python dependencies are included in the `./docs/requirements.txt` file. Python is required to build
|
||||
sphinx docs. Installation and setup of python will not be covered here.
|
||||
|
||||
Doxygen is used to generate the XML files required by Sphinx. Doxygen can be obtained from
|
||||
`Doxygen downloads <https://www.doxygen.nl/download.html>`_. Ensure that the `doxygen` executable is in your path.
|
||||
|
||||
The config file for Sphinx is `docs/source/conf.py`. This is already included in the repo and should not be modified.
|
||||
|
||||
The config file for Doxygen is `docs/Doxyfile`. This is already included in the repo and should not be modified.
|
||||
|
||||
Test with Sphinx
|
||||
.. code-block:: bash
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
:github_url: https://github.com/LizardByte/Sunshine/tree/nightly/docs/source/index.rst
|
||||
|
||||
Table of Contents
|
||||
=================
|
||||
.. include:: toc.rst
|
||||
|
||||
85
docs/source/source/src.rst
Normal file
85
docs/source/source/src.rst
Normal file
@@ -0,0 +1,85 @@
|
||||
src
|
||||
===
|
||||
We are in process of improving the source code documentation. Code should be documented using Doxygen syntax.
|
||||
Some examples exist in `main.h` and `main.cpp`. In order for documentation within the code to appear in the
|
||||
rendered docs, the definition of the object must be in a header file, although the documentation itself can (and
|
||||
should) be in the source file.
|
||||
|
||||
Example Documentation Blocks
|
||||
----------------------------
|
||||
|
||||
**file.h**
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
// functions
|
||||
int main(int argc, char *argv[]);
|
||||
|
||||
**file.cpp** (with markdown)
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
/**
|
||||
* @brief Main application entry point.
|
||||
* @param argc The number of arguments.
|
||||
* @param argv The arguments.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* main(1, const char* args[] = {"hello", "markdown", nullptr});
|
||||
* ```
|
||||
*/
|
||||
int main(int argc, char *argv[]) {
|
||||
// do stuff
|
||||
}
|
||||
|
||||
**file.cpp** (with ReStructuredText)
|
||||
|
||||
.. code-block:: cpp
|
||||
|
||||
/**
|
||||
* @brief Main application entry point.
|
||||
* @param argc The number of arguments.
|
||||
* @param argv The arguments.
|
||||
* @rst
|
||||
* EXAMPLES:
|
||||
*
|
||||
* .. code-block:: cpp
|
||||
* main(1, const char* args[] = {"hello", "rst", nullptr});
|
||||
* @endrst
|
||||
*/
|
||||
int main(int argc, char *argv[]) {
|
||||
// do stuff
|
||||
}
|
||||
|
||||
Code
|
||||
----
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: src
|
||||
|
||||
src/main
|
||||
src/audio
|
||||
src/cbs
|
||||
src/config
|
||||
src/confighttp
|
||||
src/crypto
|
||||
src/httpcommon
|
||||
src/input
|
||||
src/move_by_copy
|
||||
src/network
|
||||
src/nvhttp
|
||||
src/process
|
||||
src/round_robin
|
||||
src/rtsp
|
||||
src/stream
|
||||
src/sync
|
||||
src/task_pool
|
||||
src/thread_pool
|
||||
src/thread_safe
|
||||
src/upnp
|
||||
src/utility
|
||||
src/uuid
|
||||
src/video
|
||||
src/platform
|
||||
4
docs/source/source/src/audio.rst
Normal file
4
docs/source/source/src/audio.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
audio
|
||||
=====
|
||||
|
||||
.. doxygenfile:: audio.h
|
||||
4
docs/source/source/src/cbs.rst
Normal file
4
docs/source/source/src/cbs.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
cbs
|
||||
===
|
||||
|
||||
.. doxygenfile:: cbs.h
|
||||
4
docs/source/source/src/config.rst
Normal file
4
docs/source/source/src/config.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
config
|
||||
======
|
||||
|
||||
.. doxygenfile:: config.h
|
||||
4
docs/source/source/src/confighttp.rst
Normal file
4
docs/source/source/src/confighttp.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
confighttp
|
||||
==========
|
||||
|
||||
.. doxygenfile:: confighttp.h
|
||||
4
docs/source/source/src/crypto.rst
Normal file
4
docs/source/source/src/crypto.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
crypto
|
||||
======
|
||||
|
||||
.. doxygenfile:: crypto.h
|
||||
4
docs/source/source/src/httpcommon.rst
Normal file
4
docs/source/source/src/httpcommon.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
httpcommon
|
||||
==========
|
||||
|
||||
.. doxygenfile:: httpcommon.h
|
||||
4
docs/source/source/src/input.rst
Normal file
4
docs/source/source/src/input.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
input
|
||||
=====
|
||||
|
||||
.. doxygenfile:: input.h
|
||||
4
docs/source/source/src/main.rst
Normal file
4
docs/source/source/src/main.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
main
|
||||
====
|
||||
|
||||
.. doxygenfile:: main.h
|
||||
4
docs/source/source/src/move_by_copy.rst
Normal file
4
docs/source/source/src/move_by_copy.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
move_by_copy
|
||||
============
|
||||
|
||||
.. doxygenfile:: move_by_copy.h
|
||||
4
docs/source/source/src/network.rst
Normal file
4
docs/source/source/src/network.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
network
|
||||
=======
|
||||
|
||||
.. doxygenfile:: network.h
|
||||
4
docs/source/source/src/nvhttp.rst
Normal file
4
docs/source/source/src/nvhttp.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
nvhttp
|
||||
======
|
||||
|
||||
.. doxygenfile:: nvhttp.h
|
||||
10
docs/source/source/src/platform.rst
Normal file
10
docs/source/source/src/platform.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
platform
|
||||
========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
platform/common
|
||||
platform/linux
|
||||
platform/macos
|
||||
platform/windows
|
||||
4
docs/source/source/src/platform/common.rst
Normal file
4
docs/source/source/src/platform/common.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
common
|
||||
======
|
||||
|
||||
.. Todo:: Add common.h
|
||||
12
docs/source/source/src/platform/linux.rst
Normal file
12
docs/source/source/src/platform/linux.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
linux
|
||||
=====
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
linux/cuda
|
||||
linux/graphics
|
||||
linux/misc
|
||||
linux/vaapi
|
||||
linux/wayland
|
||||
linux/x11grab
|
||||
4
docs/source/source/src/platform/linux/cuda.rst
Normal file
4
docs/source/source/src/platform/linux/cuda.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
cuda
|
||||
====
|
||||
|
||||
.. Todo:: Add cuda.h
|
||||
4
docs/source/source/src/platform/linux/graphics.rst
Normal file
4
docs/source/source/src/platform/linux/graphics.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
graphics
|
||||
========
|
||||
|
||||
.. Todo:: Add graphics.h
|
||||
4
docs/source/source/src/platform/linux/misc.rst
Normal file
4
docs/source/source/src/platform/linux/misc.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
misc
|
||||
====
|
||||
|
||||
.. Todo:: Add misc.h
|
||||
4
docs/source/source/src/platform/linux/vaapi.rst
Normal file
4
docs/source/source/src/platform/linux/vaapi.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
vaapi
|
||||
=====
|
||||
|
||||
.. Todo:: Add vaapi.h
|
||||
4
docs/source/source/src/platform/linux/wayland.rst
Normal file
4
docs/source/source/src/platform/linux/wayland.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
wayland
|
||||
=======
|
||||
|
||||
.. Todo:: Add wayland.h
|
||||
4
docs/source/source/src/platform/linux/x11grab.rst
Normal file
4
docs/source/source/src/platform/linux/x11grab.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
x11grab
|
||||
=======
|
||||
|
||||
.. Todo:: Add x11grab.h
|
||||
11
docs/source/source/src/platform/macos.rst
Normal file
11
docs/source/source/src/platform/macos.rst
Normal file
@@ -0,0 +1,11 @@
|
||||
macos
|
||||
=====
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
macos/av_audio
|
||||
macos/av_img_t
|
||||
macos/av_video
|
||||
macos/misc
|
||||
macos/nv12_zero_device
|
||||
4
docs/source/source/src/platform/macos/av_audio.rst
Normal file
4
docs/source/source/src/platform/macos/av_audio.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
av_audio
|
||||
========
|
||||
|
||||
.. Todo:: Add av_audio.h
|
||||
4
docs/source/source/src/platform/macos/av_img_t.rst
Normal file
4
docs/source/source/src/platform/macos/av_img_t.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
av_img_t
|
||||
========
|
||||
|
||||
.. Todo:: Add av_img_t.h
|
||||
4
docs/source/source/src/platform/macos/av_video.rst
Normal file
4
docs/source/source/src/platform/macos/av_video.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
av_video
|
||||
========
|
||||
|
||||
.. Todo:: Add av_video.h
|
||||
4
docs/source/source/src/platform/macos/misc.rst
Normal file
4
docs/source/source/src/platform/macos/misc.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
misc
|
||||
====
|
||||
|
||||
.. Todo:: Add misc.h
|
||||
@@ -0,0 +1,4 @@
|
||||
nv12_zero_device
|
||||
================
|
||||
|
||||
.. Todo:: Add nv12_zero_device.h
|
||||
9
docs/source/source/src/platform/windows.rst
Normal file
9
docs/source/source/src/platform/windows.rst
Normal file
@@ -0,0 +1,9 @@
|
||||
windows
|
||||
=======
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
windows/display
|
||||
windows/misc
|
||||
windows/PolicyConfig
|
||||
4
docs/source/source/src/platform/windows/PolicyConfig.rst
Normal file
4
docs/source/source/src/platform/windows/PolicyConfig.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
PolicyConfig
|
||||
============
|
||||
|
||||
.. Todo:: Add PolicyConfig.h
|
||||
4
docs/source/source/src/platform/windows/display.rst
Normal file
4
docs/source/source/src/platform/windows/display.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
display
|
||||
=======
|
||||
|
||||
.. Todo:: Add display.h
|
||||
4
docs/source/source/src/platform/windows/misc.rst
Normal file
4
docs/source/source/src/platform/windows/misc.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
misc
|
||||
====
|
||||
|
||||
.. Todo:: Add misc.h
|
||||
4
docs/source/source/src/process.rst
Normal file
4
docs/source/source/src/process.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
process
|
||||
=======
|
||||
|
||||
.. doxygenfile:: process.h
|
||||
4
docs/source/source/src/round_robin.rst
Normal file
4
docs/source/source/src/round_robin.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
round_robin
|
||||
===========
|
||||
|
||||
.. doxygenfile:: round_robin.h
|
||||
4
docs/source/source/src/rtsp.rst
Normal file
4
docs/source/source/src/rtsp.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
rtsp
|
||||
====
|
||||
|
||||
.. doxygenfile:: rtsp.h
|
||||
4
docs/source/source/src/stream.rst
Normal file
4
docs/source/source/src/stream.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
stream
|
||||
======
|
||||
|
||||
.. doxygenfile:: stream.h
|
||||
4
docs/source/source/src/sync.rst
Normal file
4
docs/source/source/src/sync.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
sync
|
||||
====
|
||||
|
||||
.. doxygenfile:: sync.h
|
||||
4
docs/source/source/src/task_pool.rst
Normal file
4
docs/source/source/src/task_pool.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
tasl_pool
|
||||
=========
|
||||
|
||||
.. doxygenfile:: task_pool.h
|
||||
4
docs/source/source/src/thread_pool.rst
Normal file
4
docs/source/source/src/thread_pool.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
thread_pool
|
||||
===========
|
||||
|
||||
.. doxygenfile:: thread_pool.h
|
||||
4
docs/source/source/src/thread_safe.rst
Normal file
4
docs/source/source/src/thread_safe.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
thread_safe
|
||||
===========
|
||||
|
||||
.. doxygenfile:: thread_safe.h
|
||||
4
docs/source/source/src/upnp.rst
Normal file
4
docs/source/source/src/upnp.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
upnp
|
||||
====
|
||||
|
||||
.. doxygenfile:: upnp.h
|
||||
4
docs/source/source/src/utility.rst
Normal file
4
docs/source/source/src/utility.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
utility
|
||||
=======
|
||||
|
||||
.. Todo:: Add utility.h
|
||||
4
docs/source/source/src/uuid.rst
Normal file
4
docs/source/source/src/uuid.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
uuid
|
||||
====
|
||||
|
||||
.. doxygenfile:: uuid.h
|
||||
4
docs/source/source/src/video.rst
Normal file
4
docs/source/source/src/video.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
video
|
||||
=====
|
||||
|
||||
.. doxygenfile:: video.h
|
||||
@@ -9,6 +9,7 @@
|
||||
about/usage
|
||||
about/app_examples
|
||||
about/advanced_usage
|
||||
about/changelog
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
@@ -47,3 +48,9 @@
|
||||
:caption: Legal
|
||||
|
||||
legal/legal
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: source
|
||||
|
||||
source/src
|
||||
|
||||
@@ -838,45 +838,45 @@ void apply_config(std::unordered_map<std::string, std::string> &&vars) {
|
||||
int_f(vars, "qp", video.qp);
|
||||
int_f(vars, "min_threads", video.min_threads);
|
||||
int_between_f(vars, "hevc_mode", video.hevc_mode, { 0, 3 });
|
||||
string_f(vars, "sw_preset", video.sw.preset);
|
||||
string_f(vars, "sw_tune", video.sw.tune);
|
||||
int_f(vars, "nv_preset", video.nv.preset, nv::preset_from_view);
|
||||
int_f(vars, "nv_tune", video.nv.tune, nv::tune_from_view);
|
||||
int_f(vars, "nv_rc", video.nv.rc, nv::rc_from_view);
|
||||
int_f(vars, "nv_coder", video.nv.coder, nv::coder_from_view);
|
||||
string_f(vars, "sw_preset", video.sw.sw_preset);
|
||||
string_f(vars, "sw_tune", video.sw.sw_tune);
|
||||
int_f(vars, "nv_preset", video.nv.nv_preset, nv::preset_from_view);
|
||||
int_f(vars, "nv_tune", video.nv.nv_tune, nv::tune_from_view);
|
||||
int_f(vars, "nv_rc", video.nv.nv_rc, nv::rc_from_view);
|
||||
int_f(vars, "nv_coder", video.nv.nv_coder, nv::coder_from_view);
|
||||
|
||||
int_f(vars, "qsv_preset", video.qsv.preset, qsv::preset_from_view);
|
||||
int_f(vars, "qsv_coder", video.qsv.cavlc, qsv::coder_from_view);
|
||||
int_f(vars, "qsv_preset", video.qsv.qsv_preset, qsv::preset_from_view);
|
||||
int_f(vars, "qsv_coder", video.qsv.qsv_cavlc, qsv::coder_from_view);
|
||||
|
||||
std::string quality;
|
||||
string_f(vars, "amd_quality", quality);
|
||||
if(!quality.empty()) {
|
||||
video.amd.quality_h264 = amd::quality_from_view(quality, 1);
|
||||
video.amd.quality_hevc = amd::quality_from_view(quality, 0);
|
||||
video.amd.amd_quality_h264 = amd::quality_from_view(quality, 1);
|
||||
video.amd.amd_quality_hevc = amd::quality_from_view(quality, 0);
|
||||
}
|
||||
|
||||
std::string rc;
|
||||
string_f(vars, "amd_rc", rc);
|
||||
int_f(vars, "amd_coder", video.amd.coder, amd::coder_from_view);
|
||||
int_f(vars, "amd_coder", video.amd.amd_coder, amd::coder_from_view);
|
||||
if(!rc.empty()) {
|
||||
video.amd.rc_h264 = amd::rc_from_view(rc, 1);
|
||||
video.amd.rc_hevc = amd::rc_from_view(rc, 0);
|
||||
video.amd.amd_rc_h264 = amd::rc_from_view(rc, 1);
|
||||
video.amd.amd_rc_hevc = amd::rc_from_view(rc, 0);
|
||||
}
|
||||
|
||||
std::string usage;
|
||||
string_f(vars, "amd_usage", usage);
|
||||
if(!usage.empty()) {
|
||||
video.amd.usage_h264 = amd::usage_from_view(rc, 1);
|
||||
video.amd.usage_hevc = amd::usage_from_view(rc, 0);
|
||||
video.amd.amd_usage_h264 = amd::usage_from_view(rc, 1);
|
||||
video.amd.amd_usage_hevc = amd::usage_from_view(rc, 0);
|
||||
}
|
||||
|
||||
bool_f(vars, "amd_preanalysis", (bool &)video.amd.preanalysis);
|
||||
bool_f(vars, "amd_vbaq", (bool &)video.amd.vbaq);
|
||||
bool_f(vars, "amd_preanalysis", (bool &)video.amd.amd_preanalysis);
|
||||
bool_f(vars, "amd_vbaq", (bool &)video.amd.amd_vbaq);
|
||||
|
||||
int_f(vars, "vt_coder", video.vt.coder, vt::coder_from_view);
|
||||
int_f(vars, "vt_software", video.vt.allow_sw, vt::allow_software_from_view);
|
||||
int_f(vars, "vt_software", video.vt.require_sw, vt::force_software_from_view);
|
||||
int_f(vars, "vt_realtime", video.vt.realtime, vt::rt_from_view);
|
||||
int_f(vars, "vt_coder", video.vt.vt_coder, vt::coder_from_view);
|
||||
int_f(vars, "vt_software", video.vt.vt_allow_sw, vt::allow_software_from_view);
|
||||
int_f(vars, "vt_software", video.vt.vt_require_sw, vt::force_software_from_view);
|
||||
int_f(vars, "vt_realtime", video.vt.vt_realtime, vt::rt_from_view);
|
||||
|
||||
string_f(vars, "encoder", video.encoder);
|
||||
string_f(vars, "adapter_name", video.adapter_name);
|
||||
|
||||
42
src/config.h
42
src/config.h
@@ -17,39 +17,39 @@ struct video_t {
|
||||
|
||||
int min_threads; // Minimum number of threads/slices for CPU encoding
|
||||
struct {
|
||||
std::string preset;
|
||||
std::string tune;
|
||||
std::string sw_preset;
|
||||
std::string sw_tune;
|
||||
} sw;
|
||||
|
||||
struct {
|
||||
std::optional<int> preset;
|
||||
std::optional<int> tune;
|
||||
std::optional<int> rc;
|
||||
int coder;
|
||||
std::optional<int> nv_preset;
|
||||
std::optional<int> nv_tune;
|
||||
std::optional<int> nv_rc;
|
||||
int nv_coder;
|
||||
} nv;
|
||||
|
||||
struct {
|
||||
std::optional<int> preset;
|
||||
std::optional<int> cavlc;
|
||||
std::optional<int> qsv_preset;
|
||||
std::optional<int> qsv_cavlc;
|
||||
} qsv;
|
||||
|
||||
struct {
|
||||
std::optional<int> quality_h264;
|
||||
std::optional<int> quality_hevc;
|
||||
std::optional<int> rc_h264;
|
||||
std::optional<int> rc_hevc;
|
||||
std::optional<int> usage_h264;
|
||||
std::optional<int> usage_hevc;
|
||||
std::optional<int> preanalysis;
|
||||
std::optional<int> vbaq;
|
||||
int coder;
|
||||
std::optional<int> amd_quality_h264;
|
||||
std::optional<int> amd_quality_hevc;
|
||||
std::optional<int> amd_rc_h264;
|
||||
std::optional<int> amd_rc_hevc;
|
||||
std::optional<int> amd_usage_h264;
|
||||
std::optional<int> amd_usage_hevc;
|
||||
std::optional<int> amd_preanalysis;
|
||||
std::optional<int> amd_vbaq;
|
||||
int amd_coder;
|
||||
} amd;
|
||||
|
||||
struct {
|
||||
int allow_sw;
|
||||
int require_sw;
|
||||
int realtime;
|
||||
int coder;
|
||||
int vt_allow_sw;
|
||||
int vt_require_sw;
|
||||
int vt_realtime;
|
||||
int vt_coder;
|
||||
} vt;
|
||||
|
||||
std::string encoder;
|
||||
|
||||
@@ -18,13 +18,11 @@ static int openssl_verify_cb(int ok, X509_STORE_CTX *ctx) {
|
||||
int err_code = X509_STORE_CTX_get_error(ctx);
|
||||
|
||||
switch(err_code) {
|
||||
// FIXME: Checking for X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY is a temporary workaround to get mmonlight-embedded to work on the raspberry pi
|
||||
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
|
||||
return 1;
|
||||
|
||||
// Expired or not-yet-valid certificates are fine. Sometimes Moonlight is running on embedded devices
|
||||
// that don't have accurate clocks (or haven't yet synchronized by the time Moonlight first runs).
|
||||
// This behavior also matches what GeForce Experience does.
|
||||
// FIXME: Checking for X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY is a temporary workaround to get moonlight-embedded to work on the raspberry pi
|
||||
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
|
||||
case X509_V_ERR_CERT_NOT_YET_VALID:
|
||||
case X509_V_ERR_CERT_HAS_EXPIRED:
|
||||
return 1;
|
||||
|
||||
@@ -44,7 +44,7 @@ int init() {
|
||||
origin_web_ui_allowed = net::from_enum_string(config::nvhttp.origin_web_ui_allowed);
|
||||
|
||||
if(clean_slate) {
|
||||
unique_id = util::uuid_t::generate().string();
|
||||
unique_id = uuid_util::uuid_t::generate().string();
|
||||
auto dir = std::filesystem::temp_directory_path() / "Sunshine"sv;
|
||||
config::nvhttp.cert = (dir / ("cert-"s + unique_id)).string();
|
||||
config::nvhttp.pkey = (dir / ("pkey-"s + unique_id)).string();
|
||||
|
||||
@@ -21,7 +21,7 @@ using namespace std::literals;
|
||||
namespace input {
|
||||
|
||||
constexpr auto MAX_GAMEPADS = std::min((std::size_t)platf::MAX_GAMEPADS, sizeof(std::int16_t) * 8);
|
||||
#define DISABLE_LEFT_BUTTON_DELAY ((util::ThreadPool::task_id_t)0x01)
|
||||
#define DISABLE_LEFT_BUTTON_DELAY ((thread_pool_util::ThreadPool::task_id_t)0x01)
|
||||
#define ENABLE_LEFT_BUTTON_DELAY nullptr
|
||||
|
||||
constexpr auto VKEY_SHIFT = 0x10;
|
||||
@@ -57,7 +57,7 @@ void free_id(std::bitset<N> &gamepad_mask, int id) {
|
||||
gamepad_mask[id] = false;
|
||||
}
|
||||
|
||||
static util::TaskPool::task_id_t key_press_repeat_id {};
|
||||
static task_pool_util::TaskPool::task_id_t key_press_repeat_id {};
|
||||
static std::unordered_map<short, bool> key_press {};
|
||||
static std::array<std::uint8_t, 5> mouse_press {};
|
||||
|
||||
@@ -82,7 +82,7 @@ struct gamepad_t {
|
||||
|
||||
platf::gamepad_state_t gamepad_state;
|
||||
|
||||
util::ThreadPool::task_id_t back_timeout_id;
|
||||
thread_pool_util::ThreadPool::task_id_t back_timeout_id;
|
||||
|
||||
int id;
|
||||
|
||||
@@ -123,7 +123,7 @@ struct input_t {
|
||||
safe::mail_raw_t::event_t<input::touch_port_t> touch_port_event;
|
||||
platf::rumble_queue_t rumble_queue;
|
||||
|
||||
util::ThreadPool::task_id_t mouse_left_button_timeout;
|
||||
thread_pool_util::ThreadPool::task_id_t mouse_left_button_timeout;
|
||||
|
||||
input::touch_port_t touch_port;
|
||||
};
|
||||
@@ -653,7 +653,7 @@ void passthrough_helper(std::shared_ptr<input_t> input, std::vector<std::uint8_t
|
||||
}
|
||||
|
||||
void passthrough(std::shared_ptr<input_t> &input, std::vector<std::uint8_t> &&input_data) {
|
||||
task_pool.push(passthrough_helper, input, util::cmove(input_data));
|
||||
task_pool.push(passthrough_helper, input, move_by_copy_util::cmove(input_data));
|
||||
}
|
||||
|
||||
void reset(std::shared_ptr<input_t> &input) {
|
||||
|
||||
90
src/main.cpp
90
src/main.cpp
@@ -1,31 +1,35 @@
|
||||
// Created by loki on 5/30/19.
|
||||
|
||||
#include "process.h"
|
||||
/**
|
||||
* @file main.cpp
|
||||
*/
|
||||
|
||||
// standard includes
|
||||
#include <csignal>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
// lib includes
|
||||
#include <boost/log/attributes/clock.hpp>
|
||||
#include <boost/log/common.hpp>
|
||||
#include <boost/log/expressions.hpp>
|
||||
#include <boost/log/sinks.hpp>
|
||||
#include <boost/log/sources/severity_logger.hpp>
|
||||
|
||||
// local includes
|
||||
#include "config.h"
|
||||
#include "confighttp.h"
|
||||
#include "httpcommon.h"
|
||||
#include "main.h"
|
||||
#include "nvhttp.h"
|
||||
#include "platform/common.h"
|
||||
#include "process.h"
|
||||
#include "rtsp.h"
|
||||
#include "thread_pool.h"
|
||||
#include "upnp.h"
|
||||
#include "version.h"
|
||||
#include "video.h"
|
||||
|
||||
#include "platform/common.h"
|
||||
extern "C" {
|
||||
#include <libavutil/log.h>
|
||||
#include <rs.h>
|
||||
@@ -36,7 +40,7 @@ safe::mail_t mail::man;
|
||||
using namespace std::literals;
|
||||
namespace bl = boost::log;
|
||||
|
||||
util::ThreadPool task_pool;
|
||||
thread_pool_util::ThreadPool task_pool;
|
||||
bl::sources::severity_logger<int> verbose(0); // Dominating output
|
||||
bl::sources::severity_logger<int> debug(1); // Follow what is happening
|
||||
bl::sources::severity_logger<int> info(2); // Should be informed about
|
||||
@@ -55,10 +59,15 @@ struct NoDelete {
|
||||
|
||||
BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", int)
|
||||
|
||||
/** Print the help to stdout.
|
||||
|
||||
This function prints output to stdout.
|
||||
*/
|
||||
/**
|
||||
* @brief Print help to stdout.
|
||||
* @param name The name of the program.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* print_help("sunshine");
|
||||
* ```
|
||||
*/
|
||||
void print_help(const char *name) {
|
||||
std::cout
|
||||
<< "Usage: "sv << name << " [options] [/path/to/configuration_file] [--cmd]"sv << std::endl
|
||||
@@ -79,10 +88,6 @@ void print_help(const char *name) {
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
/** Call the print_help function.
|
||||
|
||||
Calls the print_help function and then exits.
|
||||
*/
|
||||
namespace help {
|
||||
int entry(const char *name, int argc, char *argv[]) {
|
||||
print_help(name);
|
||||
@@ -90,10 +95,6 @@ int entry(const char *name, int argc, char *argv[]) {
|
||||
}
|
||||
} // namespace help
|
||||
|
||||
/** Print the version details to stdout.
|
||||
|
||||
This function prints the version details to stdout and then exits.
|
||||
*/
|
||||
namespace version {
|
||||
int entry(const char *name, int argc, char *argv[]) {
|
||||
std::cout << PROJECT_NAME << " version: v" << PROJECT_VER << std::endl;
|
||||
@@ -102,6 +103,14 @@ int entry(const char *name, int argc, char *argv[]) {
|
||||
} // namespace version
|
||||
|
||||
|
||||
/**
|
||||
* @brief Flush the log.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* log_flush();
|
||||
* ```
|
||||
*/
|
||||
void log_flush() {
|
||||
sink->flush();
|
||||
}
|
||||
@@ -156,8 +165,18 @@ LRESULT CALLBACK SessionMonitorWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, L
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Main application entry point.
|
||||
* @param argc The number of arguments.
|
||||
* @param argv The arguments.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* main(1, const char* args[] = {"sunshine", nullptr});
|
||||
* ```
|
||||
*/
|
||||
int main(int argc, char *argv[]) {
|
||||
util::TaskPool::task_id_t force_shutdown = nullptr;
|
||||
task_pool_util::TaskPool::task_id_t force_shutdown = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Wait as long as possible to terminate Sunshine.exe during logoff/shutdown
|
||||
@@ -344,7 +363,7 @@ int main(int argc, char *argv[]) {
|
||||
std::thread httpThread { nvhttp::start };
|
||||
std::thread configThread { confighttp::start };
|
||||
|
||||
stream::rtpThread();
|
||||
rtsp_stream::rtpThread();
|
||||
|
||||
httpThread.join();
|
||||
configThread.join();
|
||||
@@ -355,6 +374,16 @@ int main(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read a file to string.
|
||||
* @param path The path of the file.
|
||||
* @return `std::string` : The contents of the file.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* std::string contents = read_file("path/to/file");
|
||||
* ```
|
||||
*/
|
||||
std::string read_file(const char *path) {
|
||||
if(!std::filesystem::exists(path)) {
|
||||
BOOST_LOG(debug) << "Missing file: " << path;
|
||||
@@ -374,6 +403,17 @@ std::string read_file(const char *path) {
|
||||
return base64_cert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Writes a file.
|
||||
* @param path The path of the file.
|
||||
* @param contents The contents to write.
|
||||
* @return `int` : `0` on success, `-1` on failure.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* int write_status = write_file("path/to/file", "file contents");
|
||||
* ```
|
||||
*/
|
||||
int write_file(const char *path, const std::string_view &contents) {
|
||||
std::ofstream out(path);
|
||||
|
||||
@@ -386,6 +426,18 @@ int write_file(const char *path, const std::string_view &contents) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Map a specified port based on the base port.
|
||||
* @param port The port to map as a difference from the base port.
|
||||
* @return `std:uint16_t` : The mapped port number.
|
||||
*
|
||||
* EXAMPLES:
|
||||
* ```cpp
|
||||
* std::uint16_t mapped_port = map_port(1);
|
||||
* ```
|
||||
*/
|
||||
std::uint16_t map_port(int port) {
|
||||
// TODO: Ensure port is in the range of 21-65535
|
||||
// TODO: Ensure port is not already in use by another application
|
||||
return (std::uint16_t)((int)config::sunshine.port + port);
|
||||
}
|
||||
|
||||
23
src/main.h
23
src/main.h
@@ -1,17 +1,23 @@
|
||||
// Created by loki on 12/22/19.
|
||||
/**
|
||||
* @file main.h
|
||||
*/
|
||||
|
||||
// macros
|
||||
#ifndef SUNSHINE_MAIN_H
|
||||
#define SUNSHINE_MAIN_H
|
||||
|
||||
// standard includes
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
|
||||
// lib includes
|
||||
#include <boost/log/common.hpp>
|
||||
|
||||
// local includes
|
||||
#include "thread_pool.h"
|
||||
#include "thread_safe.h"
|
||||
|
||||
#include <boost/log/common.hpp>
|
||||
|
||||
extern util::ThreadPool task_pool;
|
||||
extern thread_pool_util::ThreadPool task_pool;
|
||||
extern bool display_cursor;
|
||||
|
||||
extern boost::log::sources::severity_logger<int> verbose;
|
||||
@@ -21,15 +27,15 @@ extern boost::log::sources::severity_logger<int> warning;
|
||||
extern boost::log::sources::severity_logger<int> error;
|
||||
extern boost::log::sources::severity_logger<int> fatal;
|
||||
|
||||
// functions
|
||||
int main(int argc, char *argv[]);
|
||||
void log_flush();
|
||||
|
||||
void print_help(const char *name);
|
||||
|
||||
std::string read_file(const char *path);
|
||||
int write_file(const char *path, const std::string_view &contents);
|
||||
|
||||
std::uint16_t map_port(int port);
|
||||
|
||||
// namespaces
|
||||
namespace mail {
|
||||
#define MAIL(x) \
|
||||
constexpr auto x = std::string_view { \
|
||||
@@ -41,10 +47,8 @@ extern safe::mail_t man;
|
||||
// Global mail
|
||||
MAIL(shutdown);
|
||||
MAIL(broadcast_shutdown);
|
||||
|
||||
MAIL(video_packets);
|
||||
MAIL(audio_packets);
|
||||
|
||||
MAIL(switch_display);
|
||||
|
||||
// Local mail
|
||||
@@ -53,5 +57,6 @@ MAIL(idr);
|
||||
MAIL(rumble);
|
||||
MAIL(hdr);
|
||||
#undef MAIL
|
||||
|
||||
} // namespace mail
|
||||
#endif // SUNSHINE_MAIN_H
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define DOSSIER_MOVE_BY_COPY_H
|
||||
|
||||
#include <utility>
|
||||
namespace util {
|
||||
namespace move_by_copy_util {
|
||||
/*
|
||||
* When a copy is made, it moves the object
|
||||
* This allows you to move an object when a move can't be done.
|
||||
@@ -47,5 +47,5 @@ template<class T>
|
||||
MoveByCopy<T> const_cmove(const T &movable) {
|
||||
return MoveByCopy<T>(std::move(const_cast<T &>(movable)));
|
||||
}
|
||||
} // namespace util
|
||||
} // namespace move_by_copy_util
|
||||
#endif
|
||||
|
||||
@@ -202,7 +202,7 @@ void save_state() {
|
||||
void load_state() {
|
||||
if(!fs::exists(config::nvhttp.file_state)) {
|
||||
BOOST_LOG(info) << "File "sv << config::nvhttp.file_state << " doesn't exist"sv;
|
||||
http::unique_id = util::uuid_t::generate().string();
|
||||
http::unique_id = uuid_util::uuid_t::generate().string();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ void load_state() {
|
||||
auto unique_id_p = root.get_optional<std::string>("root.uniqueid");
|
||||
if(!unique_id_p) {
|
||||
// This file doesn't contain moonlight credentials
|
||||
http::unique_id = util::uuid_t::generate().string();
|
||||
http::unique_id = uuid_util::uuid_t::generate().string();
|
||||
return;
|
||||
}
|
||||
http::unique_id = std::move(*unique_id_p);
|
||||
@@ -255,8 +255,8 @@ void update_id_client(const std::string &uniqueID, std::string &&cert, op_e op)
|
||||
}
|
||||
}
|
||||
|
||||
stream::launch_session_t make_launch_session(bool host_audio, const args_t &args) {
|
||||
stream::launch_session_t launch_session;
|
||||
rtsp_stream::launch_session_t make_launch_session(bool host_audio, const args_t &args) {
|
||||
rtsp_stream::launch_session_t launch_session;
|
||||
|
||||
launch_session.host_audio = host_audio;
|
||||
launch_session.gcm_key = util::from_hex<crypto::aes_t>(get_arg(args, "rikey"), true);
|
||||
@@ -707,7 +707,7 @@ void launch(bool &host_audio, resp_https_t response, req_https_t request) {
|
||||
response->close_connection_after_response = true;
|
||||
});
|
||||
|
||||
if(stream::session_count() == config::stream.channels) {
|
||||
if(rtsp_stream::session_count() == config::stream.channels) {
|
||||
tree.put("root.resume", 0);
|
||||
tree.put("root.<xmlattr>.status_code", 503);
|
||||
|
||||
@@ -748,10 +748,10 @@ void launch(bool &host_audio, resp_https_t response, req_https_t request) {
|
||||
}
|
||||
|
||||
host_audio = util::from_view(get_arg(args, "localAudioPlayMode"));
|
||||
stream::launch_session_raise(make_launch_session(host_audio, args));
|
||||
rtsp_stream::launch_session_raise(make_launch_session(host_audio, args));
|
||||
|
||||
tree.put("root.<xmlattr>.status_code", 200);
|
||||
tree.put("root.sessionUrl0", "rtsp://"s + request->local_endpoint().address().to_string() + ':' + std::to_string(map_port(stream::RTSP_SETUP_PORT)));
|
||||
tree.put("root.sessionUrl0", "rtsp://"s + request->local_endpoint().address().to_string() + ':' + std::to_string(map_port(rtsp_stream::RTSP_SETUP_PORT)));
|
||||
tree.put("root.gamesession", 1);
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ void resume(bool &host_audio, resp_https_t response, req_https_t request) {
|
||||
|
||||
// It is possible that due a race condition that this if-statement gives a false negative,
|
||||
// that is automatically resolved in rtsp_server_t
|
||||
if(stream::session_count() == config::stream.channels) {
|
||||
if(rtsp_stream::session_count() == config::stream.channels) {
|
||||
tree.put("root.resume", 0);
|
||||
tree.put("root.<xmlattr>.status_code", 503);
|
||||
|
||||
@@ -795,10 +795,10 @@ void resume(bool &host_audio, resp_https_t response, req_https_t request) {
|
||||
return;
|
||||
}
|
||||
|
||||
stream::launch_session_raise(make_launch_session(host_audio, args));
|
||||
rtsp_stream::launch_session_raise(make_launch_session(host_audio, args));
|
||||
|
||||
tree.put("root.<xmlattr>.status_code", 200);
|
||||
tree.put("root.sessionUrl0", "rtsp://"s + request->local_endpoint().address().to_string() + ':' + std::to_string(map_port(stream::RTSP_SETUP_PORT)));
|
||||
tree.put("root.sessionUrl0", "rtsp://"s + request->local_endpoint().address().to_string() + ':' + std::to_string(map_port(rtsp_stream::RTSP_SETUP_PORT)));
|
||||
tree.put("root.resume", 1);
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ void cancel(resp_https_t response, req_https_t request) {
|
||||
|
||||
// It is possible that due a race condition that this if-statement gives a false positive,
|
||||
// the client should try again
|
||||
if(stream::session_count() != 0) {
|
||||
if(rtsp_stream::session_count() != 0) {
|
||||
tree.put("root.resume", 0);
|
||||
tree.put("root.<xmlattr>.status_code", 503);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef basic_environment<char> environment;
|
||||
} // namespace boost
|
||||
namespace video {
|
||||
struct config_t;
|
||||
}
|
||||
} // namespace video
|
||||
|
||||
namespace platf {
|
||||
constexpr auto MAX_GAMEPADS = 32;
|
||||
|
||||
@@ -52,7 +52,7 @@ using __float4 = float[4];
|
||||
using __float3 = float[3];
|
||||
using __float2 = float[2];
|
||||
|
||||
struct __attribute__((__aligned__(16))) color_t {
|
||||
struct alignas(16) color_t {
|
||||
float4 color_vec_y;
|
||||
float4 color_vec_u;
|
||||
float4 color_vec_v;
|
||||
@@ -60,7 +60,7 @@ struct __attribute__((__aligned__(16))) color_t {
|
||||
float2 range_uv;
|
||||
};
|
||||
|
||||
struct __attribute__((__aligned__(16))) color_extern_t {
|
||||
struct alignas(16) color_extern_t {
|
||||
__float4 color_vec_y;
|
||||
__float4 color_vec_u;
|
||||
__float4 color_vec_v;
|
||||
|
||||
@@ -172,7 +172,7 @@ static std::uint32_t from_view(const std::string_view &string) {
|
||||
return DRM_MODE_CONNECTOR_Unknown;
|
||||
}
|
||||
|
||||
class plane_it_t : public util::it_wrap_t<plane_t::element_type, plane_it_t> {
|
||||
class plane_it_t : public round_robin_util::it_wrap_t<plane_t::element_type, plane_it_t> {
|
||||
public:
|
||||
plane_it_t(int fd, std::uint32_t *plane_p, std::uint32_t *end)
|
||||
: fd { fd }, plane_p { plane_p }, end { end } {
|
||||
|
||||
@@ -494,7 +494,7 @@ struct x11_attr_t : public display_t {
|
||||
capture_e snapshot(img_t *img_out_base, std::chrono::milliseconds timeout, bool cursor) {
|
||||
refresh();
|
||||
|
||||
//The whole X server changed, so we gotta reinit everything
|
||||
//The whole X server changed, so we must reinit everything
|
||||
if(xattr.width != env_width || xattr.height != env_height) {
|
||||
BOOST_LOG(warning) << "X dimensions changed in non-SHM mode, request reinit"sv;
|
||||
return capture_e::reinit;
|
||||
@@ -550,7 +550,7 @@ struct shm_attr_t : public x11_attr_t {
|
||||
|
||||
shm_data_t data;
|
||||
|
||||
util::TaskPool::task_id_t refresh_task_id;
|
||||
task_pool_util::TaskPool::task_id_t refresh_task_id;
|
||||
|
||||
void delayed_refresh() {
|
||||
refresh();
|
||||
@@ -603,7 +603,7 @@ struct shm_attr_t : public x11_attr_t {
|
||||
}
|
||||
|
||||
capture_e snapshot(img_t *img, std::chrono::milliseconds timeout, bool cursor) {
|
||||
//The whole X server changed, so we gotta reinit everything
|
||||
//The whole X server changed, so we must reinit everything
|
||||
if(xattr.width != env_width || xattr.height != env_height) {
|
||||
BOOST_LOG(warning) << "X dimensions changed in SHM mode, request reinit"sv;
|
||||
return capture_e::reinit;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace util {
|
||||
namespace round_robin_util {
|
||||
template<class V, class T>
|
||||
class it_wrap_t : public std::iterator<std::random_access_iterator_tag, V> {
|
||||
public:
|
||||
@@ -151,6 +151,6 @@ template<class V, class It>
|
||||
round_robin_t<V, It> make_round_robin(It begin, It end) {
|
||||
return round_robin_t<V, It>(begin, end);
|
||||
}
|
||||
} // namespace util
|
||||
} // namespace round_robin_util
|
||||
|
||||
#endif
|
||||
|
||||
32
src/rtsp.cpp
32
src/rtsp.cpp
@@ -29,7 +29,7 @@ using asio::ip::udp;
|
||||
|
||||
using namespace std::literals;
|
||||
|
||||
namespace stream {
|
||||
namespace rtsp_stream {
|
||||
void free_msg(PRTSP_MESSAGE msg) {
|
||||
freeMessage(msg);
|
||||
|
||||
@@ -290,7 +290,7 @@ public:
|
||||
_map_cmd_cb.emplace(type, std::move(cb));
|
||||
}
|
||||
|
||||
void session_raise(launch_session_t launch_session) {
|
||||
void session_raise(rtsp_stream::launch_session_t launch_session) {
|
||||
auto now = std::chrono::steady_clock::now();
|
||||
|
||||
// If a launch event is still pending, don't overwrite it.
|
||||
@@ -307,7 +307,7 @@ public:
|
||||
return config::stream.channels - _slot_count;
|
||||
}
|
||||
|
||||
safe::event_t<launch_session_t> launch_event;
|
||||
safe::event_t<rtsp_stream::launch_session_t> launch_event;
|
||||
|
||||
void clear(bool all = true) {
|
||||
// if a launch event timed out --> Remove it.
|
||||
@@ -321,9 +321,9 @@ public:
|
||||
auto lg = _session_slots.lock();
|
||||
|
||||
for(auto &slot : *_session_slots) {
|
||||
if(slot && (all || session::state(*slot) == session::state_e::STOPPING)) {
|
||||
session::stop(*slot);
|
||||
session::join(*slot);
|
||||
if(slot && (all || stream::session::state(*slot) == stream::session::state_e::STOPPING)) {
|
||||
stream::session::stop(*slot);
|
||||
stream::session::join(*slot);
|
||||
|
||||
slot.reset();
|
||||
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void clear(std::shared_ptr<session_t> *session_p) {
|
||||
void clear(std::shared_ptr<stream::session_t> *session_p) {
|
||||
auto lg = _session_slots.lock();
|
||||
|
||||
session_p->reset();
|
||||
@@ -344,7 +344,7 @@ public:
|
||||
++_slot_count;
|
||||
}
|
||||
|
||||
std::shared_ptr<session_t> *accept(std::shared_ptr<session_t> &session) {
|
||||
std::shared_ptr<stream::session_t> *accept(std::shared_ptr<stream::session_t> &session) {
|
||||
auto lg = _session_slots.lock();
|
||||
|
||||
for(auto &slot : *_session_slots) {
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
private:
|
||||
std::unordered_map<std::string_view, cmd_func_t> _map_cmd_cb;
|
||||
|
||||
util::sync_t<std::vector<std::shared_ptr<session_t>>> _session_slots;
|
||||
sync_util::sync_t<std::vector<std::shared_ptr<stream::session_t>>> _session_slots;
|
||||
|
||||
std::chrono::steady_clock::time_point raised_timeout;
|
||||
int _slot_count;
|
||||
@@ -373,7 +373,7 @@ private:
|
||||
|
||||
rtsp_server_t server {};
|
||||
|
||||
void launch_session_raise(launch_session_t launch_session) {
|
||||
void launch_session_raise(rtsp_stream::launch_session_t launch_session) {
|
||||
server.session_raise(launch_session);
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ void cmd_announce(rtsp_server_t *server, tcp::socket &sock, msg_t &&req) {
|
||||
args.try_emplace("x-nv-vqos[0].qosTrafficType"sv, "5"sv);
|
||||
args.try_emplace("x-nv-aqos.qosTrafficType"sv, "4"sv);
|
||||
|
||||
config_t config;
|
||||
stream::config_t config;
|
||||
|
||||
config.audio.flags[audio::config_t::HOST_AUDIO] = launch_session->host_audio;
|
||||
try {
|
||||
@@ -670,7 +670,7 @@ void cmd_announce(rtsp_server_t *server, tcp::socket &sock, msg_t &&req) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto session = session::alloc(config, launch_session->gcm_key, launch_session->iv);
|
||||
auto session = stream::session::alloc(config, launch_session->gcm_key, launch_session->iv);
|
||||
|
||||
auto slot = server->accept(session);
|
||||
if(!slot) {
|
||||
@@ -680,7 +680,7 @@ void cmd_announce(rtsp_server_t *server, tcp::socket &sock, msg_t &&req) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(session::start(*session, sock.remote_endpoint().address().to_string())) {
|
||||
if(stream::session::start(*session, sock.remote_endpoint().address().to_string())) {
|
||||
BOOST_LOG(error) << "Failed to start a streaming session"sv;
|
||||
|
||||
server->clear(slot);
|
||||
@@ -715,8 +715,8 @@ void rtpThread() {
|
||||
server.map("PLAY"sv, &cmd_play);
|
||||
|
||||
boost::system::error_code ec;
|
||||
if(server.bind(map_port(RTSP_SETUP_PORT), ec)) {
|
||||
BOOST_LOG(fatal) << "Couldn't bind RTSP server to port ["sv << map_port(RTSP_SETUP_PORT) << "], " << ec.message();
|
||||
if(server.bind(map_port(rtsp_stream::RTSP_SETUP_PORT), ec)) {
|
||||
BOOST_LOG(fatal) << "Couldn't bind RTSP server to port ["sv << map_port(rtsp_stream::RTSP_SETUP_PORT) << "], " << ec.message();
|
||||
shutdown_event->raise(true);
|
||||
|
||||
return;
|
||||
@@ -780,4 +780,4 @@ void print_msg(PRTSP_MESSAGE msg) {
|
||||
<< messageBuffer << std::endl
|
||||
<< "---End MessageBuffer---"sv << std::endl;
|
||||
}
|
||||
} // namespace stream
|
||||
} // namespace rtsp_stream
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "crypto.h"
|
||||
#include "thread_safe.h"
|
||||
|
||||
namespace stream {
|
||||
namespace rtsp_stream {
|
||||
constexpr auto RTSP_SETUP_PORT = 21;
|
||||
|
||||
struct launch_session_t {
|
||||
@@ -23,6 +23,6 @@ int session_count();
|
||||
|
||||
void rtpThread();
|
||||
|
||||
} // namespace stream
|
||||
} // namespace rtsp_stream
|
||||
|
||||
#endif // SUNSHINE_RTSP_H
|
||||
|
||||
@@ -252,7 +252,7 @@ public:
|
||||
std::unordered_map<std::uint16_t, std::function<void(session_t *, const std::string_view &)>> _map_type_cb;
|
||||
|
||||
// Mapping ip:port to session
|
||||
util::sync_t<std::unordered_multimap<std::string, std::pair<std::uint16_t, session_t *>>> _map_addr_session;
|
||||
sync_util::sync_t<std::unordered_multimap<std::string, std::pair<std::uint16_t, session_t *>>> _map_addr_session;
|
||||
|
||||
ENetAddress _addr;
|
||||
net::host_t _host;
|
||||
@@ -275,7 +275,7 @@ struct broadcast_ctx_t {
|
||||
// It's possible two instances of Moonlight are behind a NAT.
|
||||
// From Sunshine's point of view, the ip addresses are identical
|
||||
// We need some way to know what ports are already used for different streams
|
||||
util::sync_t<std::vector<std::pair<std::string, std::uint16_t>>> audio_video_connections;
|
||||
sync_util::sync_t<std::vector<std::pair<std::string, std::uint16_t>>> audio_video_connections;
|
||||
|
||||
control_server_t control_server;
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
|
||||
namespace util {
|
||||
namespace sync_util {
|
||||
|
||||
template<class T, class M = std::mutex>
|
||||
class sync_t {
|
||||
@@ -87,7 +87,7 @@ private:
|
||||
mutex_t _lock;
|
||||
};
|
||||
|
||||
} // namespace util
|
||||
} // namespace sync_util
|
||||
|
||||
|
||||
#endif // SUNSHINE_SYNC_H
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "move_by_copy.h"
|
||||
#include "utility.h"
|
||||
namespace util {
|
||||
namespace task_pool_util {
|
||||
|
||||
class _ImplBase {
|
||||
public:
|
||||
@@ -241,5 +241,5 @@ private:
|
||||
return std::make_unique<_Impl<Function>>(std::forward<Function &&>(f));
|
||||
}
|
||||
};
|
||||
} // namespace util
|
||||
} // namespace task_pool_util
|
||||
#endif
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include "task_pool.h"
|
||||
#include <thread>
|
||||
|
||||
namespace util {
|
||||
namespace thread_pool_util {
|
||||
/*
|
||||
* Allow threads to execute unhindered
|
||||
* while keeping full control over the threads.
|
||||
*/
|
||||
class ThreadPool : public TaskPool {
|
||||
class ThreadPool : public task_pool_util::TaskPool {
|
||||
public:
|
||||
typedef TaskPool::__task __task;
|
||||
|
||||
@@ -117,5 +117,5 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace util
|
||||
} // namespace thread_pool_util
|
||||
#endif
|
||||
|
||||
@@ -132,7 +132,7 @@ std::unique_ptr<platf::deinit_t> start() {
|
||||
}
|
||||
}
|
||||
|
||||
auto rtsp = std::to_string(map_port(stream::RTSP_SETUP_PORT));
|
||||
auto rtsp = std::to_string(map_port(rtsp_stream::RTSP_SETUP_PORT));
|
||||
auto video = std::to_string(map_port(stream::VIDEO_STREAM_PORT));
|
||||
auto audio = std::to_string(map_port(stream::AUDIO_STREAM_PORT));
|
||||
auto control = std::to_string(map_port(stream::CONTROL_PORT));
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include <random>
|
||||
|
||||
namespace util {
|
||||
namespace uuid_util {
|
||||
union uuid_t {
|
||||
std::uint8_t b8[16];
|
||||
std::uint16_t b16[8];
|
||||
@@ -73,5 +73,5 @@ union uuid_t {
|
||||
return (b64[0] > other.b64[0] || (b64[0] == other.b64[0] && b64[1] > other.b64[1]));
|
||||
}
|
||||
};
|
||||
} // namespace util
|
||||
} // namespace uuid_util
|
||||
#endif // T_MAN_UUID_H
|
||||
|
||||
@@ -402,7 +402,7 @@ struct capture_thread_async_ctx_t {
|
||||
|
||||
safe::signal_t reinit_event;
|
||||
const encoder_t *encoder_p;
|
||||
util::sync_t<std::weak_ptr<platf::display_t>> display_wp;
|
||||
sync_util::sync_t<std::weak_ptr<platf::display_t>> display_wp;
|
||||
};
|
||||
|
||||
struct capture_thread_sync_ctx_t {
|
||||
@@ -434,9 +434,9 @@ static encoder_t nvenc {
|
||||
{ "delay"s, 0 },
|
||||
{ "forced-idr"s, 1 },
|
||||
{ "zerolatency"s, 1 },
|
||||
{ "preset"s, &config::video.nv.preset },
|
||||
{ "tune"s, &config::video.nv.tune },
|
||||
{ "rc"s, &config::video.nv.rc },
|
||||
{ "preset"s, &config::video.nv.nv_preset },
|
||||
{ "tune"s, &config::video.nv.nv_tune },
|
||||
{ "rc"s, &config::video.nv.nv_rc },
|
||||
},
|
||||
// SDR-specific options
|
||||
{
|
||||
@@ -454,10 +454,10 @@ static encoder_t nvenc {
|
||||
{ "delay"s, 0 },
|
||||
{ "forced-idr"s, 1 },
|
||||
{ "zerolatency"s, 1 },
|
||||
{ "preset"s, &config::video.nv.preset },
|
||||
{ "tune"s, &config::video.nv.tune },
|
||||
{ "rc"s, &config::video.nv.rc },
|
||||
{ "coder"s, &config::video.nv.coder },
|
||||
{ "preset"s, &config::video.nv.nv_preset },
|
||||
{ "tune"s, &config::video.nv.nv_tune },
|
||||
{ "rc"s, &config::video.nv.nv_rc },
|
||||
{ "coder"s, &config::video.nv.nv_coder },
|
||||
},
|
||||
// SDR-specific options
|
||||
{
|
||||
@@ -486,7 +486,7 @@ static encoder_t quicksync {
|
||||
{
|
||||
// Common options
|
||||
{
|
||||
{ "preset"s, &config::video.qsv.preset },
|
||||
{ "preset"s, &config::video.qsv.qsv_preset },
|
||||
{ "forced_idr"s, 1 },
|
||||
{ "async_depth"s, 1 },
|
||||
{ "low_delay_brc"s, 1 },
|
||||
@@ -508,8 +508,8 @@ static encoder_t quicksync {
|
||||
{
|
||||
// Common options
|
||||
{
|
||||
{ "preset"s, &config::video.qsv.preset },
|
||||
{ "cavlc"s, &config::video.qsv.cavlc },
|
||||
{ "preset"s, &config::video.qsv.qsv_preset },
|
||||
{ "cavlc"s, &config::video.qsv.qsv_cavlc },
|
||||
{ "forced_idr"s, 1 },
|
||||
{ "async_depth"s, 1 },
|
||||
{ "low_delay_brc"s, 1 },
|
||||
@@ -542,13 +542,13 @@ static encoder_t amdvce {
|
||||
{ "filler_data"s, true },
|
||||
{ "gops_per_idr"s, 1 },
|
||||
{ "header_insertion_mode"s, "idr"s },
|
||||
{ "preanalysis"s, &config::video.amd.preanalysis },
|
||||
{ "preanalysis"s, &config::video.amd.amd_preanalysis },
|
||||
{ "qmax"s, 51 },
|
||||
{ "qmin"s, 0 },
|
||||
{ "quality"s, &config::video.amd.quality_hevc },
|
||||
{ "rc"s, &config::video.amd.rc_hevc },
|
||||
{ "usage"s, &config::video.amd.usage_hevc },
|
||||
{ "vbaq"s, &config::video.amd.vbaq },
|
||||
{ "quality"s, &config::video.amd.amd_quality_hevc },
|
||||
{ "rc"s, &config::video.amd.amd_rc_hevc },
|
||||
{ "usage"s, &config::video.amd.amd_usage_hevc },
|
||||
{ "vbaq"s, &config::video.amd.amd_vbaq },
|
||||
},
|
||||
{}, // SDR-specific options
|
||||
{}, // HDR-specific options
|
||||
@@ -560,13 +560,13 @@ static encoder_t amdvce {
|
||||
{
|
||||
{ "filler_data"s, true },
|
||||
{ "log_to_dbg"s, "1"s },
|
||||
{ "preanalysis"s, &config::video.amd.preanalysis },
|
||||
{ "preanalysis"s, &config::video.amd.amd_preanalysis },
|
||||
{ "qmax"s, 51 },
|
||||
{ "qmin"s, 0 },
|
||||
{ "quality"s, &config::video.amd.quality_h264 },
|
||||
{ "rc"s, &config::video.amd.rc_h264 },
|
||||
{ "usage"s, &config::video.amd.usage_h264 },
|
||||
{ "vbaq"s, &config::video.amd.vbaq },
|
||||
{ "quality"s, &config::video.amd.amd_quality_h264 },
|
||||
{ "rc"s, &config::video.amd.amd_rc_h264 },
|
||||
{ "usage"s, &config::video.amd.amd_usage_h264 },
|
||||
{ "vbaq"s, &config::video.amd.amd_vbaq },
|
||||
},
|
||||
{}, // SDR-specific options
|
||||
{}, // HDR-specific options
|
||||
@@ -591,8 +591,8 @@ static encoder_t software {
|
||||
{
|
||||
{ "forced-idr"s, 1 },
|
||||
{ "x265-params"s, "info=0:keyint=-1"s },
|
||||
{ "preset"s, &config::video.sw.preset },
|
||||
{ "tune"s, &config::video.sw.tune },
|
||||
{ "preset"s, &config::video.sw.sw_preset },
|
||||
{ "tune"s, &config::video.sw.sw_tune },
|
||||
},
|
||||
{}, // SDR-specific options
|
||||
{}, // HDR-specific options
|
||||
@@ -602,8 +602,8 @@ static encoder_t software {
|
||||
{
|
||||
// Common options
|
||||
{
|
||||
{ "preset"s, &config::video.sw.preset },
|
||||
{ "tune"s, &config::video.sw.tune },
|
||||
{ "preset"s, &config::video.sw.sw_preset },
|
||||
{ "tune"s, &config::video.sw.sw_tune },
|
||||
},
|
||||
{}, // SDR-specific options
|
||||
{}, // HDR-specific options
|
||||
@@ -660,9 +660,9 @@ static encoder_t videotoolbox {
|
||||
{
|
||||
// Common options
|
||||
{
|
||||
{ "allow_sw"s, &config::video.vt.allow_sw },
|
||||
{ "require_sw"s, &config::video.vt.require_sw },
|
||||
{ "realtime"s, &config::video.vt.realtime },
|
||||
{ "allow_sw"s, &config::video.vt.vt_allow_sw },
|
||||
{ "require_sw"s, &config::video.vt.vt_require_sw },
|
||||
{ "realtime"s, &config::video.vt.vt_realtime },
|
||||
},
|
||||
{}, // SDR-specific options
|
||||
{}, // HDR-specific options
|
||||
@@ -672,9 +672,9 @@ static encoder_t videotoolbox {
|
||||
{
|
||||
// Common options
|
||||
{
|
||||
{ "allow_sw"s, &config::video.vt.allow_sw },
|
||||
{ "require_sw"s, &config::video.vt.require_sw },
|
||||
{ "realtime"s, &config::video.vt.realtime },
|
||||
{ "allow_sw"s, &config::video.vt.vt_allow_sw },
|
||||
{ "require_sw"s, &config::video.vt.vt_require_sw },
|
||||
{ "realtime"s, &config::video.vt.vt_realtime },
|
||||
},
|
||||
{}, // SDR-specific options
|
||||
{}, // HDR-specific options
|
||||
@@ -720,7 +720,7 @@ void reset_display(std::shared_ptr<platf::display_t> &disp, AVHWDeviceType type,
|
||||
|
||||
void captureThread(
|
||||
std::shared_ptr<safe::queue_t<capture_ctx_t>> capture_ctx_queue,
|
||||
util::sync_t<std::weak_ptr<platf::display_t>> &display_wp,
|
||||
sync_util::sync_t<std::weak_ptr<platf::display_t>> &display_wp,
|
||||
safe::signal_t &reinit_event,
|
||||
const encoder_t &encoder) {
|
||||
std::vector<capture_ctx_t> capture_ctxs;
|
||||
@@ -767,7 +767,7 @@ void captureThread(
|
||||
display_wp = disp;
|
||||
|
||||
std::vector<std::shared_ptr<platf::img_t>> imgs(12);
|
||||
auto round_robin = util::make_round_robin<std::shared_ptr<platf::img_t>>(std::begin(imgs), std::end(imgs));
|
||||
auto round_robin = round_robin_util::make_round_robin<std::shared_ptr<platf::img_t>>(std::begin(imgs), std::end(imgs));
|
||||
|
||||
for(auto &img : imgs) {
|
||||
img = disp->alloc_img();
|
||||
@@ -1293,7 +1293,7 @@ void encode_run(
|
||||
auto idr_events = mail->event<bool>(mail::idr);
|
||||
|
||||
// Load a dummy image into the AVFrame to ensure we have something to encode
|
||||
// even if we time out waiting on the first frame.
|
||||
// even if we timeout waiting on the first frame.
|
||||
auto dummy_img = disp->alloc_img();
|
||||
if(!dummy_img || disp->dummy_img(dummy_img.get()) || session->device->convert(*dummy_img)) {
|
||||
return;
|
||||
@@ -1905,7 +1905,7 @@ int init() {
|
||||
|
||||
BOOST_LOG(info) << "// Testing for available encoders, this may generate errors. You can safely ignore those errors. //"sv;
|
||||
|
||||
// If we haven't found an encoder yet but we want one with HDR support, search for that now.
|
||||
// If we haven't found an encoder yet, but we want one with HDR support, search for that now.
|
||||
if(!encoder_found && config::video.hevc_mode == 3) {
|
||||
KITTY_WHILE_LOOP(auto pos = std::begin(encoders), pos != std::end(encoders), {
|
||||
auto encoder = *pos;
|
||||
|
||||
@@ -74,7 +74,7 @@ using float4 = float[4];
|
||||
using float3 = float[3];
|
||||
using float2 = float[2];
|
||||
|
||||
struct __attribute__((__aligned__(16))) color_t {
|
||||
struct alignas(16) color_t {
|
||||
float4 color_vec_y;
|
||||
float4 color_vec_u;
|
||||
float4 color_vec_v;
|
||||
|
||||
Reference in New Issue
Block a user