12#include <unordered_map>
33 "csrf_allowed_origins"
42 void log_config_settings(
const std::unordered_map<std::string, std::string> &vars,
bool save);
60 std::string sw_preset;
62 std::optional<int> svtav1_preset;
75 int vbv_percentage_increase;
79 std::optional<int> qsv_preset;
80 std::optional<int> qsv_cavlc;
85 std::optional<int> amd_usage_h264;
86 std::optional<int> amd_usage_hevc;
87 std::optional<int> amd_usage_av1;
88 std::optional<int> amd_rc_h264;
89 std::optional<int> amd_rc_hevc;
90 std::optional<int> amd_rc_av1;
91 std::optional<int> amd_enforce_hrd;
92 std::optional<int> amd_quality_h264;
93 std::optional<int> amd_quality_hevc;
94 std::optional<int> amd_quality_av1;
95 std::optional<int> amd_preanalysis;
96 std::optional<int> amd_vbaq;
108 bool strict_rc_buffer;
183 std::vector<mode_remapping_entry_t>
mixed;
389 int parse(
int argc,
char *argv[]);
396 std::unordered_map<std::string, std::string>
parse_config(
const std::string_view &file_content);
stream_t stream
Default stream configuration values used before file and CLI overrides.
Definition config.cpp:715
input_t input
Default input configuration values used before file and CLI overrides.
Definition config.cpp:744
std::unordered_map< std::string, std::string > parse_config(const std::string_view &file_content)
Parse Sunshine configuration text into key-value entries.
Definition config.cpp:920
int parse(int argc, char *argv[])
Parse serialized text into the corresponding runtime representation.
Definition config.cpp:1797
video_t video
Default video configuration values used before file and CLI overrides.
Definition config.cpp:623
sunshine_t sunshine
Default top-level Sunshine configuration values used before file and CLI overrides.
Definition config.cpp:774
audio_t audio
Default audio configuration values used before file and CLI overrides.
Definition config.cpp:705
std::unordered_map< std::string, std::string > modified_config_settings
Configuration keys changed during the current parse or UI update.
Definition config.h:26
constexpr int PACKETSIZE_MAX
Highest accepted configured packet size in bytes.
Definition config.h:21
constexpr int ENCRYPTION_MODE_OPPORTUNISTIC
Encryption policy that uses encrypted video only when the client supports it.
Definition config.h:221
flag_e
Enumerates supported flag options.
Definition config.h:294
@ UPNP
Try Universal Plug 'n Play.
Definition config.h:298
@ FRESH_STATE
Do not load or save state.
Definition config.h:296
@ FLAG_SIZE
Number of flags.
Definition config.h:300
@ PIN_STDIN
Read PIN from stdin instead of http.
Definition config.h:295
@ FORCE_VIDEO_HEADER_REPLACE
force replacing headers inside video data
Definition config.h:297
@ CONST_PIN
Use "universal" pin.
Definition config.h:299
constexpr std::array redacted_config
Configuration keys whose values must be hidden in logs.
Definition config.h:32
constexpr int PACKETSIZE_LARGE
Default large packet size that avoids common MTU fragmentation.
Definition config.h:23
constexpr int PACKETSIZE_MIN
Lowest accepted configured packet size in bytes.
Definition config.h:20
constexpr int ENCRYPTION_MODE_MANDATORY
Encryption policy that rejects clients without video encryption support.
Definition config.h:225
constexpr int ENCRYPTION_MODE_NEVER
Encryption policy that always sends unencrypted video.
Definition config.h:217
constexpr int PACKETSIZE_SMALL
Conservative packet size used for low-MTU links.
Definition config.h:22
Contains all the functions and variables related to the nvhttp (GameStream) server.
Definition nvhttp.cpp:41
Declarations for NVENC encoder configuration.
Audio capture and encoder settings loaded from configuration.
Definition config.h:207
bool stream
Enable audio streaming to clients.
Definition config.h:210
bool install_steam_drivers
Install Steam audio drivers for enhanced compatibility.
Definition config.h:211
std::string sink
Audio output device/sink to use for audio capture.
Definition config.h:208
std::string virtual_sink
Virtual audio sink for audio routing.
Definition config.h:209
HTTP and HTTPS settings used by the GameStream pairing server.
Definition config.h:248
std::string file_state
Path to the persisted Sunshine state file.
Definition config.h:258
std::string external_ip
External address advertised to clients when configured.
Definition config.h:260
std::string cert
Certificate PEM string or path.
Definition config.h:254
std::string pkey
Private key PEM string or path.
Definition config.h:253
std::string sunshine_name
Host name advertised to Moonlight clients.
Definition config.h:256
std::string origin_web_ui_allowed
Origin policy used for Web UI access checks.
Definition config.h:251
External preparation command plus its privilege requirement.
Definition config.h:307
prep_cmd_t(std::string &&do_cmd, bool &&elevated)
Build a preparation command entry from parsed configuration data.
Definition config.h:327
prep_cmd_t(std::string &&do_cmd, std::string &&undo_cmd, bool &&elevated)
Build a preparation command entry from parsed configuration data.
Definition config.h:315
std::string undo_cmd
Command to run after the application exits.
Definition config.h:333
std::string do_cmd
Command to run before the application starts.
Definition config.h:332
bool elevated
Whether the process should be launched elevated.
Definition config.h:334
Network stream settings shared by audio, video, and control channels.
Definition config.h:230
int lan_encryption_mode
Video encryption policy for LAN clients.
Definition config.h:238
std::string file_apps
Path to the configured applications file.
Definition config.h:233
int wan_encryption_mode
Video encryption policy for WAN clients.
Definition config.h:239
int fec_percentage
Percentage of forward-error-correction packets to add to the stream.
Definition config.h:235
int packetsize
Maximum payload size for network packets.
Definition config.h:242
std::chrono::milliseconds ping_timeout
Timeout used when waiting for client ping responses.
Definition config.h:231
Command-line options parsed before configuration loading.
Definition config.h:355
char ** argv
Command-line argument vector.
Definition config.h:358
int argc
Number of command-line arguments.
Definition config.h:357
std::string name
Executable name from the command line.
Definition config.h:356
Top-level Sunshine configuration and credential state.
Definition config.h:340
bool system_tray
Enable the system tray integration.
Definition config.h:367
std::string salt
Salt used when hashing the Web UI password.
Definition config.h:348
std::string address_family
Address family requested for listening sockets.
Definition config.h:362
std::string password
Password hash or secret for the local Web UI account.
Definition config.h:347
std::string config_file
Path to the active Sunshine configuration file.
Definition config.h:350
std::uint16_t port
TCP port used by Sunshine services.
Definition config.h:361
std::string credentials_file
Path to the stored pairing credentials file.
Definition config.h:344
std::string locale
Locale selected for Sunshine UI and log messages.
Definition config.h:341
std::vector< prep_cmd_t > prep_cmds
Preparation commands executed around application launch.
Definition config.h:368
std::string log_file
Path to the configured log file.
Definition config.h:365
std::string username
Username for the local Web UI account.
Definition config.h:346
int min_log_level
Minimum severity level written to the configured log sink.
Definition config.h:342
std::bitset< flag::FLAG_SIZE > flags
Runtime flags parsed from command-line options.
Definition config.h:343
bool notify_pre_releases
Notify users about pre-release updates.
Definition config.h:366
struct config::sunshine_t::cmd_t cmd
Command line used to launch the application.
std::string bind_address
Local address Sunshine should bind to.
Definition config.h:363
std::vector< std::string > csrf_allowed_origins
Additional origins allowed by CSRF validation.
Definition config.h:372
Single display mode remapping rule from configuration.
Definition config.h:172
std::string final_refresh_rate
Refresh-rate string to apply after remapping.
Definition config.h:176
std::string requested_fps
Refresh-rate string requested by the client.
Definition config.h:174
std::string final_resolution
Resolution string to apply after remapping.
Definition config.h:175
std::string requested_resolution
Resolution string requested by the client.
Definition config.h:173
Collection of display mode remapping rules.
Definition config.h:182
std::vector< mode_remapping_entry_t > refresh_rate_only
To be use when only refresh_rate_option is set to automatic.
Definition config.h:185
std::vector< mode_remapping_entry_t > mixed
To be used when resolution_option and refresh_rate_option is set to automatic.
Definition config.h:183
std::vector< mode_remapping_entry_t > resolution_only
To be use when only resolution_option is set to automatic.
Definition config.h:184
Compatibility workarounds for display-device control.
Definition config.h:128
std::chrono::milliseconds hdr_toggle_delay
Specify whether to apply HDR high-contrast color workaround and what delay to use.
Definition config.h:129
Display-device integration settings.
Definition config.h:124
refresh_rate_option_e refresh_rate_option
Refresh-rate selection mode selected by configuration.
Definition config.h:191
std::string manual_resolution
Manual resolution in case resolution_option == resolution_option_e::manual.
Definition config.h:190
refresh_rate_option_e
Selects how Sunshine chooses the stream display refresh rate.
Definition config.h:155
hdr_option_e
Selects how Sunshine handles HDR state for the stream display.
Definition config.h:164
bool config_revert_on_disconnect
Specify whether to revert display configuration on client disconnect.
Definition config.h:195
std::chrono::milliseconds config_revert_delay
Time to wait until settings are reverted (after stream ends/app exists).
Definition config.h:194
std::string manual_refresh_rate
Manual refresh rate in case refresh_rate_option == refresh_rate_option_e::manual.
Definition config.h:192
config_option_e
Selects how Sunshine prepares the active display before streaming.
Definition config.h:135
@ disabled
Disable the configuration for the device.
hdr_option_e hdr_option
HDR-selection mode selected by configuration.
Definition config.h:193
resolution_option_e
Selects how Sunshine chooses the stream display resolution.
Definition config.h:146
@ automatic
Change resolution and use the one received from Moonlight.
@ manual
Change resolution and use the manually provided one.
mode_remapping_t mode_remapping
Display mode remapping rules grouped by automatic selection mode.
Definition config.h:196
workarounds_t wa
Display-device compatibility workarounds.
Definition config.h:197
config_option_e configuration_option
Display-preparation mode selected by configuration.
Definition config.h:188
resolution_option_e resolution_option
Resolution-selection mode selected by configuration.
Definition config.h:189
Video encoder, capture, and color settings loaded from configuration.
Definition config.h:47
std::string encoder
Encoder backend name selected by configuration.
Definition config.h:117
struct config::video_t::@1 nv_legacy
Legacy NVIDIA encoder options kept for config compatibility.
bool nv_realtime_hags
Enable the NVIDIA realtime HAGS workaround.
Definition config.h:66
std::string capture
Capture backend name selected by configuration.
Definition config.h:116
int qp
Quantization parameter used by encoders where higher values trade quality for compression.
Definition config.h:52
int max_bitrate
Maximum bitrate ceiling in kbps for bitrate requested from the client.
Definition config.h:200
int min_threads
Minimum number of threads or slices for CPU encoding.
Definition config.h:57
std::string adapter_name
Display adapter name selected in configuration.
Definition config.h:118
struct config::video_t::@6 vk
Vulkan encoder options.
std::string output_name
Display output name selected in configuration.
Definition config.h:119
struct config::video_t::dd_t dd
Display-device integration settings.
double minimum_fps_target
Lowest framerate that will be used when streaming. Range 0-1000, 0 = half of client's requested frame...
Definition config.h:201
bool nv_sunshine_high_power_mode
Request NVIDIA high-power mode for Sunshine.
Definition config.h:68
struct config::video_t::@2 qsv
Intel Quick Sync encoder options.
int av1_mode
AV1 support mode advertised to clients.
Definition config.h:55
nvenc::nvenc_config nv
NVIDIA NVENC encoder settings.
Definition config.h:65
int hevc_mode
HEVC support mode advertised to clients.
Definition config.h:54
struct config::video_t::@5 vaapi
VA-API encoder options.
struct config::video_t::@4 vt
VideoToolbox encoder options.
struct config::video_t::@3 amd
AMD AMF encoder options.
bool nv_opengl_vulkan_on_dxgi
Prefer NVIDIA OpenGL/Vulkan-on-DXGI interop.
Definition config.h:67
struct config::video_t::@0 sw
Software encoder options.
NVENC encoder configuration.
Definition nvenc_config.h:30