Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
rtsp.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <atomic>
9#include <list>
10#include <memory>
11#include <mutex>
12#include <optional>
13#include <string>
14
15// local includes
16#include "crypto.h"
17#include "thread_safe.h"
18#include "uuid.h"
19
20
21// Resolve circular dependencies
22namespace stream {
23 struct session_t;
24}
25
26namespace rtsp_stream {
27 constexpr auto RTSP_SETUP_PORT = 21;
28
30 uint32_t id;
31 // Serialize the final RTSP handoff against an HTTPS cancellation. A
32 // socket may retain this object after the pending event is removed.
33 std::mutex lifecycle_mutex;
34 std::atomic_bool cancelled {false};
35
36 crypto::aes_t gcm_key;
37 crypto::aes_t iv;
38
39 std::string av_ping_payload;
40 uint32_t control_connect_data;
41
42 std::string device_name;
43 std::string unique_id;
44 crypto::PERM perm;
45
46 bool input_only;
47 bool host_audio;
48 bool enable_mic {};
49 int width;
50 int height;
51 int fps;
52 int gcmap;
53 int surround_info;
54 std::string surround_params;
55 bool enable_hdr;
56 bool enable_sops;
57 bool virtual_display;
60 std::optional<bool> client_virtual_display;
63 std::optional<int> client_scale_factor;
67 std::string launch_error_message;
68 // Experimental Linux Hermes-KMS multi-output state. The display is owned
69 // by the streaming session rather than by the process/app lifetime.
70 bool session_scoped_virtual_display = false;
71 // True only while the launch/RTSP handshake still owns cleanup. This is
72 // cleared when ownership moves to stream::session_t.
73 bool session_virtual_display_cleanup_pending = false;
74 std::string display_name;
75 // Experimental Linux session isolation. One Hermes process may own many
76 // independent compositor/app runtimes, one for each Moonlight session.
77 bool isolated_session = false;
78 uint32_t isolated_runtime_owner_id = 0;
79 std::string isolated_session_profile;
80 std::string isolated_runtime_id;
81 std::string isolated_seat_id;
82 std::string drm_device_path;
83 std::string wayland_display;
84 std::string kwin_wayland_socket;
85 std::string kwin_pipewire_socket;
86 uint32_t scale_factor;
87 std::string launch_mode;
88
89 std::optional<crypto::cipher::gcm_t> rtsp_cipher;
90 std::string rtsp_url_scheme;
91 uint32_t rtsp_iv_counter;
92
93 std::list<crypto::command_entry_t> client_do_cmds;
94 std::list<crypto::command_entry_t> client_undo_cmds;
95
96 uuid_util::uuid_t display_guid{};
97 };
98
103 bool launch_session_raise(std::shared_ptr<launch_session_t> launch_session);
104
109 void launch_session_clear(uint32_t launch_session_id);
110
115 bool cancel_pending_launch(const std::string_view &uuid);
116
121 int session_count();
122
123 int shared_session_count();
124
129 std::string_view last_termination_reason();
130
131 std::shared_ptr<stream::session_t>
132 find_session(const std::string_view& uuid);
133
134 std::optional<bool> session_is_isolated(const std::string_view &uuid);
135
136 std::list<std::string>
137 get_all_session_uuids();
138
140 bool terminate_session(const std::string_view &uuid);
141
143 void terminate_shared_sessions();
144
148 void terminate_sessions();
149
153 void start();
154
163 std::string surround_params(int config);
164} // namespace rtsp_stream
Declarations for cryptography functions.
PERM
The permissions of a client.
Definition crypto.h:45
std::string surround_params(int config)
The surround-params value the RTSP DESCRIBE reply advertises for an audio layout.
Definition rtsp.cpp:924
std::optional< int > client_scale_factor
Definition rtsp.h:63
std::optional< bool > client_virtual_display
Definition rtsp.h:60
bool enable_mic
The client set up a microphone stream.
Definition rtsp.h:48
Declarations for thread-safe data structures.
Declarations for UUID generation.