MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
Data Structures | Functions | Variables
RTMPStream Namespace Reference

Contains all functions and classes needed for RTMP connections. More...

Data Structures

class  Chunk
 Holds a single RTMP chunk, either send or receive direction. More...
 

Functions

bool doHandshake ()
 Does the handshake. Expects handshake_in to be filled, and fills handshake_out. More...
 
std::string & SendChunk (unsigned int cs_id, unsigned char msg_type_id, unsigned int msg_stream_id, std::string data)
 Packs up a chunk with the given arguments as properties. More...
 
std::string & SendCTL (unsigned char type, unsigned int data)
 Packs up a chunk for a control message with 1 argument. More...
 
std::string & SendCTL (unsigned char type, unsigned int data, unsigned char data2)
 Packs up a chunk for a control message with 2 arguments. More...
 
std::string & SendMedia (unsigned char msg_type_id, unsigned char *data, int len, unsigned int ts)
 Packs up a chunk with media contents. More...
 
std::string & SendMedia (FLV::Tag &tag)
 Packs up a chunk with media contents. More...
 
std::string & SendUSR (unsigned char type, unsigned int data)
 Packs up a chunk for a user control message with 1 argument. More...
 
std::string & SendUSR (unsigned char type, unsigned int data, unsigned int data2)
 Packs up a chunk for a user control message with 2 arguments. More...
 

Variables

unsigned int chunk_rec_max = 128
 Maximum size for a received chunk. More...
 
unsigned int chunk_snd_max = 128
 Maximum size for a sent chunk. More...
 
std::string handshake_in
 This value should be set to the first 1537 bytes received. More...
 
std::string handshake_out
 This value is the handshake response that is to be sent out. More...
 
timeval lastrec
 Timestamp of last time data was received. More...
 
std::map< unsigned int, Chunklastrecv
 Holds the last received chunk for every msg_id. More...
 
std::map< unsigned int, Chunklastsend
 Holds the last sent chunk for every msg_id. More...
 
unsigned int rec_cnt = 0
 Counter for total data received, in bytes. More...
 
unsigned int rec_window_at = 0
 Current position of the receiving window. More...
 
unsigned int rec_window_size = 2500000
 Window size for receiving. More...
 
unsigned int snd_cnt = 0
 Counter for total data sent, in bytes. More...
 
unsigned int snd_window_at = 0
 Current position of the sending window. More...
 
unsigned int snd_window_size = 2500000
 Window size for sending. More...
 

Detailed Description

Contains all functions and classes needed for RTMP connections.

Function Documentation

bool RTMPStream::doHandshake ( )

Does the handshake. Expects handshake_in to be filled, and fills handshake_out.

Does the handshake.

Expects handshake_in to be filled, and fills handshake_out. After calling this function, don't forget to read and ignore 1536 extra bytes, these are the handshake response and not interesting for us because we don't do client verification.

std::string & RTMPStream::SendChunk ( unsigned int  cs_id,
unsigned char  msg_type_id,
unsigned int  msg_stream_id,
std::string  data 
)

Packs up a chunk with the given arguments as properties.

std::string & RTMPStream::SendCTL ( unsigned char  type,
unsigned int  data 
)

Packs up a chunk for a control message with 1 argument.

std::string & RTMPStream::SendCTL ( unsigned char  type,
unsigned int  data,
unsigned char  data2 
)

Packs up a chunk for a control message with 2 arguments.

std::string & RTMPStream::SendMedia ( unsigned char  msg_type_id,
unsigned char *  data,
int  len,
unsigned int  ts 
)

Packs up a chunk with media contents.

Parameters
msg_type_idType number of the media, as per FLV standard.
dataContents of the media data.
lenLength of the media data, in bytes.
tsTimestamp of the media data, relative to current system time.
std::string & RTMPStream::SendMedia ( FLV::Tag tag)

Packs up a chunk with media contents.

Parameters
tagFLV::Tag with media to send.
std::string & RTMPStream::SendUSR ( unsigned char  type,
unsigned int  data 
)

Packs up a chunk for a user control message with 1 argument.

std::string & RTMPStream::SendUSR ( unsigned char  type,
unsigned int  data,
unsigned int  data2 
)

Packs up a chunk for a user control message with 2 arguments.

Variable Documentation

unsigned int RTMPStream::chunk_rec_max = 128

Maximum size for a received chunk.

unsigned int RTMPStream::chunk_snd_max = 128

Maximum size for a sent chunk.

std::string RTMPStream::handshake_in

This value should be set to the first 1537 bytes received.

Input for the handshake.

std::string RTMPStream::handshake_out

This value is the handshake response that is to be sent out.

Output for the handshake.

timeval RTMPStream::lastrec

Timestamp of last time data was received.

std::map< unsigned int, Chunk > RTMPStream::lastrecv

Holds the last received chunk for every msg_id.

std::map< unsigned int, Chunk > RTMPStream::lastsend

Holds the last sent chunk for every msg_id.

unsigned int RTMPStream::rec_cnt = 0

Counter for total data received, in bytes.

unsigned int RTMPStream::rec_window_at = 0

Current position of the receiving window.

unsigned int RTMPStream::rec_window_size = 2500000

Window size for receiving.

unsigned int RTMPStream::snd_cnt = 0

Counter for total data sent, in bytes.

unsigned int RTMPStream::snd_window_at = 0

Current position of the sending window.

unsigned int RTMPStream::snd_window_size = 2500000

Window size for sending.