Declarations for the startup and shutdown of the apps started by a streaming Session.
More...
#include <optional>
#include <unordered_map>
#include "config.h"
#include "platform/common.h"
#include "rtsp.h"
#include "src/boost_process_compat.h"
#include "utility.h"
Go to the source code of this file.
|
|
#define | __kernel_entry |
| | Macro for kernel entry.
|
|
#define | DEFAULT_APP_IMAGE_PATH SUNSHINE_ASSETS_DIR "/box.png" |
| | Macro for DEFAULT APP IMAGE PATH.
|
|
|
using | proc::cmd_t = config::prep_cmd_t |
| | Parsed command arguments used when launching a child process.
|
|
using | proc::file_t = util::safe_ptr_v2<FILE, int, &fclose> |
| | Boost.Process pipe stream used for child-process I/O.
|
|
| 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.
|
| bool | proc::check_valid_png (const std::filesystem::path &path) |
| | Validates a path whether it is a valid PNG.
|
| std::unique_ptr< platf::deinit_t > | proc::init () |
| | Initialize proc functions.
|
| std::optional< proc::proc_t > | proc::parse (const std::string &file_name) |
| | Parse serialized text into the corresponding runtime representation.
|
| std::string | proc::prepare_command (const std::string &command) |
| | Prepare a configured command for execution.
|
| void | proc::refresh (const std::string &file_name) |
| | Refresh cached platform state from the operating system.
|
| void | proc::terminate_process_group (boost::process::v1::child &child_process, boost::process::v1::group &group, std::chrono::seconds exit_timeout) |
| | Terminates all child processes in a process group.
|
| std::string | proc::validate_app_image_path (std::string app_image_path) |
| | Validate app image path.
|
Declarations for the startup and shutdown of the apps started by a streaming Session.
◆ calculate_app_id()
| 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.
- Returns
- Tuple of id calculated without index (for use if no collision) and one with.
- Parameters
-
| app_name | App name. |
| app_image_path | App image path. |
| index | Zero-based index of the item being addressed. |
◆ check_valid_png()
| bool proc::check_valid_png |
( |
const std::filesystem::path & | path | ) |
|
Validates a path whether it is a valid PNG.
- Parameters
-
| path | The path to the PNG file. |
- Returns
- true if the file has a valid PNG signature, false otherwise.
◆ init()
Initialize proc functions.
- Returns
- Unique pointer to deinit_t to manage cleanup
◆ parse()
| std::optional< proc::proc_t > proc::parse |
( |
const std::string & | file_name | ) |
|
Parse serialized text into the corresponding runtime representation.
- Parameters
-
- Returns
- Parsed value or parse status.
◆ prepare_command()
| std::string proc::prepare_command |
( |
const std::string & | command | ) |
|
Prepare a configured command for execution.
- Parameters
-
| command | Configured command line. |
- Returns
- Command line with any package-specific launcher prefix applied.
◆ refresh()
| void proc::refresh |
( |
const std::string & | file_name | ) |
|
Refresh cached platform state from the operating system.
This function compares the current last modified time of the file to the time it was last parsed. If the file has been modified since it was last parsed (or if it has never been parsed), it will be re-parsed to update the app list.
An optional is used rather than a bare file_time_type because value-initialized file_time_type{} is not a reliable "never parsed" sentinel. On some toolchains (e.g. MSYS2 UCRT64 GCC 16.2), file_time_type::clock::now() compares less-or-equal to file_time_type{}, which would cause the initial parse to be skipped.
When an app is currently running, only the cached app configuration list and environment are updated — active process state (_app_id, _process, _process_group, etc.) is preserved so that the in-flight streaming session can still be terminated properly.
- Parameters
-
< Timestamp of the last successful apps.json parse, or nullopt if never parsed.
◆ terminate_process_group()
| void proc::terminate_process_group |
( |
boost::process::v1::child & | child_process, |
|
|
boost::process::v1::group & | group, |
|
|
std::chrono::seconds | exit_timeout ) |
Terminates all child processes in a process group.
- Parameters
-
| child_process | 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. |
◆ validate_app_image_path()
| std::string proc::validate_app_image_path |
( |
std::string | app_image_path | ) |
|
Validate app image path.
- Parameters
-
| app_image_path | Candidate image path from the application configuration. |
- Returns
- Existing PNG path, or the default application image when validation fails.