Sunshine master
Self-hosted game stream host for Moonlight.
rtsp.h
Go to the documentation of this file.
1
5#pragma once
6
7// standard includes
8#include <atomic>
9
10// local includes
11#include "crypto.h"
12#include "thread_safe.h"
13
14namespace rtsp_stream {
15 constexpr auto RTSP_SETUP_PORT = 21;
16
21 uint32_t id;
22
25
26 std::string av_ping_payload;
28
30 std::string unique_id;
31 int width;
32 int height;
33 int fps;
34 int gcmap;
35 int appid;
37 std::string surround_params;
41
42 std::optional<crypto::cipher::gcm_t> rtsp_cipher;
43 std::string rtsp_url_scheme;
44 uint32_t rtsp_iv_counter;
45 std::string client_cert;
46 };
47
53 void launch_session_raise(std::shared_ptr<launch_session_t> launch_session);
54
59 void launch_session_clear(uint32_t launch_session_id);
60
65 int session_count();
66
70 void terminate_sessions();
76 void terminate_sessions_by_cert(std::string_view cert);
77
81 void start();
82} // namespace rtsp_stream
Declarations for cryptography functions.
std::vector< std::uint8_t > aes_t
Byte buffer containing AES key material.
Definition crypto.h:43
void terminate_sessions()
Terminates all running streaming sessions.
Definition rtsp.cpp:759
void launch_session_clear(uint32_t launch_session_id)
Clear state for the specified launch session.
Definition rtsp.cpp:748
int session_count()
Get the number of active sessions.
Definition rtsp.cpp:752
void terminate_sessions_by_cert(std::string_view cert)
Terminate active sessions associated with a client certificate.
Definition rtsp.cpp:766
void launch_session_raise(std::shared_ptr< launch_session_t > launch_session)
Queue a launch session until the RTSP client connects.
Definition rtsp.cpp:744
constexpr auto RTSP_SETUP_PORT
GameStream base-port offset used for the RTSP setup listener.
Definition rtsp.h:15
RTSP launch session state shared with stream setup.
Definition rtsp.h:20
bool host_audio
Whether host audio should be played locally.
Definition rtsp.h:29
std::string av_ping_payload
AV ping payload.
Definition rtsp.h:26
int gcmap
Game controller mapping requested by the client.
Definition rtsp.h:34
crypto::aes_t gcm_key
AES-GCM key negotiated for encrypted RTSP messages.
Definition rtsp.h:23
int appid
Application ID requested for launch or resume.
Definition rtsp.h:35
bool enable_hdr
Whether HDR streaming is requested.
Definition rtsp.h:39
std::string unique_id
Moonlight client unique identifier for this launch request.
Definition rtsp.h:30
int fps
Requested video frame rate.
Definition rtsp.h:33
std::optional< crypto::cipher::gcm_t > rtsp_cipher
AES-GCM cipher used once encrypted RTSP is negotiated.
Definition rtsp.h:42
int height
Frame or display height in pixels.
Definition rtsp.h:32
uint32_t rtsp_iv_counter
Counter value mixed into encrypted RTSP IVs.
Definition rtsp.h:44
std::string client_cert
PEM certificate for the paired Moonlight client.
Definition rtsp.h:45
bool continuous_audio
Whether audio packets continue during silence.
Definition rtsp.h:38
std::string surround_params
Client-provided surround-sound layout parameters.
Definition rtsp.h:37
uint32_t control_connect_data
Client-provided token used when connecting the control channel.
Definition rtsp.h:27
std::string rtsp_url_scheme
URL scheme selected by the RTSP SETUP flow.
Definition rtsp.h:43
int width
Frame or display width in pixels.
Definition rtsp.h:31
int surround_info
Encoded GameStream surround-sound capability flags.
Definition rtsp.h:36
uint32_t id
RTSP launch-session identifier assigned before stream startup.
Definition rtsp.h:21
bool enable_sops
Whether sequence output protection is requested.
Definition rtsp.h:40
crypto::aes_t iv
Initial RTSP AES-GCM IV supplied by the client.
Definition rtsp.h:24
Declarations for thread-safe data structures.