sipxmedialib  Version 3.3
Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
MpRtpBuf Struct Reference

Buffer for RTP packet data. More...

#include <MpRtpBuf.h>

Inheritance diagram for MpRtpBuf:
Inheritance graph
[legend]
Collaboration diagram for MpRtpBuf:
Collaboration graph
[legend]

Public Member Functions

Manipulators
bool setPayloadSize (int payloadSize)
 Set number of bytes in payload data. More...
 
void setRtpVersion (uint8_t version)
 Set RTP version of this packet. More...
 
void enableRtpPadding ()
 Set padding bit in RTP header. More...
 
void disableRtpPadding ()
 Clear padding bit in RTP header. More...
 
void enableRtpExtension ()
 Set extension bit in RTP header. More...
 
void disableRtpExtension ()
 Clear extension bit in RTP header. More...
 
void setRtpCSRCCount (uint8_t csrcCount)
 Set CSRC Count for this packet. More...
 
void enableRtpMarker ()
 Set marker bit in RTP header. More...
 
void disableRtpMarker ()
 Clear marker bit in RTP header. More...
 
void setRtpPayloadType (uint8_t type)
 Set Payload Type of this packet. More...
 
void setRtpSequenceNumber (RtpSeq sequenceNumber)
 Set Sequence Number of this packet. More...
 
void setRtpTimestamp (RtpTimestamp timestamp)
 Set Timestamp of this packet. More...
 
void setRtpSSRC (RtpSRC ssrc)
 Set SSRC of this packet. More...
 
Accessors
unsigned getPayloadSize () const
 Get current size of payload data. More...
 
RtpHeadergetRtpHeader ()
 Get direct access to RtpHeader structure. More...
 
const RtpHeadergetRtpHeader () const
 Get read-only direct access to RtpHeader structure. More...
 
RtpSRCgetRtpCSRCs ()
 Get direct access to RtpHeader structure. More...
 
const RtpSRCgetRtpCSRCs () const
 Get read-only direct access to RtpHeader structure. More...
 
uint8_t getRtpVersion () const
 Get RTP version of this packet. Should be equal to 2. More...
 
uint8_t getRtpCSRCCount () const
 Get CSRC Count for this packet. More...
 
uint8_t getRtpPayloadType () const
 Get Payload Type of this packet. More...
 
SdpCodec::SdpCodecTypes getCodecId () const
 Get the internal codec ID for this RTP packet's payload. More...
 
void setCodecId (SdpCodec::SdpCodecTypes codecId)
 Set the internal codec ID for this packet's payload. More...
 
RtpSeq getRtpSequenceNumber () const
 Get Sequence Number of this packet. More...
 
RtpTimestamp getRtpTimestamp () const
 Get Timestamp of this packet. More...
 
RtpSRC getRtpSSRC () const
 Get SSRC of this packet. More...
 
Inquiry
bool isRtpPadding () const
 Check padding bit in RTP header. More...
 
bool isRtpExtension () const
 Check extension bit in RTP header. More...
 
bool isRtpMarker () const
 Check marker bit in RTP header. More...
 
- Public Member Functions inherited from MpUdpBuf
bool setPacketSize (int size)
 Set size of packet data in bytes. More...
 
void setTimecode (unsigned timecode)
 Set time code for this packet. More...
 
void setIP (const in_addr &ip)
 Set source/destination address for this packet. More...
 
void setUdpPort (unsigned port)
 Set source/destination UDP port for this packet. More...
 
unsigned getPacketSize () const
 Get size of packet data in bytes. More...
 
unsigned getMaximumPacketSize () const
 Get maximum size of data this buffer can bear. More...
 
unsigned getTimecode () const
 Get time code for this packet. More...
 
const in_addr & getIP () const
 Get source/destination address for this packet. More...
 
unsigned getUdpPort () const
 Get source/destination UDP port for this packet. More...
 
- Public Member Functions inherited from MpDataBuf
void setData (const MpArrayBufPtr &pData)
 Set new payload data. More...
 
char * getDataWritePtr ()
 Return pointer to payload data. More...
 
const char * getDataPtr () const
 Return pointer to payload data. More...
 
MpArrayBufPtr getData () const
 Get payload data. More...
 
- Public Member Functions inherited from MpBuf
void attach ()
 Increments reference counter. More...
 
void detach ()
 Decrements reference counter and free buffer if needed. More...
 
void setFlowGraph (MpFlowGraphBase *flowgraph)
 
MP_BUFFERS_TREE getType () const
 Get buffer type. More...
 
MpBufPoolgetBufferPool () const
 Get parent pool of this buffer. More...
 

Static Public Attributes

static MpBufPoolsmpDefaultPool = NULL
 Default pool for MpDataBuf objects. More...
 
- Static Public Attributes inherited from MpUdpBuf
static MpBufPoolsmpDefaultPool = NULL
 Default pool for this type of buffer. More...
 
- Static Public Attributes inherited from MpDataBuf
static MpBufPoolsmpDefaultPool = NULL
 Default pool for MpDataBuf objects. More...
 

Protected Member Functions

void init ()
 This is called in place of constructor. More...
 
- Protected Member Functions inherited from MpUdpBuf
void init ()
 This is called in place of constructor. More...
 
- Protected Member Functions inherited from MpDataBuf
void init ()
 This is called in place of constructor. More...
 

Protected Attributes

RtpHeader mRtpHeader
 
SdpCodec::SdpCodecTypes mInternalCodecId
 Internal codec ID for this packets payload ID. More...
 
RtpSRC mRtpCSRCs [RTP_MAX_CSRCS]
 CSRCs list of RTP packet. More...
 
- Protected Attributes inherited from MpUdpBuf
unsigned mTimecode
 
in_addr mIP
 Source/destination IP-addres of this packet. More...
 
unsigned mPort
 Source/destination UDP-port of this packet. More...
 
- Protected Attributes inherited from MpDataBuf
MpArrayBufPtr mpData
 Payload data. More...
 
- Protected Attributes inherited from MpBuf
MP_BUFFERS_TREE mType
 Buffer class type. Used for type safety. More...
 
int mRefCounter
 Reference counter for use with MpBufPtr. More...
 
MpBufPoolmpPool
 Parent memory pool. More...
 
MpFlowGraphBasempFlowGraph
 Debug pointer to flowgraph in which this buf is used. More...
 
void(* mpDestroy )(MpBuf *)
 
void(* mpInitClone )(MpBuf *)
 

Private Member Functions

 MpRtpBuf (const MpBuf &)
 Disable copy (and other) constructor. More...
 
MpRtpBufoperator= (const MpBuf &)
 Disable assignment operator. More...
 

Friends

class MpRtpBufPtr
 

Additional Inherited Members

- Static Protected Member Functions inherited from MpDataBuf
static void sDestroy (MpBuf *pBuffer)
 Destructor for MpDataBuf. More...
 
static void sInitClone (MpBuf *pBuffer)
 Function that initialize buffer after cloning. It makes clone of mpData. More...
 
- Static Protected Member Functions inherited from MpBuf
static void sInitClone (MpBuf *pBuffer)
 Function that initialize buffer after cloning. It adjusts reference counters. More...
 

Detailed Description

Buffer for RTP packet data.

This is only the header for RTP data. It contain some RTP-related parameters and pointer to external data (cause it is based on MpDataBuf).

Constructor & Destructor Documentation

MpRtpBuf ( const MpBuf )
private

Disable copy (and other) constructor.

This struct will be initialized by init() member.

Member Function Documentation

bool setPayloadSize ( int  payloadSize)
inline

Set number of bytes in payload data.

See also
MpArrayBuf::setDataSize() for more details
void setRtpVersion ( uint8_t  version)
inline

Set RTP version of this packet.

See also
See getRtpVersion() for details.
void enableRtpPadding ( )
inline

Set padding bit in RTP header.

See also
See isRtpPadding() for details.
void disableRtpPadding ( )
inline

Clear padding bit in RTP header.

See also
See isRtpPadding() for details.
void enableRtpExtension ( )
inline

Set extension bit in RTP header.

See also
See isRtpExtension() for details.
void disableRtpExtension ( )
inline

Clear extension bit in RTP header.

See also
See isRtpExtension() for details.
void setRtpCSRCCount ( uint8_t  csrcCount)
inline

Set CSRC Count for this packet.

See also
See getRtpCSRCCount() for details.
void enableRtpMarker ( )
inline

Set marker bit in RTP header.

See also
See isRtpMarker() for details.
void disableRtpMarker ( )
inline

Clear marker bit in RTP header.

See also
See isRtpMarker() for details.
void setRtpPayloadType ( uint8_t  type)
inline

Set Payload Type of this packet.

See also
See getRtpPayloadType() for details.
void setRtpSequenceNumber ( RtpSeq  sequenceNumber)
inline

Set Sequence Number of this packet.

See also
See getRtpSequenceNumber() for details.
void setRtpTimestamp ( RtpTimestamp  timestamp)
inline

Set Timestamp of this packet.

See also
See getRtpTimestamp() for details.
void setRtpSSRC ( RtpSRC  ssrc)
inline

Set SSRC of this packet.

See also
See getRtpSSRC() for details.
unsigned getPayloadSize ( ) const
inline

Get current size of payload data.

RtpHeader& getRtpHeader ( )
inline

Get direct access to RtpHeader structure.

const RtpHeader& getRtpHeader ( ) const
inline

Get read-only direct access to RtpHeader structure.

RtpSRC* getRtpCSRCs ( )
inline

Get direct access to RtpHeader structure.

const RtpSRC* getRtpCSRCs ( ) const
inline

Get read-only direct access to RtpHeader structure.

uint8_t getRtpVersion ( ) const
inline

Get RTP version of this packet. Should be equal to 2.

Note
From RFC 3550: "This field identifies the version of RTP. The version defined by this specification is two (2). (The value 1 is used by the first draft version of RTP and the value 0 is used by the protocol initially implemented in the "vat" audio tool.)"
uint8_t getRtpCSRCCount ( ) const
inline

Get CSRC Count for this packet.

Note
From RFC 3550: "The CSRC count contains the number of CSRC identifiers that follow the fixed header. "
uint8_t getRtpPayloadType ( ) const
inline

Get Payload Type of this packet.

Note
From RFC 3550: "This field identifies the format of the RTP payload and determines its interpretation by the application. A profile MAY specify a default static mapping of payload type codes to payload formats. Additional payload type codes MAY be defined dynamically through non-RTP means. A set of default mappings for audio and video is specified in the companion RFC 3551. An RTP source MAY change the payload type during a session, but this field SHOULD NOT be used for multiplexing separate media streams.
A receiver MUST ignore packets with payload types that it does not understand."
SdpCodec::SdpCodecTypes getCodecId ( ) const
inline

Get the internal codec ID for this RTP packet's payload.

void setCodecId ( SdpCodec::SdpCodecTypes  codecId)
inline

Set the internal codec ID for this packet's payload.

RtpSeq getRtpSequenceNumber ( ) const
inline

Get Sequence Number of this packet.

Note
From RFC 3550: "The sequence number increments by one for each RTP data packet sent, and may be used by the receiver to detect packet loss and to restore packet sequence. The initial value of the sequence number SHOULD be random (unpredictable) to make known-plaintext attacks on encryption more difficult, even if the source itself does not encrypt, because the packets may flow through a translator that does."
RtpTimestamp getRtpTimestamp ( ) const
inline

Get Timestamp of this packet.

Note
From RFC 3550: "The timestamp reflects the sampling instant of the first octet in the RTP data packet. The sampling instant MUST be derived from a clock that increments monotonically and linearly in time to allow synchronization and jitter calculations. The resolution of the clock MUST be sufficient for the desired synchronization accuracy and for measuring packet arrival jitter (one tick per video frame is typically not sufficient)."
RtpSRC getRtpSSRC ( ) const
inline

Get SSRC of this packet.

Note
From RFC 3550: "The SSRC field identifies the synchronization source. This identifier SHOULD be chosen randomly, with the intent that no two synchronization sources within the same RTP session will have the same SSRC identifier. Although the probability of multiple sources choosing the same identifier is low, all RTP implementations must be prepared to detect and resolve collisions."
bool isRtpPadding ( ) const
inline

Check padding bit in RTP header.

Note
From RFC 3550: "If the padding bit is set, the packet contains one or more additional padding octets at the end which are not part of the payload. The last octet of the padding contains a count of how many padding octets should be ignored, including itself. Padding may be needed by some encryption algorithms with fixed block sizes or for carrying several RTP packets in a lower-layer protocol data unit. "
bool isRtpExtension ( ) const
inline

Check extension bit in RTP header.

Note
From RFC 3550: "If the extension bit is set, the fixed header MUST be followed by exactly one header extension."
bool isRtpMarker ( ) const
inline

Check marker bit in RTP header.

Note
From RFC 3550: "The interpretation of the marker is defined by a profile. It is intended to allow significant events such as frame boundaries to be marked in the packet stream. A profile MAY define additional marker bits or specify that there is no marker bit by changing the number of bits in the payload type field"
void init ( )
protected

This is called in place of constructor.

MpRtpBuf& operator= ( const MpBuf )
private

Disable assignment operator.

Buffers may be copied. But do we need this?

Friends And Related Function Documentation

friend class MpRtpBufPtr
friend

Member Data Documentation

MpBufPool * smpDefaultPool = NULL
static

Default pool for MpDataBuf objects.

RtpHeader mRtpHeader
protected

Fixed header of RTP packet. It is contained as is and functions to access its components are provided.

SdpCodec::SdpCodecTypes mInternalCodecId
protected

Internal codec ID for this packets payload ID.

RtpSRC mRtpCSRCs[RTP_MAX_CSRCS]
protected

CSRCs list of RTP packet.