Hermes 0.7.0
Linux game streaming host
Loading...
Searching...
No Matches
rtsp.cpp File Reference

Definitions for RTSP streaming. More...

#include <moonlight-common-c/src/Limelight-internal.h>
#include <moonlight-common-c/src/Rtsp.h>
#include <array>
#include <cctype>
#include <format>
#include <set>
#include <unordered_map>
#include <utility>
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include "config.h"
#include "globals.h"
#include "input.h"
#include "logging.h"
#include "network.h"
#include "process.h"
#include "rtsp.h"
#include "stream.h"
#include "sync.h"
#include "video.h"
Include dependency graph for rtsp.cpp:

Go to the source code of this file.

Classes

struct  rtsp_stream::encrypted_rtsp_header_t
class  rtsp_stream::socket_t
class  rtsp_stream::rtsp_server_t

Typedefs

using rtsp_stream::msg_t = util::safe_ptr<RTSP_MESSAGE, free_msg>
using rtsp_stream::cmd_func_t = std::function<void(rtsp_server_t *server, tcp::socket &, launch_session_t &, msg_t &&)>

Functions

void rtsp_stream::free_msg (PRTSP_MESSAGE msg)
void rtsp_stream::print_msg (PRTSP_MESSAGE msg)
void rtsp_stream::cmd_not_found (tcp::socket &sock, launch_session_t &, msg_t &&req)
void rtsp_stream::respond (tcp::socket &sock, launch_session_t &session, POPTION_ITEM options, int statuscode, const char *status_msg, int seqn, const std::string_view &payload)
bool rtsp_stream::launch_session_raise (std::shared_ptr< launch_session_t > launch_session)
void rtsp_stream::launch_session_clear (uint32_t launch_session_id)
 Clear state for the specified launch session.
bool rtsp_stream::cancel_pending_launch (const std::string_view &uuid)
int rtsp_stream::session_count ()
 Get the number of active sessions.
int rtsp_stream::shared_session_count ()
std::string_view rtsp_stream::last_termination_reason ()
 Get a short identifier for why the most recent session ended.
std::shared_ptr< stream::session_t > rtsp_stream::find_session (const std::string_view &uuid)
std::optional< bool > rtsp_stream::session_is_isolated (const std::string_view &uuid)
std::list< std::string > rtsp_stream::get_all_session_uuids ()
bool rtsp_stream::terminate_session (const std::string_view &uuid)
void rtsp_stream::terminate_shared_sessions ()
void rtsp_stream::terminate_sessions ()
 Terminates all running streaming sessions.
int rtsp_stream::send (tcp::socket &sock, const std::string_view &sv)
void rtsp_stream::respond (tcp::socket &sock, launch_session_t &session, msg_t &resp)
void rtsp_stream::cmd_option (rtsp_server_t *server, tcp::socket &sock, launch_session_t &session, msg_t &&req)
std::string rtsp_stream::surround_params (int config)
 The surround-params value the RTSP DESCRIBE reply advertises for an audio layout.
void rtsp_stream::cmd_describe (rtsp_server_t *server, tcp::socket &sock, launch_session_t &session, msg_t &&req)
void rtsp_stream::cmd_setup (rtsp_server_t *server, tcp::socket &sock, launch_session_t &session, msg_t &&req)
void rtsp_stream::cmd_announce (rtsp_server_t *server, tcp::socket &sock, launch_session_t &session, msg_t &&req)
void rtsp_stream::cmd_play (rtsp_server_t *server, tcp::socket &sock, launch_session_t &session, msg_t &&req)
void rtsp_stream::start ()
 Runs the RTSP server loop.

Variables

rtsp_server_t rtsp_stream::server {}

Detailed Description

Definitions for RTSP streaming.

Definition in file rtsp.cpp.

Macro Definition Documentation

◆ BOOST_BIND_GLOBAL_PLACEHOLDERS

#define BOOST_BIND_GLOBAL_PLACEHOLDERS

Definition at line 5 of file rtsp.cpp.

Typedef Documentation

◆ cmd_func_t

using rtsp_stream::cmd_func_t = std::function<void(rtsp_server_t *server, tcp::socket &, launch_session_t &, msg_t &&)>

Definition at line 106 of file rtsp.cpp.

◆ msg_t

using rtsp_stream::msg_t = util::safe_ptr<RTSP_MESSAGE, free_msg>

Definition at line 105 of file rtsp.cpp.

Function Documentation

◆ cancel_pending_launch()

bool rtsp_stream::cancel_pending_launch ( const std::string_view & uuid)

Cancel a pending RTSP launch for one paired client without touching any other client's handshake.

Definition at line 769 of file rtsp.cpp.

◆ cmd_announce()

void rtsp_stream::cmd_announce ( rtsp_server_t * server,
tcp::socket & sock,
launch_session_t & session,
msg_t && req )

Definition at line 1088 of file rtsp.cpp.

◆ cmd_describe()

void rtsp_stream::cmd_describe ( rtsp_server_t * server,
tcp::socket & sock,
launch_session_t & session,
msg_t && req )

Definition at line 946 of file rtsp.cpp.

◆ cmd_not_found()

void rtsp_stream::cmd_not_found ( tcp::socket & sock,
launch_session_t & session,
msg_t && req )

Definition at line 908 of file rtsp.cpp.

◆ cmd_option()

void rtsp_stream::cmd_option ( rtsp_server_t * server,
tcp::socket & sock,
launch_session_t & session,
msg_t && req )

Definition at line 912 of file rtsp.cpp.

◆ cmd_play()

void rtsp_stream::cmd_play ( rtsp_server_t * server,
tcp::socket & sock,
launch_session_t & session,
msg_t && req )

Definition at line 1401 of file rtsp.cpp.

◆ cmd_setup()

void rtsp_stream::cmd_setup ( rtsp_server_t * server,
tcp::socket & sock,
launch_session_t & session,
msg_t && req )

Definition at line 1026 of file rtsp.cpp.

◆ find_session()

std::shared_ptr< stream::session_t > rtsp_stream::find_session ( const std::string_view & uuid)

Definition at line 789 of file rtsp.cpp.

◆ free_msg()

void rtsp_stream::free_msg ( PRTSP_MESSAGE msg)

Definition at line 66 of file rtsp.cpp.

◆ get_all_session_uuids()

std::list< std::string > rtsp_stream::get_all_session_uuids ( )

Definition at line 801 of file rtsp.cpp.

◆ last_termination_reason()

std::string_view rtsp_stream::last_termination_reason ( )

Get a short identifier for why the most recent session ended.

Returns
e.g. "client_quit", "client_lost", "server_stopped", "unknown".

Definition at line 785 of file rtsp.cpp.

◆ launch_session_clear()

void rtsp_stream::launch_session_clear ( uint32_t launch_session_id)

Clear state for the specified launch session.

Parameters
launch_session_idThe ID of the session to clear.

Definition at line 765 of file rtsp.cpp.

◆ launch_session_raise()

bool rtsp_stream::launch_session_raise ( std::shared_ptr< launch_session_t > launch_session)

Publish a launch for the RTSP handshake.

Returns
false when another handshake is already pending.

Definition at line 761 of file rtsp.cpp.

◆ print_msg()

void rtsp_stream::print_msg ( PRTSP_MESSAGE msg)

Definition at line 1455 of file rtsp.cpp.

◆ respond() [1/2]

void rtsp_stream::respond ( tcp::socket & sock,
launch_session_t & session,
msg_t & resp )

Definition at line 833 of file rtsp.cpp.

◆ respond() [2/2]

void rtsp_stream::respond ( tcp::socket & sock,
launch_session_t & session,
POPTION_ITEM options,
int statuscode,
const char * status_msg,
int seqn,
const std::string_view & payload )

Definition at line 901 of file rtsp.cpp.

◆ send()

int rtsp_stream::send ( tcp::socket & sock,
const std::string_view & sv )

Definition at line 817 of file rtsp.cpp.

◆ session_count()

int rtsp_stream::session_count ( )

Get the number of active sessions.

Returns
Count of active sessions.

Definition at line 773 of file rtsp.cpp.

◆ session_is_isolated()

std::optional< bool > rtsp_stream::session_is_isolated ( const std::string_view & uuid)

Definition at line 793 of file rtsp.cpp.

◆ shared_session_count()

int rtsp_stream::shared_session_count ( )

Definition at line 780 of file rtsp.cpp.

◆ start()

void rtsp_stream::start ( )

Runs the RTSP server loop.

Definition at line 1413 of file rtsp.cpp.

◆ surround_params()

std::string rtsp_stream::surround_params ( int config)

The surround-params value the RTSP DESCRIBE reply advertises for an audio layout.

Channel count, stream count, coupled-stream count, then the channel mapping, with the normal-quality 5.1 and 7.1 mappings rotated to undo the rotation Moonlight applies to them.

Parameters
configAn audio::stream_config_e value.

GFE advertises incorrect mapping for normal quality configurations, as a result, Moonlight rotates all channels from index '3' to the right To work around this, rotate channels to the left from index '3', over the channels of this layout: 6 for 5.1, 8 for 7.1.

Definition at line 924 of file rtsp.cpp.

◆ terminate_session()

bool rtsp_stream::terminate_session ( const std::string_view & uuid)

Terminates only the session associated with a paired client.

Definition at line 805 of file rtsp.cpp.

◆ terminate_sessions()

void rtsp_stream::terminate_sessions ( )

Terminates all running streaming sessions.

Definition at line 813 of file rtsp.cpp.

◆ terminate_shared_sessions()

void rtsp_stream::terminate_shared_sessions ( )

Terminates only shared-host streaming sessions.

Definition at line 809 of file rtsp.cpp.

Variable Documentation

◆ server

rtsp_server_t rtsp_stream::server {}

Definition at line 759 of file rtsp.cpp.