Classes | Enumerations | Functions

gnash::rtmp Namespace Reference

Classes

struct  RTMPHeader
 The RTMPHeader contains all the fields for the packet header. More...
struct  RTMPPacket
 An RTMPPacket class contains a full description of an RTMP packet. More...
struct  RTMP
 This class is for handling the RTMP protocol. More...

Enumerations

enum  ControlType {
  CONTROL_CLEAR_STREAM = 0x00, CONTROL_CLEAR_BUFFER = 0x01, CONTROL_STREAM_DRY = 0x02, CONTROL_BUFFER_TIME = 0x03,
  CONTROL_RESET_STREAM = 0x04, CONTROL_PING = 0x06, CONTROL_PONG = 0x07, CONTROL_REQUEST_VERIFY = 0x1a,
  CONTROL_RESPOND_VERIFY = 0x1b, CONTROL_BUFFER_EMPTY = 0x1f, CONTROL_BUFFER_READY = 0x20
}
 

Known control / ping codes.

More...
enum  Channels { CHANNEL_CONTROL1 = 0x02, CHANNEL_CONTROL2 = 0x03, CHANNEL_VIDEO = 0x08 }
 

The known channels.

More...
enum  PacketType {
  PACKET_TYPE_NONE = 0x00, PACKET_TYPE_CHUNK_SIZE = 0x01, PACKET_TYPE_BYTES_READ = 0x03, PACKET_TYPE_CONTROL = 0x04,
  PACKET_TYPE_SERVERBW = 0x05, PACKET_TYPE_CLIENTBW = 0x06, PACKET_TYPE_AUDIO = 0x08, PACKET_TYPE_VIDEO = 0x09,
  PACKET_TYPE_FLEX_STREAM_SEND = 0x0f, PACKET_TYPE_FLEX_SHARED_OBJECT = 0x10, PACKET_TYPE_FLEX_MESSAGE = 0x11, PACKET_TYPE_METADATA = 0x12,
  PACKET_TYPE_SHARED_OBJECT = 0x13, PACKET_TYPE_INVOKE = 0x14, PACKET_TYPE_FLV = 0x16
}
 

The known packet types.

More...
enum  PacketSize { RTMP_PACKET_SIZE_LARGE = 0, RTMP_PACKET_SIZE_MEDIUM = 1, RTMP_PACKET_SIZE_SMALL = 2, RTMP_PACKET_SIZE_MINIMUM = 3 }
 

The PacketSize specifies the number of fields contained in the header.

More...

Functions

bool sendCtrl (RTMP &r, ControlType, unsigned int nObject, unsigned int nTime)
 Send a control packet.
std::ostream & operator<< (std::ostream &o, PacketType p)
 Logging assistance for PacketType.
std::ostream & operator<< (std::ostream &o, ControlType t)
 Logging assistance for ControlType.
bool hasPayload (const RTMPPacket &p)
 Check whether an RTMPPacket has a payload.
void clearPayload (RTMPPacket &p)
 Clear the message body and the bytes read of an RTMPPacket.
size_t payloadSize (const RTMPPacket &p)
 The current size of the space allocated for the message payload.
boost::uint8_t * payloadData (RTMPPacket &p)
 Access the payload data section of the buffer.
const boost::uint8_t * payloadData (const RTMPPacket &p)
 Access the payload data section of the buffer.
const boost::uint8_t * payloadEnd (const RTMPPacket &p)
 Get the end of the allocated payload data section of the buffer.
bool isReady (const RTMPPacket &p)
 Check if a packet is ready for processing.

Enumeration Type Documentation

The known channels.

CHANNEL_CONTROL1 is for internal controls: sendCtrl send server BW send bytes received. These contain no AMF data. CHANNEL_CONTROL2 is for ActionScript controls _checkbw: AS _result: connect: Maybe from ASNative(2100, 0) (connect) createStream: AS deleteStream: Maybe ASNative(2100, 1) (close) FCSubscribe: Don't know. These all contain AMF data.

Enumerator:
CHANNEL_CONTROL1 
CHANNEL_CONTROL2 
CHANNEL_VIDEO 

Known control / ping codes.

See http://jira.red5.org/confluence/display/docs/Ping (may not exist). 0x00: Clear the stream. No third and fourth parameters. The second parameter could be 0. After the connection is established, a Ping 0,0 will be sent from server to client. The message will also be sent to client on the start of Play and in response of a Seek or Pause/Resume request. This Ping tells client to re-calibrate the clock with the timestamp of the next packet server sends. 0x01: Tell the stream to clear the playing buffer. 0x02: Stream dry (not sure what this means!) 0x03: Buffer time of the client. The third parameter is the buffer time in milliseconds. 0x04: Reset a stream. Used together with type 0 in the case of VOD. Often sent before type 0. 0x06: Ping the client from server. The second parameter is the current time. 0x07: Pong reply from client. The second parameter is the time the server sent with his ping request. 0x1a: SWFVerification request 0x1b: SWFVerification response 0x1f: Not sure, maybe buffer empty. 0x20: Buffer ready.

Enumerator:
CONTROL_CLEAR_STREAM 
CONTROL_CLEAR_BUFFER 
CONTROL_STREAM_DRY 
CONTROL_BUFFER_TIME 
CONTROL_RESET_STREAM 
CONTROL_PING 
CONTROL_PONG 
CONTROL_REQUEST_VERIFY 
CONTROL_RESPOND_VERIFY 
CONTROL_BUFFER_EMPTY 
CONTROL_BUFFER_READY 

The PacketSize specifies the number of fields contained in the header.

1. A large packet has all header fields. We would expect the first packet on any channel to be large. 2. A medium packet has the same m_nInfoField2 and packet type. 3. A small packet has the same data size. 4. A minimal packet has all fields the same. The minimal and small data packets can be used to send a payload in more than one packet. If the data received is smaller than the specified data size, the packet remains in the channel with its payload. Data from each new packet is added to this stored payload until all the advertised data is read. These names are taken from rtmpdump.

Enumerator:
RTMP_PACKET_SIZE_LARGE 
RTMP_PACKET_SIZE_MEDIUM 
RTMP_PACKET_SIZE_SMALL 
RTMP_PACKET_SIZE_MINIMUM 

The known packet types.

Enumerator:
PACKET_TYPE_NONE 
PACKET_TYPE_CHUNK_SIZE 
PACKET_TYPE_BYTES_READ 
PACKET_TYPE_CONTROL 
PACKET_TYPE_SERVERBW 
PACKET_TYPE_CLIENTBW 
PACKET_TYPE_AUDIO 
PACKET_TYPE_VIDEO 
PACKET_TYPE_FLEX_STREAM_SEND 
PACKET_TYPE_FLEX_SHARED_OBJECT 
PACKET_TYPE_FLEX_MESSAGE 
PACKET_TYPE_METADATA 
PACKET_TYPE_SHARED_OBJECT 
PACKET_TYPE_INVOKE 
PACKET_TYPE_FLV 

Function Documentation

void gnash::rtmp::clearPayload ( RTMPPacket &  p  )  [inline]

Clear the message body and the bytes read of an RTMPPacket.

This is to be used to free used information from packets in a channel. The header information must be preserved for future packets, but the payload is no longer needed once read.

References gnash::rtmp::RTMPPacket::buffer, and gnash::rtmp::RTMPPacket::bytesRead.

bool gnash::rtmp::hasPayload ( const RTMPPacket &  p  )  [inline]

Check whether an RTMPPacket has a payload.

Only stored packets may not have a payload. A packet without a payload has already been processed and is only used for its header information.

References gnash::rtmp::RTMPPacket::buffer.

Referenced by payloadData(), payloadEnd(), and payloadSize().

bool gnash::rtmp::isReady ( const RTMPPacket &  p  )  [inline]

Check if a packet is ready for processing.

A packet is ready for processing if its payload size matches the data size in its header. It may take several successive packets to form a complete packet.

References gnash::rtmp::RTMPPacket::bytesRead, gnash::rtmp::RTMPHeader::dataSize, and gnash::rtmp::RTMPPacket::header.

std::ostream & gnash::rtmp::operator<< ( std::ostream &  o,
PacketType  p 
)

Logging assistance for PacketType.

std::ostream & gnash::rtmp::operator<< ( std::ostream &  o,
ControlType  t 
)

Logging assistance for ControlType.

const boost::uint8_t* gnash::rtmp::payloadData ( const RTMPPacket &  p  )  [inline]

Access the payload data section of the buffer.

References gnash::rtmp::RTMPPacket::buffer, gnash::SimpleBuffer::data(), hasPayload(), and gnash::rtmp::RTMPHeader::headerSize.

boost::uint8_t* gnash::rtmp::payloadData ( RTMPPacket &  p  )  [inline]

Access the payload data section of the buffer.

References gnash::rtmp::RTMPPacket::buffer, gnash::SimpleBuffer::data(), hasPayload(), and gnash::rtmp::RTMPHeader::headerSize.

const boost::uint8_t* gnash::rtmp::payloadEnd ( const RTMPPacket &  p  )  [inline]

Get the end of the allocated payload data section of the buffer.

Note that this is only valid for packets we create, and for packets we have fully read. Stored packets that have not yet received all data have allocated space that has not yet been written.

References gnash::rtmp::RTMPPacket::buffer, gnash::SimpleBuffer::data(), hasPayload(), and gnash::SimpleBuffer::size().

size_t gnash::rtmp::payloadSize ( const RTMPPacket &  p  )  [inline]

The current size of the space allocated for the message payload.

For messages we create, this matches the exact size of the payload. For messages we read, this is the expected size of the data.

References gnash::rtmp::RTMPPacket::buffer, hasPayload(), gnash::rtmp::RTMPHeader::headerSize, and gnash::SimpleBuffer::size().

bool gnash::rtmp::sendCtrl ( RTMP &  r,
ControlType  t,
unsigned int  nObject,
unsigned int  nTime 
)

Send a control packet.

The type of Ping packet is 0x4 and contains two mandatory parameters and two optional parameters. The first parameter is the type of Ping and in short integer. The second parameter is the target of the ping. As Ping is always sent in Channel 2 (control channel) and the target object in RTMP header is always 0 whicj means the Connection object, it's necessary to put an extra parameter to indicate the exact target object the Ping is sent to. The second parameter takes this responsibility. The value has the same meaning as the target object field in RTMP header. (The second value could also be used as other purposes, like RTT Ping/Pong. It is used as the timestamp.) The third and fourth parameters are optional and could be looked upon as the parameter of the Ping packet.

Referenced by gnash::rtmp::RTMP::call().