|
Hermes 0.7.0
Linux game streaming host
|
Declarations for the startup and shutdown of the apps started by a streaming Session. More...
#include <optional>#include <string>#include <string_view>#include <unordered_map>#include <vector>#include <boost/process/v1/child.hpp>#include <boost/process/v1/group.hpp>#include <boost/process/v1/environment.hpp>#include <boost/process/v1/search_path.hpp>#include <boost/property_tree/ptree.hpp>#include <nlohmann/json.hpp>#include "config.h"#include "platform/common.h"#include "rtsp.h"#include "utility.h"#include "platform/linux/virtual_display.h"Go to the source code of this file.
Classes | |
| struct | proc::ctx_t |
| struct | proc::virtual_display_decision_t |
| struct | proc::scale_factor_decision_t |
| class | proc::proc_t |
| struct | proc::proc_t::isolated_session_t |
| One live isolated session, as the host needs to see it. More... | |
Macros | |
| #define | __kernel_entry |
| #define | BOOST_PROCESS_VERSION 1 |
| #define | VIRTUAL_DISPLAY_UUID "8902CB19-674A-403D-A587-41B092E900BA" |
| #define | FALLBACK_DESKTOP_UUID "EAAC6159-089A-46A9-9E24-6436885F6610" |
| #define | REMOTE_INPUT_UUID "8CB5C136-DA67-4F99-B4A1-F9CD35005CF4" |
| #define | TERMINATE_APP_UUID "E16CBE1B-295D-4632-9A76-EC4180C857D3" |
| #define | DETACHED_DESKTOP_UUID "5B1C7E0A-3D52-4F8E-9A61-2E7D0C4B9F13" |
| #define | DETACHED_STEAM_UUID "A4E2F6C8-1B37-4D95-8C0E-7F3A9D2B6E51" |
Typedefs | |
| using | proc::file_t = util::safe_ptr_v2<FILE, int, fclose> |
| typedef config::prep_cmd_t | proc::cmd_t |
Enumerations | |
| enum class | proc::session_route_e { shared , isolated_application , isolated_desktop } |
| enum class | proc::virtual_display_source_e { headless , app_forced , client , default_rule } |
| enum class | proc::scale_factor_source_e { app_forced , client , app , host_default } |
Functions | |
| bool | proc::launch_requests_virtual_display (const ctx_t &app, const rtsp_stream::launch_session_t &launch_session, bool headless_mode) |
| virtual_display_decision_t | proc::decide_virtual_display (const ctx_t &app, const rtsp_stream::launch_session_t &launch_session, bool headless_mode) |
| std::string_view | proc::describe (virtual_display_source_e source) |
| scale_factor_decision_t | proc::decide_scale_factor (const ctx_t &app, const rtsp_stream::launch_session_t &launch_session, int host_default) |
| std::string_view | proc::describe (scale_factor_source_e source) |
| session_route_e | proc::resolve_session_route (const ctx_t &app, bool isolated_sessions_enabled, bool virtual_display_requested, std::string_view global_method) |
| void | proc::migration_v7 (nlohmann::json &fileTree) |
| boost::filesystem::path | proc::find_working_directory (const std::string &cmd, const boost::process::v1::environment &env) |
| std::tuple< std::string, std::string > | proc::calculate_app_id (const std::string &app_name, std::string app_image_path, int index) |
| Calculate a stable id based on name and image data. | |
| std::string | proc::validate_app_image_path (std::string app_image_path) |
| void | proc::refresh (const std::string &file_name, bool needs_terminate) |
| void | proc::migrate_apps (nlohmann::json *fileTree_p, nlohmann::json *inputTree_p) |
| Migrate the applications stored in the file tree by merging in a new app. | |
| std::optional< proc::proc_t > | proc::parse (const std::string &file_name, bool fallback_on_failure=true) |
| Load the applications from apps.json. | |
| std::unique_ptr< platf::deinit_t > | proc::init () |
| Initialize proc functions. | |
| void | proc::initVDisplayDriver () |
| Initialize the virtual display driver. This should be called early in startup to enable virtual display support. | |
| void | proc::terminate_process_group (boost::process::v1::child &proc, boost::process::v1::group &group, std::chrono::seconds exit_timeout) |
| Terminates all child processes in a process group. | |
Declarations for the startup and shutdown of the apps started by a streaming Session.
Definition in file process.h.
| #define DETACHED_DESKTOP_UUID "5B1C7E0A-3D52-4F8E-9A61-2E7D0C4B9F13" |
| #define DETACHED_STEAM_UUID "A4E2F6C8-1B37-4D95-8C0E-7F3A9D2B6E51" |
| #define FALLBACK_DESKTOP_UUID "EAAC6159-089A-46A9-9E24-6436885F6610" |
| #define REMOTE_INPUT_UUID "8CB5C136-DA67-4F99-B4A1-F9CD35005CF4" |
| #define TERMINATE_APP_UUID "E16CBE1B-295D-4632-9A76-EC4180C857D3" |
| #define VIRTUAL_DISPLAY_UUID "8902CB19-674A-403D-A587-41B092E900BA" |
| typedef config::prep_cmd_t proc::cmd_t |
|
strong |
|
strong |
|
strong |
Who decided whether a launch uses a virtual display.
| std::tuple< std::string, std::string > proc::calculate_app_id | ( | const std::string & | app_name, |
| std::string | app_image_path, | ||
| int | index ) |
Calculate a stable id based on name and image data.
Definition at line 4470 of file process.cpp.
| scale_factor_decision_t proc::decide_scale_factor | ( | const ctx_t & | app, |
| const rtsp_stream::launch_session_t & | launch_session, | ||
| int | host_default ) |
Decide a launch's resolution scale: an app that forces its scale wins, then the client's, then the app's own when it is not 100, then the host default.
Definition at line 148 of file process.cpp.
| virtual_display_decision_t proc::decide_virtual_display | ( | const ctx_t & | app, |
| const rtsp_stream::launch_session_t & | launch_session, | ||
| bool | headless_mode ) |
Decide whether a launch uses a virtual display.
Headless mode always does. An app that forces its setting wins next, on or off. Otherwise a client that stated a choice gets it. Without one, the launch uses a virtual display if the client asked for one or the app's setting is on, as before.
Definition at line 109 of file process.cpp.
| std::string_view proc::describe | ( | scale_factor_source_e | source | ) |
Definition at line 165 of file process.cpp.
| std::string_view proc::describe | ( | virtual_display_source_e | source | ) |
A phrase for the log: "forced by the app", "the client's choice", ...
Definition at line 126 of file process.cpp.
| boost::filesystem::path proc::find_working_directory | ( | const std::string & | cmd, |
| const boost::process::v1::environment & | env ) |
Definition at line 1685 of file process.cpp.
| std::unique_ptr< platf::deinit_t > proc::init | ( | ) |
Initialize proc functions.
Definition at line 1601 of file process.cpp.
| void proc::initVDisplayDriver | ( | ) |
Initialize the virtual display driver. This should be called early in startup to enable virtual display support.
Definition at line 1580 of file process.cpp.
| bool proc::launch_requests_virtual_display | ( | const ctx_t & | app, |
| const rtsp_stream::launch_session_t & | launch_session, | ||
| bool | headless_mode ) |
Return whether policy explicitly requests a virtual display for this launch.
This is intentionally narrower than the legacy execute() fallback that may create a display merely because no active display is available. Losing a monitor must not by itself change session ownership.
Definition at line 140 of file process.cpp.
| void proc::migrate_apps | ( | nlohmann::json * | fileTree_p, |
| nlohmann::json * | inputTree_p ) |
Migrate the applications stored in the file tree by merging in a new app.
This function updates the application entries in fileTree_p using the data in inputTree_p. If an app in the file tree does not have a UUID, one is generated and inserted. If an app with the same UUID as the new app is found, it is replaced. Additionally, empty keys (such as "prep-cmd" or "detached") and keys no longer needed ("launching", "index") are removed from the input.
Legacy versions of Sunshine/Apollo stored boolean and integer values as strings. The following keys are converted:
A migration version is stored in the file tree (under "version") so that future changes can be applied.
| fileTree_p | Pointer to the JSON object representing the file tree. |
| inputTree_p | Pointer to the JSON object representing the new app. |
Definition at line 4521 of file process.cpp.
| void proc::migration_v7 | ( | nlohmann::json & | fileTree | ) |
v7: session-type became isolation-method, named after what each value runs; "shared" never was a way to isolate, so it became the host-session flag. Hermes' own entries lose "Detached" from their names unless the user renamed them.
Rename session-type to isolation-method in a parsed apps.json.
Definition at line 4796 of file process.cpp.
| std::optional< proc::proc_t > proc::parse | ( | const std::string & | file_name, |
| bool | fallback_on_failure = true ) |
Load the applications from apps.json.
| file_name | The apps file. |
| fallback_on_failure | When the file can't be loaded, return the fallback Desktop and built-in entries (startup) instead of nothing (a reload, which keeps the current list). |
Definition at line 4864 of file process.cpp.
| void proc::refresh | ( | const std::string & | file_name, |
| bool | needs_terminate ) |
Definition at line 5251 of file process.cpp.
| session_route_e proc::resolve_session_route | ( | const ctx_t & | app, |
| bool | isolated_sessions_enabled, | ||
| bool | virtual_display_requested, | ||
| std::string_view | global_method = "gamescope" ) |
Resolve a launch to the host session or an independent private session.
An app's own isolation method always applies. An app on the default follows global_method when a virtual display is requested, unless its layout places that display on the host desktop. host-session apps always stay on the host.
Definition at line 179 of file process.cpp.
| void proc::terminate_process_group | ( | boost::process::v1::child & | proc, |
| boost::process::v1::group & | group, | ||
| std::chrono::seconds | exit_timeout ) |
Terminates all child processes in a process group.
| proc | The child process itself. |
| group | The group of all children in the process tree. |
| exit_timeout | The timeout to wait for the process group to gracefully exit. |
Definition at line 1611 of file process.cpp.
| std::string proc::validate_app_image_path | ( | std::string | app_image_path | ) |
Definition at line 4393 of file process.cpp.