From 33fbd5f4316bd057de3723d1720d3124b0310b52 Mon Sep 17 00:00:00 2001 From: loki Date: Wed, 9 Jun 2021 20:40:17 +0200 Subject: [PATCH] Show/Hide config options based on platform and added vaapi config options to UI --- assets/sunshine.conf | 5 +- assets/web/config.html | 225 ++++++++++++++++++++++++++--------------- 2 files changed, 145 insertions(+), 85 deletions(-) diff --git a/assets/sunshine.conf b/assets/sunshine.conf index 9042beb4..f0eb72c6 100644 --- a/assets/sunshine.conf +++ b/assets/sunshine.conf @@ -103,7 +103,8 @@ # # You can find the name of the audio sink using the following command: # !! Linux only !! -# pacmd list-sinks | grep "name:" +# pacmd list-sinks | grep "name:" if running vanilla pulseaudio +# pactl info | grep Source` if running pipewire # audio_sink = alsa_output.pci-0000_09_00.3.analog-stereo # # !! Windows only !! @@ -251,4 +252,4 @@ # To set the initial state of flags -0 and -1 to on, set the following flags: # flags = 01 # -# See: sunshine --help for all options under the header: flags \ No newline at end of file +# See: sunshine --help for all options under the header: flags diff --git a/assets/web/config.html b/assets/web/config.html index 356e4d45..808492ac 100644 --- a/assets/web/config.html +++ b/assets/web/config.html @@ -13,14 +13,15 @@
- +
The name displayed by Moonlight. If not specified, the PC's hostname is used
- @@ -45,13 +46,15 @@
- +
If no external IP address is given, the local IP address is used
- +
How long to wait in milliseconds for data from moonlight before shutting down the stream
@@ -61,13 +64,16 @@
-
+
{{r}} ×
- - + +
@@ -79,9 +85,11 @@ ×
- - + +
@@ -111,13 +119,15 @@
- +
The file where current state of Sunshine is stored
- +
The file where current apps of Sunshine are stored
@@ -125,7 +135,8 @@
- +
The back/select button on the controller.
On the Shield, the home and powerbutton are not passed to Moonlight.
@@ -137,7 +148,8 @@
- +
Control how fast keys will repeat themselves
The initial delay in milliseconds before repeating keys @@ -146,7 +158,8 @@
- +
How often keys repeat every second
This configurable option supports decimals @@ -156,51 +169,69 @@
-
+
- -
+ +
The name of the audio sink used for Audio Loopback
You can find the name of the audio sink using the following command:
tools\audio-info.exe
-
+
+
+ + +
The name of the audio sink used for Audio Loopback
If you do not specify this variable, pulseaudio will select the default monitor device.

- You can find the name of the audio sink using the following command:
-
pacmd list-sinks | grep "name:"

+ You can find the name of the audio sink using either command:
+
pacmd list-sinks | grep "name:"
+
pactl info | grep Source

- +
- The virtual sink, is the audio device that's virtual (Like Steam Streaming Speakers), it allows Sunshine + The virtual sink, is the audio device that's virtual (Like Steam Streaming Speakers), it allows + Sunshine to stream audio, while muting the speakers.
- -
+ +
You can select the video card you want to stream:
The appropriate values can be found using the following command:
tools\dxgi-info.exe
-
+
- +
You can select the video card you want to stream:
The appropriate values can be found using the following command:
- tools\dxgi-info.exe
- !! Linux only !!
- Set the display number to stream. I have no idea how they are numbered. They start from 0, usually.
+ tools\dxgi-info.exe

+
+
+
+ + +
+ xrandr --listmonitors
+ Example output: +
   0: +HDMI-1 1920/518x1200/324+0+0 HDMI-1
@@ -208,7 +239,8 @@
- +
Constant Rate Factor. Between 1 and 52. It allows QP to go up during motion and down with still image, @@ -231,7 +263,8 @@
- +
Minimum number of threads used by ffmpeg to encode the video.
Increasing the value slightly reduces encoding efficiency, but the tradeoff is usually
@@ -246,11 +279,13 @@ - +
Allows the client to request HEVC Main or HEVC Main10 video streams.
- HEVC is more CPU-intensive to encode, so enabling this may reduce performance when using software + HEVC is more CPU-intensive to encode, so enabling this may reduce performance when using + software encoding.
@@ -261,6 +296,7 @@ +
@@ -270,7 +306,8 @@
- +
How much error correcting packets must be send for every video.
This is just some random number, don't know the optimal value.
@@ -280,9 +317,10 @@
- +
- When multicasting, it could be useful to have different configurations for each connected Client. + When multicasting, it could be useful to have different configurations for each connected + Client. For example:
  • Clients connected through WAN and LAN have different bitrate contstraints.
  • @@ -296,7 +334,7 @@
    - +
    @@ -375,6 +413,10 @@
    +
    + +
Success! Restart Sunshine to apply changes
@@ -396,61 +438,78 @@ resIn: '', fpsIn: '', tabs: [{ - id: 'general', - name: "General" - }, - { - id: 'files', - name: "Files" - }, - { - id: 'input', - name: "Input" - }, - { - id: 'av', - name: "Audio/Video" - }, - { - id: 'advanced', - name: "Advanced" - }, - { - id: "sw", - name: "Software Encoder" - }, - { - id: "nv", - name: "NVENC Encoder" - }, - { - id: "amd", - name: "AMF Encoder" - } + id: 'general', + name: "General" + }, + { + id: 'files', + name: "Files" + }, + { + id: 'input', + name: "Input" + }, + { + id: 'av', + name: "Audio/Video" + }, + { + id: 'advanced', + name: "Advanced" + }, + { + id: "sw", + name: "Software Encoder" + }, + { + id: "nv", + name: "NVENC Encoder" + }, + { + id: "amd", + name: "AMF Encoder" + }, + { + id: "va-api", + name: "VA-API encoder" + } ] } }, created() { fetch("/api/config").then(r => r.json()).then((r) => { - this.config = r; + this.config = r; this.platform = this.config.platform; + + var app = document.getElementById("app"); + if (this.platform == "windows") { + this.tabs = this.tabs.filter(el => { + return el.id !== "va-api"; + }); + } + if (this.platform == "linux") { + this.tabs = this.tabs.filter(el => { + return el.id !== "nv" && el.id !== "amd"; + }); + } + delete this.config.status; delete this.config.platform; //Populate default values if not present in config - this.config.min_log_level = this.config.min_log_level || 2; - this.config.origin_pin_allowed = this.config.origin_pin_allowed || "lan"; - this.config.hevc_mode = this.config.hevc_mode || 0; - this.config.encoder = this.config.encoder || ''; - this.config.nv_preset = this.config.nv_preset || 'default'; - this.config.nv_rc = this.config.nv_rc || 'auto'; - this.config.nv_coder = this.config.nv_coder || 'auto'; - this.config.amd_quality = this.config.amd_quality || 'default'; - this.config.amd_rc = this.config.amd_rc || 'auto'; - this.config.fps = this.config.fps || '[10, 30, 60, 90, 120]'; - this.config.resolutions = this.config.resolutions || '[352x240,480x360,858x480,1280x720,1920x1080,2560x1080,3440x1440,1920x1200,3860x2160,3840x1600]'; + this.config.min_log_level = this.config.min_log_level || 2; + this.config.origin_pin_allowed = this.config.origin_pin_allowed || "lan"; + this.config.hevc_mode = this.config.hevc_mode || 0; + this.config.encoder = this.config.encoder || ''; + this.config.nv_preset = this.config.nv_preset || 'default'; + this.config.nv_rc = this.config.nv_rc || 'auto'; + this.config.nv_coder = this.config.nv_coder || 'auto'; + this.config.amd_quality = this.config.amd_quality || 'default'; + this.config.amd_rc = this.config.amd_rc || 'auto'; + this.config.fps = this.config.fps || '[10, 30, 60, 90, 120]'; + this.config.resolutions = this.config.resolutions || '[352x240,480x360,858x480,1280x720,1920x1080,2560x1080,3440x1440,1920x1200,3860x2160,3840x1600]'; this.fps = JSON.parse(this.config.fps); //Resolutions should be fixed because are not valid JSON - let res = this.config.resolutions.substring(1,this.config.resolutions.length-1); + let res = this.config.resolutions.substring(1, this.config.resolutions.length - 1); let resolutions = []; res.split(",").forEach(r => resolutions.push(r.trim())); this.resolutions = resolutions; @@ -466,7 +525,7 @@ method: "POST", body: JSON.stringify(this.config) }).then((r) => { - if (r.status == 200)this.success = true; + if (r.status == 200) this.success = true; }); } }