Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous UI updates #2181

Merged
merged 8 commits into from
Mar 1, 2024
256 changes: 133 additions & 123 deletions docs/source/about/advanced_usage.rst
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since some of the options were re-ordered, can you re-order them here as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved UPnP, Channels, and the Config Files section. I think that's everything.

Original file line number Diff line number Diff line change
Expand Up @@ -92,112 +92,37 @@ editing the `conf` file in a text editor. Use the examples as reference.

min_log_level = info

`global_prep_cmd <https://localhost:47990/config/#global_prep_cmd>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
A list of commands to be run before/after all applications. If any of the prep-commands fail, starting the application is aborted.

**Default**
``[]``

**Example**
.. code-block:: text

global_prep_cmd = [{"do":"nircmd.exe setdisplay 1280 720 32 144","undo":"nircmd.exe setdisplay 2560 1440 32 144"}]

`Files <https://localhost:47990/config/#files>`__
-------------------------------------------------

`file_apps <https://localhost:47990/config/#file_apps>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The application configuration file path. The file contains a json formatted list of applications that can be started
by Moonlight.

**Default**
OS and package dependent

**Example**
.. code-block:: text

file_apps = apps.json

`credentials_file <https://localhost:47990/config/#credentials_file>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The file where user credentials for the UI are stored.

**Default**
``sunshine_state.json``

**Example**
.. code-block:: text

credentials_file = sunshine_state.json

`log_path <https://localhost:47990/config/#log_path>`__
`channels <https://localhost:47990/config/#channels>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The path where the sunshine log is stored.

**Default**
``sunshine.log``

**Example**
.. code-block:: text

log_path = sunshine.log

`pkey <https://localhost:47990/config/#pkey>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The private key used for the web UI and Moonlight client pairing. For best compatibility, this should be an RSA-2048 private key.

.. warning:: Not all Moonlight clients support ECDSA keys or RSA key lengths other than 2048 bits.

**Default**
``credentials/cakey.pem``

**Example**
.. code-block:: text

pkey = /dir/pkey.pem

`cert <https://localhost:47990/config/#cert>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sunshine can support multiple clients streaming simultaneously, at the cost of higher CPU and GPU usage.

**Description**
The certificate used for the web UI and Moonlight client pairing. For best compatibility, this should have an RSA-2048 public key.
.. note:: All connected clients share control of the same streaming session.

.. warning:: Not all Moonlight clients support ECDSA keys or RSA key lengths other than 2048 bits.
.. warning:: Some hardware encoders may have limitations that reduce performance with multiple streams.

**Default**
``credentials/cacert.pem``
``1``

**Example**
.. code-block:: text

cert = /dir/cert.pem
channels = 1

`file_state <https://localhost:47990/config/#file_state>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`global_prep_cmd <https://localhost:47990/config/#global_prep_cmd>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The file where current state of Sunshine is stored.
A list of commands to be run before/after all applications. If any of the prep-commands fail, starting the application is aborted.

**Default**
``sunshine_state.json``
``[]``

**Example**
.. code-block:: text

file_state = sunshine_state.json

global_prep_cmd = [{"do":"nircmd.exe setdisplay 1280 720 32 144","undo":"nircmd.exe setdisplay 2560 1440 32 144"}]

`Input <https://localhost:47990/config/#input>`__
-------------------------------------------------
Expand Down Expand Up @@ -712,6 +637,32 @@ keybindings
`Network <https://localhost:47990/config/#network>`__
-----------------------------------------------------

`upnp <https://localhost:47990/config/#upnp>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
Sunshine will attempt to open ports for streaming over the internet.

**Choices**

.. table::
:widths: auto

===== ===========
Value Description
===== ===========
on enable UPnP
off disable UPnP
===== ===========

**Default**
``disabled``

**Example**
.. code-block:: text

upnp = on

`address_family <https://localhost:47990/config/#address_family>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -798,32 +749,6 @@ keybindings

origin_web_ui_allowed = lan

`upnp <https://localhost:47990/config/#upnp>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
Sunshine will attempt to open ports for streaming over the internet.

**Choices**

.. table::
:widths: auto

===== ===========
Value Description
===== ===========
on enable UPnP
off disable UPnP
===== ===========

**Default**
``disabled``

**Example**
.. code-block:: text

upnp = on

`external_ip <https://localhost:47990/config/#external_ip>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -910,31 +835,100 @@ keybindings

ping_timeout = 10000

`Advanced <https://localhost:47990/config/#advanced>`__
-------------------------------------------------------
`Config Files <https://localhost:47990/config/#files>`__
--------------------------------------------------------

`channels <https://localhost:47990/config/#channels>`__
`file_apps <https://localhost:47990/config/#file_apps>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The application configuration file path. The file contains a json formatted list of applications that can be started
by Moonlight.

**Default**
OS and package dependent

**Example**
.. code-block:: text

file_apps = apps.json

`credentials_file <https://localhost:47990/config/#credentials_file>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The file where user credentials for the UI are stored.

**Default**
``sunshine_state.json``

**Example**
.. code-block:: text

credentials_file = sunshine_state.json

`log_path <https://localhost:47990/config/#log_path>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
This will generate distinct video streams, unlike simply broadcasting to multiple Clients.
The path where the sunshine log is stored.

**Default**
``sunshine.log``

**Example**
.. code-block:: text

log_path = sunshine.log

`pkey <https://localhost:47990/config/#pkey>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The private key used for the web UI and Moonlight client pairing. For best compatibility, this should be an RSA-2048 private key.

.. warning:: Not all Moonlight clients support ECDSA keys or RSA key lengths other than 2048 bits.

When multicasting, it could be useful to have different configurations for each connected Client.
**Default**
``credentials/cakey.pem``

For instance:
**Example**
.. code-block:: text

- Clients connected through WAN and LAN have different bitrate constraints.
- Decoders may require different settings for color.
pkey = /dir/pkey.pem

.. warning:: CPU usage increases for each distinct video stream generated.
`cert <https://localhost:47990/config/#cert>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The certificate used for the web UI and Moonlight client pairing. For best compatibility, this should have an RSA-2048 public key.

.. warning:: Not all Moonlight clients support ECDSA keys or RSA key lengths other than 2048 bits.

**Default**
``1``
``credentials/cacert.pem``

**Example**
.. code-block:: text

channels = 1
cert = /dir/cert.pem

`file_state <https://localhost:47990/config/#file_state>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
The file where current state of Sunshine is stored.

**Default**
``sunshine_state.json``

**Example**
.. code-block:: text

file_state = sunshine_state.json

`Advanced <https://localhost:47990/config/#advanced>`__
-------------------------------------------------------

`fec_percentage <https://localhost:47990/config/#fec_percentage>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -1424,6 +1418,22 @@ keybindings

qsv_coder = auto

`qsv_slow_hevc <https://localhost:47990/config/#qsv_slow_hevc>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

**Description**
This options enables use of HEVC on older Intel GPUs that only support low power encoding for H.264.

.. Caution:: Streaming performance may be significantly reduced when this option is enabled.

**Default**
``disabled``

**Example**
.. code-block:: text

qsv_slow_hevc = disabled

`AMD AMF Encoder <https://localhost:47990/config/#amd-amf-encoder>`__
---------------------------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ namespace config {
{
qsv::medium, // preset
qsv::_auto, // cavlc
false, // slow_hevc
}, // qsv

{
Expand Down Expand Up @@ -962,6 +963,7 @@ namespace config {

int_f(vars, "qsv_preset", video.qsv.qsv_preset, qsv::preset_from_view);
int_f(vars, "qsv_coder", video.qsv.qsv_cavlc, qsv::coder_from_view);
bool_f(vars, "qsv_slow_hevc", video.qsv.qsv_slow_hevc);

std::string quality;
string_f(vars, "amd_quality", quality);
Expand Down
1 change: 1 addition & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace config {
struct {
std::optional<int> qsv_preset;
std::optional<int> qsv_cavlc;
bool qsv_slow_hevc;
} qsv;

struct {
Expand Down
12 changes: 10 additions & 2 deletions src/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,9 @@ namespace video {
{ "profile"s, (int) qsv::profile_hevc_e::main_10 },
},
// Fallback options
{},
{
{ "low_power"s, []() { return config::video.qsv.qsv_slow_hevc ? 0 : 1; } },
},
std::nullopt, // QP rate control fallback
"hevc_qsv"s,
},
Expand Down Expand Up @@ -2719,7 +2721,13 @@ namespace video {
}

if (chosen_encoder == nullptr) {
BOOST_LOG(fatal) << "Couldn't find any working encoder"sv;
BOOST_LOG(fatal) << "Unable to find display or encoder during startup."sv;
if (!config::video.adapter_name.empty() || !config::video.output_name.empty()) {
BOOST_LOG(fatal) << "Please ensure your manually chosen GPU and monitor are connected and powered on."sv;
}
else {
BOOST_LOG(fatal) << "Please check that a display is connected and powered on."sv;
}
return -1;
}

Expand Down
7 changes: 4 additions & 3 deletions src_assets/common/assets/web/apps.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ <h1>Applications</h1>
</button>
</div>
<div class="form-text">
A list of commands to be run and forgotten about
A list of commands to be run in the background.<br>
<b>Note:</b> If the path to the command executable contains spaces, you must enclose it in quotes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question... do we accept any standard shell/terminal command including things such as piping, &&, ||, >, etc.

I wonder if we should add an option to select the shell to use and then just pass in their command as an argument to that shell. (Not for this PR, just an idea I've had for a little while)

Copy link
Collaborator Author

@cgutman cgutman Feb 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't currently, since those are shell builtins rather than real executables. I had similar thoughts when I was working on that URL support for Windows (and we do shell out to cmd.exe in some cases there too).

One problem is that we've already exposed shell-like features like output redirection in the UI as a separate option. It might be difficult to make that work properly with a true shell invocation since the command itself could be piping stdout somewhere else.

</div>
</div>
<!-- command -->
Expand All @@ -206,8 +207,8 @@ <h1>Applications</h1>
<input type="text" class="form-control monospace" id="appCmd" aria-describedby="appCmdHelp"
v-model="editForm.cmd" />
<div id="appCmdHelp" class="form-text">
The main application, if it is not specified, a process is started
that sleeps indefinitely
The main application to start. If blank, no application will be started.<br>
<b>Note:</b> If the path to the command executable contains spaces, you must enclose it in quotes.
</div>
</div>
<!-- working dir -->
Expand Down
Loading
Loading