Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::packet::Packet Class Reference

Packet. More...

#include <packet.h>

Inheritance diagram for roc::packet::Packet:
Collaboration diagram for roc::packet::Packet:

Public Types

enum  {
  FlagUDP = (1 << 0), FlagRTP = (1 << 1), FlagFEC = (1 << 2), FlagAudio = (1 << 3),
  FlagRepair = (1 << 4), FlagComposed = (1 << 5), FlagRestored = (1 << 6)
}
 Packet flags. More...
 

Public Member Functions

 Packet (PacketPool &)
 Constructor. More...
 
void add_flags (unsigned flags)
 Add flags. More...
 
unsigned flags () const
 Get flags. More...
 
const UDPudp () const
 UDP packet. More...
 
UDPudp ()
 UDP packet. More...
 
const RTPrtp () const
 RTP packet. More...
 
RTPrtp ()
 RTP packet. More...
 
const FECfec () const
 FEC packet. More...
 
FECfec ()
 FEC packet. More...
 
const core::Slice< uint8_t > & data () const
 Get packet data. More...
 
void set_data (const core::Slice< uint8_t > &data)
 Set packet data. More...
 
source_t source () const
 Return packet stream identifier. More...
 
timestamp_t begin () const
 Get the timestamp of the first sample in packet. More...
 
timestamp_t end () const
 Get the timestamp of the last sample in packet plus one. More...
 
int compare (const Packet &other) const
 Determine packet order. More...
 
void print (int flags) const
 Print packet to stderr. More...
 
- Public Member Functions inherited from roc::core::RefCnt< Packet >
long getref () const
 Get reference counter. More...
 
void incref () const
 Increment reference counter. More...
 
void decref () const
 Decrement reference counter. More...
 
- Public Member Functions inherited from roc::core::ListNode
ListNodeDatalist_node_data () const
 Get list node data. More...
 

Static Public Member Functions

static Packetcontainer_of (UDP *udp)
 Get pointer to packet from a pointer to its UDP part. More...
 

Friends

class core::RefCnt< Packet >
 

Detailed Description

Packet.

Definition at line 35 of file packet.h.

Member Enumeration Documentation

anonymous enum

Packet flags.

Enumerator
FlagUDP 

Packet contains UDP header.

FlagRTP 

Packet contains RTP header.

FlagFEC 

Packet contains FEC header.

FlagAudio 

Packet contains audio samples.

FlagRepair 

Packet contains repair FEC symbols.

FlagComposed 

Packet is already composed.

FlagRestored 

Packet was restored using FEC decoder.

Definition at line 41 of file packet.h.

Constructor & Destructor Documentation

roc::packet::Packet::Packet ( PacketPool )
explicit

Constructor.

Member Function Documentation

void roc::packet::Packet::add_flags ( unsigned  flags)

Add flags.

timestamp_t roc::packet::Packet::begin ( ) const

Get the timestamp of the first sample in packet.

Remarks
Timestamp units depend on packet type. For some packet types, may be always zero.
int roc::packet::Packet::compare ( const Packet other) const

Determine packet order.

Returns
  • -1 if this packet precedes other packet
  • 0 if this packet has the same position as other packet
  • +1 if this packet succeeds other packet
static Packet* roc::packet::Packet::container_of ( UDP udp)
inlinestatic

Get pointer to packet from a pointer to its UDP part.

Definition at line 112 of file packet.h.

const core::Slice<uint8_t>& roc::packet::Packet::data ( ) const

Get packet data.

timestamp_t roc::packet::Packet::end ( ) const

Get the timestamp of the last sample in packet plus one.

Remarks
Timestamp units depend on packet type. For some packet types, may be always zero.
const FEC* roc::packet::Packet::fec ( ) const

FEC packet.

FEC* roc::packet::Packet::fec ( )

FEC packet.

unsigned roc::packet::Packet::flags ( ) const

Get flags.

void roc::packet::Packet::print ( int  flags) const
inline

Print packet to stderr.

Definition at line 107 of file packet.h.

const RTP* roc::packet::Packet::rtp ( ) const

RTP packet.

RTP* roc::packet::Packet::rtp ( )

RTP packet.

void roc::packet::Packet::set_data ( const core::Slice< uint8_t > &  data)

Set packet data.

source_t roc::packet::Packet::source ( ) const

Return packet stream identifier.

Remarks
The returning value depends on packet type. For some packet types, may be always zero.
const UDP* roc::packet::Packet::udp ( ) const

UDP packet.

UDP* roc::packet::Packet::udp ( )

UDP packet.


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