JRTPLIB  3.11.0
Public Member Functions | List of all members
jrtplib::RTPPacket Class Reference

Represents an RTP Packet. More...

#include <rtppacket.h>

Inherits jrtplib::RTPMemoryObject.

Public Member Functions

 RTPPacket (RTPRawPacket &rawpack, RTPMemoryManager *mgr=0)
 Creates an RTPPacket instance based upon the data in rawpack, optionally installing a memory manager. More...
 
 RTPPacket (uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, size_t maxpacksize, RTPMemoryManager *mgr=0)
 Creates a new buffer for an RTP packet and fills in the fields according to the specified parameters. More...
 
 RTPPacket (uint8_t payloadtype, const void *payloaddata, size_t payloadlen, uint16_t seqnr, uint32_t timestamp, uint32_t ssrc, bool gotmarker, uint8_t numcsrcs, const uint32_t *csrcs, bool gotextension, uint16_t extensionid, uint16_t extensionlen_numwords, const void *extensiondata, void *buffer, size_t buffersize, RTPMemoryManager *mgr=0)
 This constructor is similar to the other constructor, but here data is stored in an external buffer buffer with size buffersize. More...
 
int GetCreationError () const
 If an error occurred in one of the constructors, this function returns the error code. More...
 
bool HasExtension () const
 Returns true if the RTP packet has a header extension and false otherwise. More...
 
bool HasMarker () const
 Returns true if the marker bit was set and false otherwise. More...
 
int GetCSRCCount () const
 Returns the number of CSRCs contained in this packet. More...
 
uint32_t GetCSRC (int num) const
 Returns a specific CSRC identifier. More...
 
uint8_t GetPayloadType () const
 Returns the payload type of the packet. More...
 
uint32_t GetExtendedSequenceNumber () const
 Returns the extended sequence number of the packet. More...
 
uint16_t GetSequenceNumber () const
 Returns the sequence number of this packet. More...
 
void SetExtendedSequenceNumber (uint32_t seq)
 Sets the extended sequence number of this packet to seq. More...
 
uint32_t GetTimestamp () const
 Returns the timestamp of this packet. More...
 
uint32_t GetSSRC () const
 Returns the SSRC identifier stored in this packet. More...
 
uint8_t * GetPacketData () const
 Returns a pointer to the data of the entire packet. More...
 
uint8_t * GetPayloadData () const
 Returns a pointer to the actual payload data. More...
 
size_t GetPacketLength () const
 Returns the length of the entire packet. More...
 
size_t GetPayloadLength () const
 Returns the payload length. More...
 
uint16_t GetExtensionID () const
 If a header extension is present, this function returns the extension identifier. More...
 
uint8_t * GetExtensionData () const
 Returns the length of the header extension data. More...
 
size_t GetExtensionLength () const
 Returns the length of the header extension data. More...
 
RTPTime GetReceiveTime () const
 Returns the time at which this packet was received. More...
 

Detailed Description

The RTPPacket class can be used to parse a RTPRawPacket instance if it represents RTP data. The class can also be used to create a new RTP packet according to the parameters specified by the user.

Constructor & Destructor Documentation

jrtplib::RTPPacket::RTPPacket ( RTPRawPacket rawpack,
RTPMemoryManager mgr = 0 
)

Creates an RTPPacket instance based upon the data in rawpack, optionally installing a memory manager. If successful, the data is moved from the raw packet to the RTPPacket instance.

jrtplib::RTPPacket::RTPPacket ( uint8_t  payloadtype,
const void *  payloaddata,
size_t  payloadlen,
uint16_t  seqnr,
uint32_t  timestamp,
uint32_t  ssrc,
bool  gotmarker,
uint8_t  numcsrcs,
const uint32_t *  csrcs,
bool  gotextension,
uint16_t  extensionid,
uint16_t  extensionlen_numwords,
const void *  extensiondata,
size_t  maxpacksize,
RTPMemoryManager mgr = 0 
)

Creates a new buffer for an RTP packet and fills in the fields according to the specified parameters. If maxpacksize is not equal to zero, an error is generated if the total packet size would exceed maxpacksize. The arguments of the constructor are self-explanatory. Note that the size of a header extension is specified in a number of 32-bit words. A memory manager can be installed.

jrtplib::RTPPacket::RTPPacket ( uint8_t  payloadtype,
const void *  payloaddata,
size_t  payloadlen,
uint16_t  seqnr,
uint32_t  timestamp,
uint32_t  ssrc,
bool  gotmarker,
uint8_t  numcsrcs,
const uint32_t *  csrcs,
bool  gotextension,
uint16_t  extensionid,
uint16_t  extensionlen_numwords,
const void *  extensiondata,
void *  buffer,
size_t  buffersize,
RTPMemoryManager mgr = 0 
)

Member Function Documentation

int jrtplib::RTPPacket::GetCreationError ( ) const
inline
uint32_t jrtplib::RTPPacket::GetCSRC ( int  num) const

Returns a specific CSRC identifier. The parameter num can go from 0 to GetCSRCCount()-1.

int jrtplib::RTPPacket::GetCSRCCount ( ) const
inline
uint32_t jrtplib::RTPPacket::GetExtendedSequenceNumber ( ) const
inline

Returns the extended sequence number of the packet. When the packet is just received, only the low $16$ bits will be set. The high 16 bits can be filled in later.

uint8_t* jrtplib::RTPPacket::GetExtensionData ( ) const
inline
uint16_t jrtplib::RTPPacket::GetExtensionID ( ) const
inline
size_t jrtplib::RTPPacket::GetExtensionLength ( ) const
inline
uint8_t* jrtplib::RTPPacket::GetPacketData ( ) const
inline
size_t jrtplib::RTPPacket::GetPacketLength ( ) const
inline
uint8_t* jrtplib::RTPPacket::GetPayloadData ( ) const
inline
size_t jrtplib::RTPPacket::GetPayloadLength ( ) const
inline
uint8_t jrtplib::RTPPacket::GetPayloadType ( ) const
inline
RTPTime jrtplib::RTPPacket::GetReceiveTime ( ) const
inline

When an RTPPacket instance is created from an RTPRawPacket instance, the raw packet's reception time is stored in the RTPPacket instance. This function then retrieves that time.

uint16_t jrtplib::RTPPacket::GetSequenceNumber ( ) const
inline
uint32_t jrtplib::RTPPacket::GetSSRC ( ) const
inline
uint32_t jrtplib::RTPPacket::GetTimestamp ( ) const
inline
bool jrtplib::RTPPacket::HasExtension ( ) const
inline
bool jrtplib::RTPPacket::HasMarker ( ) const
inline
void jrtplib::RTPPacket::SetExtendedSequenceNumber ( uint32_t  seq)
inline

The documentation for this class was generated from the following file: