Initial support for MacOS

This commit introduces initial support for MacOS as third major host platform.
It relies on the VideoToolbox framework for audio and video processing, which
enables hardware accelerated processing of the stream on most platforms.
Audio capturing requires third party tools as MacOS does not offer the
recording of the audio output like the other platforms do. The commit enables
most features offered by Sunshine for MacOS with the big exception of gamepad
support. The patch sets was tested by a few volunteers, which allowed to remove
some of the early bugs. However, several bugs especially regarding corner
cases have probably not surfaced yet.

Besides instructions how to build from source, the commit also adds a Portfile
that allows a more easy installation. After available on the release branch,
a pull request for the Portfile in the MacPorts project is planned.

Signed-off-by: Anselm Busse <anselm.busse@outlook.com>
This commit is contained in:
Anselm Busse
2022-02-24 21:09:00 +01:00
parent df3e7c5ca1
commit 2b450839a1
27 changed files with 2191 additions and 4 deletions

View File

@ -10,6 +10,7 @@ Sunshine is a Gamestream host for Moonlight
# Building
- [Linux](README.md#linux)
- [MacOS](README.md#macos)
- [Windows](README.md#windows-10)
## Linux
@ -108,6 +109,53 @@ It's necessary to allow Sunshine to use KMS
- If you use hardware acceleration on Linux using an Intel or an AMD GPU (with VAAPI), you will get tons of [graphical issues](https://github.com/loki-47-6F-64/sunshine/issues/228) if your ffmpeg version is < 4.3. If it is not available in your distribution's repositories, consider using a newer version of your distribution.
- Ubuntu started to ship ffmpeg 4.3 starting with groovy (20.10). If you're using an older version, you could use [this PPA](https://launchpad.net/%7Esavoury1/+archive/ubuntu/ffmpeg4) instead of upgrading. **Using PPAs is dangerous and may break your system. Use it at your own risk.**
## macOS
### Quickstart
- Install [MacPorts](https://www.macports.org)
- Download the `Portfile` from this repository to `/tmp`
- In a Terminal run `cd /tmp && sudo port install`
- Sunshine configuration is in `/opt/local/etc`
- Run `sunshine` to start the Sunshine server
- You will be asked to grant access to screen recording and your microphone to be able to stream it
### Manuel Build
#### Requirements:
macOS Big Sur and Xcode 12.5+:
Either, using [MacPorts](https://www.macports.org), install the following
```
sudo port install cmake boost libopus ffmpeg
```
Or, using [Homebrew](https://brew.sh), install the follwoing:
```
brew install boost cmake ffmpeg libopusenc
# if there are issues with an SSL header that is not found:
cd /usr/local/include
ln -s ../opt/openssl/include/openssl .
```
#### Compilation:
- `git clone https://github.com/SunshineStream/Sunshine.git --recurse-submodules`
- `cd sunshine && mkdir build && cd build`
- `cmake ..`
- `make -j ${nproc}`
If cmake fails complaining to find Boost, try to set the path explicitly: `cmake -DBOOST_ROOT=[boost path] ..`, e.g., `cmake -DBOOST_ROOT=/opt/local/libexec/boost/1.76 ..`
### Setup:
- Sunshine can only access microphones on macOS due to system limitations. To stream system audio use [Soundflower](https://github.com/mattingalls/Soundflower) or [BlackHole](https://github.com/ExistentialAudio/BlackHole) and select their sink as audio device in `sunshine.conf`
- `assets/sunshine.conf` is an example configuration file. Modify it as you see fit, then use it by running:
`sunshine path/to/sunshine.conf`
- `assets/apps.json` is an [example](README.md#application-list) of a list of applications that are started just before running a stream
### Usage & Limitations:
- Command Keys are not forwarded by Moonlight. Right Option-Key is mapped to CMD-Key.
- Gamepads are not supported
## Windows 10
### Requirements: