Sunshine0.0.5917
Sunshine 0.0.5917
Self-hosted game stream host for Moonlight.
Loading...
Searching...
No Matches
misc.h File Reference

Miscellaneous declarations for macOS platform. More...

#include <vector>
#include "src/platform/permissions.h"
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum class  platf::permission_request_action_t { none , prompt , settings }
 Action to take when a macOS privacy permission is unavailable. More...

Functions

library_t * dyn::handle (const std::vector< const char * > &libs)
 Open the first available shared library from a nonempty list.
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=true)
 Load persisted state from its backing store.
permission_request_action_t platf::permission_request_action (bool granted, int previous_state, bool startup, bool retry_manual_request)
 Choose a privacy action without repeating a macOS startup prompt.
void platf::request_startup_permissions (bool notifications_enabled)
 Request missing permissions needed at startup.
void platf::request_startup_system_audio_permission ()
 Probe system audio once on startup when no custom sink is configured.
bool platf::request_system_audio_permission ()
 Start and stop an unmuted Core Audio tap to request system audio access.
bool platf::should_request_startup_permission (const permission_status_t &permission, bool notifications_enabled)
 Decide whether startup should initiate a native permission request.
bool platf::should_request_startup_system_audio_permission (bool has_custom_sink, bool previously_requested)
 Decide whether a one-time startup system audio probe is due.
bool platf::supports_local_network_privacy (int major_version)
 Check whether the macOS version has Local Network privacy controls.

Detailed Description

Miscellaneous declarations for macOS platform.

Enumeration Type Documentation

◆ permission_request_action_t

Action to take when a macOS privacy permission is unavailable.

Enumerator
none 

No startup action is needed after an earlier request.

prompt 

Ask macOS for the native permission.

settings 

Open the permission's settings pane.

Function Documentation

◆ handle()

void * dyn::handle ( const std::vector< const char * > & libs)

Open the first available shared library from a nonempty list.

Return the native handle owned by the wrapper.

Returns
Open library handle, or null if none could be loaded.
Parameters
libsList of libraries to probe for the requested symbol.
Returns
Native dynamic-library handle, or nullptr when no library can be opened.

◆ is_screen_capture_allowed()

bool platf::is_screen_capture_allowed ( )

Check whether macOS has granted screen-capture permission.

Check whether screen capture allowed.

Returns
True when Sunshine can capture the screen.

◆ load()

int dyn::load ( void * handle,
const std::vector< std::tuple< apiproc *, const char * > > & funcs,
bool strict = true )

Load persisted state from its backing store.

Parameters
handleNative library or object handle used by the operation.
funcsFunction table populated from the loaded library.
strictWhether missing functions should be treated as an error.
Returns
0 when all required symbols are loaded; nonzero when loading fails.

◆ permission_request_action()

permission_request_action_t platf::permission_request_action ( bool granted,
int previous_state,
bool startup,
bool retry_manual_request )

Choose a privacy action without repeating a macOS startup prompt.

Parameters
grantedWhether the native preflight check reports access.
previous_stateZero before a request, one after a request, or two after a grant.
startupWhether this action is part of automatic startup checks.
retry_manual_requestWhether a user-initiated action should retry the native request.
Returns
The action to perform.

◆ request_startup_permissions()

void platf::request_startup_permissions ( bool notifications_enabled)

Request missing permissions needed at startup.

Parameters
notifications_enabledWhether the running build shows tray notifications.

◆ request_startup_system_audio_permission()

void platf::request_startup_system_audio_permission ( )

Probe system audio once on startup when no custom sink is configured.

The operating system has no passive tap authorization query. Later streams may request access again if the user removes permission.

◆ request_system_audio_permission()

bool platf::request_system_audio_permission ( )

Start and stop an unmuted Core Audio tap to request system audio access.

Returns
True when the temporary tap started successfully.

◆ should_request_startup_permission()

bool platf::should_request_startup_permission ( const permission_status_t & permission,
bool notifications_enabled )

Decide whether startup should initiate a native permission request.

Parameters
permissionPermission status and requirement for the active configuration.
notifications_enabledWhether the system tray uses notifications.
Returns
True when a missing permission should be requested.

◆ should_request_startup_system_audio_permission()

bool platf::should_request_startup_system_audio_permission ( bool has_custom_sink,
bool previously_requested )

Decide whether a one-time startup system audio probe is due.

Parameters
has_custom_sinkWhether Sunshine uses a custom audio sink.
previously_requestedWhether a startup probe was already attempted.
Returns
True only for the first native system audio startup probe.

◆ supports_local_network_privacy()

bool platf::supports_local_network_privacy ( int major_version)

Check whether the macOS version has Local Network privacy controls.

Parameters
major_versionmacOS major version number.
Returns
True on macOS 15 and newer.