|
Sunshine master
Self-hosted game stream host for Moonlight.
|
Miscellaneous definitions for macOS platform. More...
#include <fcntl.h>#include <ifaddrs.h>#include <arpa/inet.h>#include <dlfcn.h>#include <Foundation/Foundation.h>#include <mach-o/dyld.h>#include <net/if_dl.h>#include <pwd.h>#include <sys/qos.h>#include <boost/asio/ip/address.hpp>#include <boost/asio/ip/host_name.hpp>#include <boost/process/v1.hpp>#include "misc.h"#include "src/entry_handler.h"#include "src/logging.h"#include "src/platform/common.h"Classes | |
| class | platf::macos_high_precision_timer |
| macOS high-precision timer implementation backed by a worker thread. More... | |
| class | platf::qos_t |
| Linux QoS state used to tune socket priority while streaming. More... | |
Macros | |
| #define | __APPLE_USE_RFC_3542 1 |
| Macro for APPLE USE RFC 3542. | |
Functions | |
| void | platf::adjust_thread_priority (thread_priority_e priority) |
| Apply the requested scheduling priority to the current thread. | |
| std::filesystem::path | platf::appdata () |
| Performs migration if necessary, then returns the appdata directory. | |
| bool | platf::CGPreflightScreenCaptureAccess (void) __attribute__((weak_import)) |
| Query macOS screen-capture permission without prompting the user. | |
| bool | platf::CGRequestScreenCaptureAccess (void) __attribute__((weak_import)) |
| Request macOS screen-capture permission from the user. | |
| std::unique_ptr< high_precision_timer > | platf::create_high_precision_timer () |
| Create platform-specific timer capable of high-precision sleep. | |
| void | platf::enable_mouse_keys () |
| Enable or disable X11 mouse keys for the current session. | |
| std::unique_ptr< deinit_t > | platf::enable_socket_qos (uintptr_t native_socket, boost::asio::ip::address &address, uint16_t port, qos_data_type_e data_type, bool dscp_tagging) |
| Enable QoS on the given socket for traffic to the specified destination. | |
| std::string | platf::from_sockaddr (const sockaddr *const) |
| Convert a socket address to a printable IP address. | |
| std::pair< std::uint16_t, std::string > | platf::from_sockaddr_ex (const sockaddr *const) |
| Convert a socket address to a port and printable IP address. | |
| std::string | platf::get_host_name () |
| Returns the current computer name in UTF-8. | |
| ifaddr_t | platf::get_ifaddrs () |
| Read the local interface address list. | |
| std::string | platf::get_mac_address (const std::string_view &address) |
| Return the hardware MAC address associated with a network address. | |
| void * | dyn::handle (const std::vector< const char * > &libs) |
| Return the native handle owned by the wrapper. | |
| std::unique_ptr< deinit_t > | platf::init () |
| Initialize the platform-specific high precision timer. | |
| bool | platf::is_screen_capture_allowed () |
| Check whether macOS has granted screen-capture permission. | |
| int | dyn::load (void *handle, const std::vector< std::tuple< apiproc *, const char * > > &funcs, bool strict) |
| Load persisted state from its backing store. | |
| void | platf::open_url (const std::string &url) |
| Open a url in the default web browser. | |
| bool | platf::process_group_running (std::uintptr_t native_handle) |
| Check if a process group still has running children. | |
| bool | platf::request_process_group_exit (std::uintptr_t native_handle) |
| Attempt to gracefully terminate a process group. | |
| std::string | platf::resolve_render_device () |
| Resolves the render device path to use for hardware encoding. | |
| void | platf::restart () |
| Restart the Sunshine process through the platform launcher. | |
| void | platf::restart_on_exit () |
| Request a Sunshine process restart on exit. | |
| bp::child | platf::run_command (bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) |
| Run a command on the users profile. | |
| bool | platf::send (send_info_t &send_info) |
| Send the serialized response over the active socket. | |
| bool | platf::send_batch (batched_send_info_t &send_info) |
| Send multiple fixed-size UDP payload blocks using the platform backend. | |
| void | platf::set_thread_name (const std::string &name) |
| Name the current thread for use with development tools. | |
| void | platf::streaming_will_start () |
| Apply Linux platform state before streaming starts. | |
| void | platf::streaming_will_stop () |
| Restore Linux platform state after streaming stops. | |
| struct sockaddr_in | platf::to_sockaddr (boost::asio::ip::address_v4 address, uint16_t port) |
| Convert to sockaddr. | |
| struct sockaddr_in6 | platf::to_sockaddr (boost::asio::ip::address_v6 address, uint16_t port) |
| Convert to sockaddr. | |
Miscellaneous definitions for macOS platform.
| void platf::adjust_thread_priority | ( | thread_priority_e | priority | ) |
Apply the requested scheduling priority to the current thread.
| priority | Thread priority requested from the platform backend. |
| std::filesystem::path platf::appdata | ( | ) |
Performs migration if necessary, then returns the appdata directory.
This is used for the log directory, so it cannot invoke Boost logging!
| bool platf::CGPreflightScreenCaptureAccess | ( | void | ) |
Query macOS screen-capture permission without prompting the user.
| bool platf::CGRequestScreenCaptureAccess | ( | void | ) |
Request macOS screen-capture permission from the user.
| std::unique_ptr< high_precision_timer > platf::create_high_precision_timer | ( | ) |
Create platform-specific timer capable of high-precision sleep.
| std::unique_ptr< deinit_t > platf::enable_socket_qos | ( | uintptr_t | native_socket, |
| boost::asio::ip::address & | address, | ||
| uint16_t | port, | ||
| qos_data_type_e | data_type, | ||
| bool | dscp_tagging ) |
Enable QoS on the given socket for traffic to the specified destination.
Enables QoS on the given socket for traffic to the specified destination.
| native_socket | The native socket handle. |
| address | The destination address for traffic sent on this socket. |
| port | The destination port for traffic sent on this socket. |
| data_type | The type of traffic sent on this socket. |
| dscp_tagging | Specifies whether to enable DSCP tagging on outgoing traffic. |
| std::string platf::from_sockaddr | ( | const sockaddr * const | ip_addr | ) |
Convert a socket address to a printable IP address.
| ip_addr | Socket address to format. |
| std::pair< std::uint16_t, std::string > platf::from_sockaddr_ex | ( | const sockaddr * const | ip_addr | ) |
Convert a socket address to a port and printable IP address.
| ip_addr | Socket address to format. |
| std::string platf::get_host_name | ( | ) |
Returns the current computer name in UTF-8.
| ifaddr_t platf::get_ifaddrs | ( | ) |
Read the local interface address list.
| std::string platf::get_mac_address | ( | const std::string_view & | address | ) |
Return the hardware MAC address associated with a network address.
| address | Network address being parsed or filtered. |
| void * dyn::handle | ( | const std::vector< const char * > & | libs | ) |
Return the native handle owned by the wrapper.
| libs | List of libraries to probe for the requested symbol. |
|
nodiscard |
Initialize the platform-specific high precision timer.
Initialize the Linux high-precision timer file descriptor.
| bool platf::is_screen_capture_allowed | ( | ) |
Check whether macOS has granted screen-capture permission.
Check whether screen capture allowed.
| int dyn::load | ( | void * | handle, |
| const std::vector< std::tuple< apiproc *, const char * > > & | funcs, | ||
| bool | strict = true ) |
Load persisted state from its backing store.
| handle | Native library or object handle used by the operation. |
| funcs | Function table populated from the loaded library. |
| strict | Whether missing functions should be treated as an error. |
| void platf::open_url | ( | const std::string & | url | ) |
Open a url in the default web browser.
| url | The url to open. |
| bool platf::process_group_running | ( | std::uintptr_t | native_handle | ) |
Check if a process group still has running children.
| native_handle | The native handle of the process group. |
true if processes are still running. | bool platf::request_process_group_exit | ( | std::uintptr_t | native_handle | ) |
Attempt to gracefully terminate a process group.
| native_handle | The native handle of the process group. |
true if termination was successfully requested. | std::string platf::resolve_render_device | ( | ) |
Resolves the render device path to use for hardware encoding.
If config::video.adapter_name is set, returns that. Otherwise, auto-detects the GPU with a connected display via find_render_node_with_display(). Falls back to /dev/dri/renderD128 if detection fails.
| bp::child platf::run_command | ( | bool | elevated, |
| bool | interactive, | ||
| const std::string & | cmd, | ||
| boost::filesystem::path & | working_dir, | ||
| const bp::environment & | env, | ||
| FILE * | file, | ||
| std::error_code & | ec, | ||
| bp::group * | group ) |
Run a command on the users profile.
Launches a child process as the user, using the current user's environment and a specific working directory.
| elevated | Specify whether to elevate the process. |
| interactive | Specify whether this will run in a window or hidden. |
| cmd | The command to run. |
| working_dir | The working directory for the new process. |
| env | The environment variables to use for the new process. |
| file | A file object to redirect the child process's output to (may be nullptr). |
| ec | An error code, set to indicate any errors that occur during the launch process. |
| group | A pointer to a bp::group object to which the new process should belong (may be nullptr). |
bp::child object representing the new process, or an empty bp::child object if the launch fails. | bool platf::send | ( | send_info_t & | send_info | ) |
Send the serialized response over the active socket.
| send_info | Socket addresses, buffers, and sizes for the send operation. |
| bool platf::send_batch | ( | batched_send_info_t & | send_info | ) |
Send multiple fixed-size UDP payload blocks using the platform backend.
| send_info | Socket addresses, buffers, and sizes for the send operation. |
| void platf::set_thread_name | ( | const std::string & | name | ) |
Name the current thread for use with development tools.
| name | Human-readable name to assign. |
| SOCKADDR_IN platf::to_sockaddr | ( | boost::asio::ip::address_v4 | address, |
| uint16_t | port ) |
Convert to sockaddr.
| address | Network address being parsed or filtered. |
| port | TCP or UDP port number. |
| SOCKADDR_IN6 platf::to_sockaddr | ( | boost::asio::ip::address_v6 | address, |
| uint16_t | port ) |
Convert to sockaddr.
| address | Network address being parsed or filtered. |
| port | TCP or UDP port number. |