Sunshine master
Self-hosted game stream host for Moonlight.
stream.h File Reference

Declarations for the streaming protocols. More...

#include <utility>
#include <boost/asio.hpp>
#include "audio.h"
#include "crypto.h"
#include "video.h"
Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stream::config_t
 Stream configuration shared by capture and network senders. More...
 

Enumerations

enum class  stream::session::state_e : int { STOPPED , STOPPING , STARTING , RUNNING }
 Enumerates supported state options. More...
 

Functions

std::shared_ptr< session_tstream::session::alloc (config_t &config, rtsp_stream::launch_session_t &launch_session)
 Allocate and initialize platform input state for a stream.
 
const std::string & stream::session::client_cert (session_t &session)
 Return the paired client certificate for this session.
 
void stream::session::join (session_t &session)
 Wait for worker threads owned by the session to exit.
 
int stream::session::start (session_t &session, const std::string &addr_string)
 Start the audio, video, and control workers for a streaming session.
 
state_e stream::session::state (session_t &session)
 Platform handle returned from stream setup.
 
void stream::session::stop (session_t &session)
 Stop the active streaming session and prevent new packets from being queued.
 

Variables

constexpr auto stream::AUDIO_STREAM_PORT = 11
 GameStream base-port offset used for the audio UDP stream.
 
constexpr auto stream::CONTROL_PORT = 10
 GameStream base-port offset used for the control channel.
 
constexpr auto stream::VIDEO_STREAM_PORT = 9
 GameStream base-port offset used for the video UDP stream.
 

Detailed Description

Declarations for the streaming protocols.

Enumeration Type Documentation

◆ state_e

enum class stream::session::state_e : int
strong

Enumerates supported state options.

Enumerator
STOPPED 

The session is stopped.

STOPPING 

The session is stopping.

STARTING 

The session is starting.

RUNNING 

The session is running.

Function Documentation

◆ alloc()

std::shared_ptr< session_t > stream::session::alloc ( config_t & config,
rtsp_stream::launch_session_t & launch_session )

Allocate and initialize platform input state for a stream.

Parameters
configConfiguration values to apply.
launch_sessionLaunch session.
Returns
Allocated object or identifier, or an error value on failure.

◆ client_cert()

const std::string & stream::session::client_cert ( session_t & session)

Return the paired client certificate for this session.

Return the paired client certificate for a stream session.

Parameters
sessionActive streaming or pairing session for the request.
Returns
PEM certificate associated with the session's client.

◆ join()

void stream::session::join ( session_t & session)

Wait for worker threads owned by the session to exit.

Parameters
sessionActive streaming or pairing session for the request.

◆ start()

int stream::session::start ( session_t & session,
const std::string & addr_string )

Start the audio, video, and control workers for a streaming session.

Start a streaming session for the supplied peer address.

Parameters
sessionActive streaming or pairing session for the request.
addr_stringAddr string.
Returns
Start status.

◆ state()

state_e stream::session::state ( session_t & session)

Platform handle returned from stream setup.

Parameters
sessionActive streaming or pairing session for the request.
Returns
Current lifecycle state for the stream session.

◆ stop()

void stream::session::stop ( session_t & session)

Stop the active streaming session and prevent new packets from being queued.

Stop a streaming session and prevent more packets from being queued.

Parameters
sessionActive streaming or pairing session for the request.