live
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes
OutPacketBuffer Class Reference

#include <MediaSink.hh>

Public Member Functions

 OutPacketBuffer (unsigned preferredPacketSize, unsigned maxPacketSize, unsigned maxBufferSize=0)
 
 ~OutPacketBuffer ()
 
unsigned char * curPtr () const
 
unsigned totalBytesAvailable () const
 
unsigned totalBufferSize () const
 
unsigned char * packet () const
 
unsigned curPacketSize () const
 
void increment (unsigned numBytes)
 
void enqueue (unsigned char const *from, unsigned numBytes)
 
void enqueueWord (u_int32_t word)
 
void insert (unsigned char const *from, unsigned numBytes, unsigned toPosition)
 
void insertWord (u_int32_t word, unsigned toPosition)
 
void extract (unsigned char *to, unsigned numBytes, unsigned fromPosition)
 
u_int32_t extractWord (unsigned fromPosition)
 
void skipBytes (unsigned numBytes)
 
Boolean isPreferredSize () const
 
Boolean wouldOverflow (unsigned numBytes) const
 
unsigned numOverflowBytes (unsigned numBytes) const
 
Boolean isTooBigForAPacket (unsigned numBytes) const
 
void setOverflowData (unsigned overflowDataOffset, unsigned overflowDataSize, struct timeval const &presentationTime, unsigned durationInMicroseconds)
 
unsigned overflowDataSize () const
 
struct timeval overflowPresentationTime () const
 
unsigned overflowDurationInMicroseconds () const
 
Boolean haveOverflowData () const
 
void useOverflowData ()
 
void adjustPacketStart (unsigned numBytes)
 
void resetPacketStart ()
 
void resetOffset ()
 
void resetOverflowData ()
 

Static Public Member Functions

static void increaseMaxSizeTo (unsigned newMaxSize)
 

Static Public Attributes

static unsigned maxSize
 

Private Attributes

unsigned fPacketStart
 
unsigned fCurOffset
 
unsigned fPreferred
 
unsigned fMax
 
unsigned fLimit
 
unsigned char * fBuf
 
unsigned fOverflowDataOffset
 
unsigned fOverflowDataSize
 
struct timeval fOverflowPresentationTime
 
unsigned fOverflowDurationInMicroseconds
 

Detailed Description

Definition at line 71 of file MediaSink.hh.

Constructor & Destructor Documentation

◆ OutPacketBuffer()

OutPacketBuffer::OutPacketBuffer ( unsigned  preferredPacketSize,
unsigned  maxPacketSize,
unsigned  maxBufferSize = 0 
)

◆ ~OutPacketBuffer()

OutPacketBuffer::~OutPacketBuffer ( )

Member Function Documentation

◆ adjustPacketStart()

void OutPacketBuffer::adjustPacketStart ( unsigned  numBytes)

◆ curPacketSize()

unsigned OutPacketBuffer::curPacketSize ( ) const
inline

Definition at line 87 of file MediaSink.hh.

87{return fCurOffset;}
unsigned fCurOffset
Definition: MediaSink.hh:127

References fCurOffset.

◆ curPtr()

unsigned char * OutPacketBuffer::curPtr ( ) const
inline

Definition at line 81 of file MediaSink.hh.

81{return &fBuf[fPacketStart + fCurOffset];}
unsigned fPacketStart
Definition: MediaSink.hh:127
unsigned char * fBuf
Definition: MediaSink.hh:128

References fBuf, fCurOffset, and fPacketStart.

◆ enqueue()

void OutPacketBuffer::enqueue ( unsigned char const *  from,
unsigned  numBytes 
)

◆ enqueueWord()

void OutPacketBuffer::enqueueWord ( u_int32_t  word)

◆ extract()

void OutPacketBuffer::extract ( unsigned char *  to,
unsigned  numBytes,
unsigned  fromPosition 
)

◆ extractWord()

u_int32_t OutPacketBuffer::extractWord ( unsigned  fromPosition)

◆ haveOverflowData()

Boolean OutPacketBuffer::haveOverflowData ( ) const
inline

Definition at line 118 of file MediaSink.hh.

118{return fOverflowDataSize > 0;}
unsigned fOverflowDataSize
Definition: MediaSink.hh:130

References fOverflowDataSize.

◆ increaseMaxSizeTo()

static void OutPacketBuffer::increaseMaxSizeTo ( unsigned  newMaxSize)
inlinestatic

Definition at line 79 of file MediaSink.hh.

79{ if (newMaxSize > OutPacketBuffer::maxSize) OutPacketBuffer::maxSize = newMaxSize; }
static unsigned maxSize
Definition: MediaSink.hh:78

References maxSize.

◆ increment()

void OutPacketBuffer::increment ( unsigned  numBytes)
inline

Definition at line 89 of file MediaSink.hh.

89{fCurOffset += numBytes;}

References fCurOffset.

◆ insert()

void OutPacketBuffer::insert ( unsigned char const *  from,
unsigned  numBytes,
unsigned  toPosition 
)

◆ insertWord()

void OutPacketBuffer::insertWord ( u_int32_t  word,
unsigned  toPosition 
)

◆ isPreferredSize()

Boolean OutPacketBuffer::isPreferredSize ( ) const
inline

Definition at line 100 of file MediaSink.hh.

100{return fCurOffset >= fPreferred;}
unsigned fPreferred
Definition: MediaSink.hh:127

References fCurOffset, and fPreferred.

◆ isTooBigForAPacket()

Boolean OutPacketBuffer::isTooBigForAPacket ( unsigned  numBytes) const
inline

Definition at line 107 of file MediaSink.hh.

107 {
108 return numBytes > fMax;
109 }
unsigned fMax
Definition: MediaSink.hh:127

References fMax.

◆ numOverflowBytes()

unsigned OutPacketBuffer::numOverflowBytes ( unsigned  numBytes) const
inline

Definition at line 104 of file MediaSink.hh.

104 {
105 return (fCurOffset+numBytes) - fMax;
106 }

References fCurOffset, and fMax.

◆ overflowDataSize()

unsigned OutPacketBuffer::overflowDataSize ( ) const
inline

Definition at line 115 of file MediaSink.hh.

115{return fOverflowDataSize;}

References fOverflowDataSize.

◆ overflowDurationInMicroseconds()

unsigned OutPacketBuffer::overflowDurationInMicroseconds ( ) const
inline

Definition at line 117 of file MediaSink.hh.

unsigned fOverflowDurationInMicroseconds
Definition: MediaSink.hh:132

References fOverflowDurationInMicroseconds.

◆ overflowPresentationTime()

struct timeval OutPacketBuffer::overflowPresentationTime ( ) const
inline

Definition at line 116 of file MediaSink.hh.

struct timeval fOverflowPresentationTime
Definition: MediaSink.hh:131

◆ packet()

unsigned char * OutPacketBuffer::packet ( ) const
inline

Definition at line 86 of file MediaSink.hh.

86{return &fBuf[fPacketStart];}

References fBuf, and fPacketStart.

◆ resetOffset()

void OutPacketBuffer::resetOffset ( )
inline

Definition at line 123 of file MediaSink.hh.

123{ fCurOffset = 0; }

References fCurOffset.

◆ resetOverflowData()

void OutPacketBuffer::resetOverflowData ( )
inline

Definition at line 124 of file MediaSink.hh.

References fOverflowDataOffset, and fOverflowDataSize.

◆ resetPacketStart()

void OutPacketBuffer::resetPacketStart ( )

◆ setOverflowData()

void OutPacketBuffer::setOverflowData ( unsigned  overflowDataOffset,
unsigned  overflowDataSize,
struct timeval const &  presentationTime,
unsigned  durationInMicroseconds 
)

◆ skipBytes()

void OutPacketBuffer::skipBytes ( unsigned  numBytes)

◆ totalBufferSize()

unsigned OutPacketBuffer::totalBufferSize ( ) const
inline

Definition at line 85 of file MediaSink.hh.

85{ return fLimit; }
unsigned fLimit
Definition: MediaSink.hh:127

References fLimit.

◆ totalBytesAvailable()

unsigned OutPacketBuffer::totalBytesAvailable ( ) const
inline

Definition at line 82 of file MediaSink.hh.

82 {
83 return fLimit - (fPacketStart + fCurOffset);
84 }

References fCurOffset, fLimit, and fPacketStart.

◆ useOverflowData()

void OutPacketBuffer::useOverflowData ( )

◆ wouldOverflow()

Boolean OutPacketBuffer::wouldOverflow ( unsigned  numBytes) const
inline

Definition at line 101 of file MediaSink.hh.

101 {
102 return (fCurOffset+numBytes) > fMax;
103 }

References fCurOffset, and fMax.

Field Documentation

◆ fBuf

unsigned char* OutPacketBuffer::fBuf
private

Definition at line 128 of file MediaSink.hh.

Referenced by curPtr(), and packet().

◆ fCurOffset

unsigned OutPacketBuffer::fCurOffset
private

◆ fLimit

unsigned OutPacketBuffer::fLimit
private

Definition at line 127 of file MediaSink.hh.

Referenced by totalBufferSize(), and totalBytesAvailable().

◆ fMax

unsigned OutPacketBuffer::fMax
private

Definition at line 127 of file MediaSink.hh.

Referenced by isTooBigForAPacket(), numOverflowBytes(), and wouldOverflow().

◆ fOverflowDataOffset

unsigned OutPacketBuffer::fOverflowDataOffset
private

Definition at line 130 of file MediaSink.hh.

Referenced by resetOverflowData().

◆ fOverflowDataSize

unsigned OutPacketBuffer::fOverflowDataSize
private

Definition at line 130 of file MediaSink.hh.

Referenced by haveOverflowData(), overflowDataSize(), and resetOverflowData().

◆ fOverflowDurationInMicroseconds

unsigned OutPacketBuffer::fOverflowDurationInMicroseconds
private

Definition at line 132 of file MediaSink.hh.

Referenced by overflowDurationInMicroseconds().

◆ fOverflowPresentationTime

struct timeval OutPacketBuffer::fOverflowPresentationTime
private

Definition at line 131 of file MediaSink.hh.

◆ fPacketStart

unsigned OutPacketBuffer::fPacketStart
private

Definition at line 127 of file MediaSink.hh.

Referenced by curPtr(), packet(), and totalBytesAvailable().

◆ fPreferred

unsigned OutPacketBuffer::fPreferred
private

Definition at line 127 of file MediaSink.hh.

Referenced by isPreferredSize().

◆ maxSize

unsigned OutPacketBuffer::maxSize
static

Definition at line 78 of file MediaSink.hh.

Referenced by increaseMaxSizeTo().


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