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:
@@ -162,6 +162,42 @@ int coder_from_view(const std::string_view &coder) {
|
||||
}
|
||||
} // namespace amd
|
||||
|
||||
namespace vt {
|
||||
|
||||
enum coder_e : int {
|
||||
_auto = 0,
|
||||
cabac,
|
||||
cavlc
|
||||
};
|
||||
|
||||
int coder_from_view(const std::string_view &coder) {
|
||||
if(coder == "auto"sv) return _auto;
|
||||
if(coder == "cabac"sv || coder == "ac"sv) return cabac;
|
||||
if(coder == "cavlc"sv || coder == "vlc"sv) return cavlc;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int allow_software_from_view(const std::string_view &software) {
|
||||
if(software == "allowed"sv || software == "forced") return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int force_software_from_view(const std::string_view &software) {
|
||||
if(software == "forced") return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rt_from_view(const std::string_view &rt) {
|
||||
if(rt == "disabled" || rt == "off" || rt == "0") return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // namespace vt
|
||||
|
||||
video_t video {
|
||||
28, // qp
|
||||
|
||||
@@ -685,6 +721,14 @@ void apply_config(std::unordered_map<std::string, std::string> &&vars) {
|
||||
video.amd.rc_hevc = amd::rc_hevc_from_view(rc);
|
||||
}
|
||||
|
||||
int_f(vars, "vt_coder", video.vt.coder, vt::coder_from_view);
|
||||
video.vt.allow_sw = 0;
|
||||
int_f(vars, "vt_software", video.vt.allow_sw, vt::allow_software_from_view);
|
||||
video.vt.require_sw = 0;
|
||||
int_f(vars, "vt_software", video.vt.require_sw, vt::force_software_from_view);
|
||||
video.vt.realtime = 1;
|
||||
int_f(vars, "vt_realtime", video.vt.realtime, vt::rt_from_view);
|
||||
|
||||
string_f(vars, "encoder", video.encoder);
|
||||
string_f(vars, "adapter_name", video.adapter_name);
|
||||
string_f(vars, "output_name", video.output_name);
|
||||
|
||||
Reference in New Issue
Block a user