vdr-plugin-softhddevice-drm-gles 1.4.0
Public Member Functions | Private Attributes | List of all members
cPtsTrackingBuffer Class Reference

Buffer that tracks PTS values at specific byte positions. More...

#include <pes.h>

Public Member Functions

 cPtsTrackingBuffer (const char *identifier)
 
void Push (const uint8_t *, int, int64_t)
 Push data into the PTS tracking buffer. More...
 
void Erase (size_t)
 Erase data from the beginning of the buffer. More...
 
int64_t GetPts ()
 Get the PTS value for the current buffer position. More...
 
const uint8_t * Peek ()
 
void Reset ()
 
int GetSize ()
 
const char * GetIdentifier ()
 

Private Attributes

const char * m_identifier
 
std::map< size_t, int64_t > m_pts
 Map of buffer positions to PTS values. More...
 
std::vector< uint8_t > m_data
 Byte buffer. More...
 

Detailed Description

Buffer that tracks PTS values at specific byte positions.

Manages a byte buffer along with a map of PTS (Presentation Time Stamp) values associated with specific positions in the buffer. This is used for maintaining temporal information when reassembling fragmented streams.

Definition at line 99 of file pes.h.

Constructor & Destructor Documentation

◆ cPtsTrackingBuffer()

cPtsTrackingBuffer::cPtsTrackingBuffer ( const char *  identifier)
inline

Definition at line 101 of file pes.h.

Member Function Documentation

◆ Erase()

void cPtsTrackingBuffer::Erase ( size_t  amount)

Erase data from the beginning of the buffer.

Removes the specified number of bytes from the front of the buffer and adjusts all PTS positions accordingly. The PTS value for the new position 0 is preserved by finding the last PTS value before the erase point.

This ensures that when frames are popped from the buffer, they retain the PTS of the PES packet where the frame started, even if that PES packet has been partially consumed.

Parameters
amountNumber of bytes to erase from the beginning

Definition at line 670 of file pes.cpp.

References AV_NOPTS_VALUE, LOGFATAL, m_data, m_identifier, and m_pts.

Referenced by cReassemblyBufferAudio::FindTwoConsecutiveFramesWithSameSyncWord(), cReassemblyBuffer::PopAvPacket(), TEST_CASE(), and cReassemblyBufferAudio::TruncateBufferUntilFirstValidData().

◆ GetIdentifier()

const char * cPtsTrackingBuffer::GetIdentifier ( )
inline

Definition at line 108 of file pes.h.

References m_identifier.

◆ GetPts()

int64_t cPtsTrackingBuffer::GetPts ( )

Get the PTS value for the current buffer position.

Returns the PTS associated with position 0 in the buffer, which represents the presentation timestamp for the data at the front of the buffer.

Returns
PTS value, or AV_NOPTS_VALUE if no PTS is available

Definition at line 707 of file pes.cpp.

References AV_NOPTS_VALUE, and m_pts.

Referenced by cReassemblyBuffer::PopAvPacket(), and TEST_CASE().

◆ GetSize()

int cPtsTrackingBuffer::GetSize ( )
inline

◆ Peek()

const uint8_t * cPtsTrackingBuffer::Peek ( )
inline

◆ Push()

void cPtsTrackingBuffer::Push ( const uint8_t *  data,
int  size,
int64_t  pts 
)

Push data into the PTS tracking buffer.

Appends data to the buffer and associates the PTS with the current buffer position if a valid PTS is provided.

Parameters
dataPointer to data to append
sizeSize of data in bytes
ptsPresentation timestamp, or AV_NOPTS_VALUE if not available

Definition at line 650 of file pes.cpp.

References AV_NOPTS_VALUE, m_data, and m_pts.

Referenced by cReassemblyBuffer::Push(), and TEST_CASE().

◆ Reset()

void cPtsTrackingBuffer::Reset ( )
inline

Definition at line 106 of file pes.h.

References m_data, and m_pts.

Referenced by cReassemblyBuffer::Reset(), and TEST_CASE().

Member Data Documentation

◆ m_data

std::vector<uint8_t> cPtsTrackingBuffer::m_data
private

Byte buffer.

Definition at line 112 of file pes.h.

Referenced by Erase(), GetSize(), Peek(), Push(), and Reset().

◆ m_identifier

const char* cPtsTrackingBuffer::m_identifier
private

Definition at line 110 of file pes.h.

Referenced by Erase(), and GetIdentifier().

◆ m_pts

std::map<size_t, int64_t> cPtsTrackingBuffer::m_pts
private

Map of buffer positions to PTS values.

Definition at line 111 of file pes.h.

Referenced by Erase(), GetPts(), Push(), and Reset().


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