vdr  2.6.9
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
cTsPayload Class Reference

#include <remux.h>

Public Member Functions

 cTsPayload (void)
 
 cTsPayload (uchar *Data, int Length, int Pid=-1)
 
void Setup (uchar *Data, int Length, int Pid=-1)
 
bool AtTsStart (void)
 
bool AtPayloadStart (void)
 
int Available (void)
 
int Used (void)
 
bool Eof (void) const
 
void Statistics (void) const
 
uchar GetByte (void)
 
bool SkipBytes (int Bytes)
 
bool SkipPesHeader (void)
 
int GetLastIndex (void)
 
void SetByte (uchar Byte, int Index)
 
bool Find (uint32_t Code)
 

Protected Member Functions

void Reset (void)
 

Private Member Functions

uchar SetEof (void)
 

Private Attributes

uchardata
 
int length
 
int pid
 
int index
 
int numPacketsPid
 
int numPacketsOther
 

Detailed Description

Definition at line 226 of file remux.h.

Constructor & Destructor Documentation

◆ cTsPayload() [1/2]

cTsPayload::cTsPayload ( void  )

Definition at line 246 of file remux.c.

References data, length, pid, and Reset().

◆ cTsPayload() [2/2]

cTsPayload::cTsPayload ( uchar Data,
int  Length,
int  Pid = -1 
)

Creates a new TS payload handler and calls Setup() with the given Data.

Definition at line 254 of file remux.c.

References Setup().

Member Function Documentation

◆ AtPayloadStart()

bool cTsPayload::AtPayloadStart ( void  )
inline

Returns true if this payload handler is currently pointing to the first byte of a TS packet that starts a new payload.

Definition at line 252 of file remux.h.

References AtTsStart(), data, index, pid, TsPayloadStart(), and TsPid().

Referenced by cMpeg2Parser::Parse(), cH264Parser::Parse(), and cH265Parser::Parse().

◆ AtTsStart()

bool cTsPayload::AtTsStart ( void  )
inline

Returns true if this payload handler is currently pointing to first byte of a TS packet.

Definition at line 249 of file remux.h.

References index, length, and TS_SIZE.

Referenced by AtPayloadStart(), and cMpeg2Parser::Parse().

◆ Available()

int cTsPayload::Available ( void  )
inline

Returns the number of raw bytes (including any TS headers) still available in the TS payload handler.

Definition at line 255 of file remux.h.

References index, and length.

◆ Eof()

bool cTsPayload::Eof ( void  ) const
inline

Returns true if all available bytes of the TS payload have been processed.

Definition at line 262 of file remux.h.

References index, and length.

Referenced by Find(), GetByte(), cMpeg2Parser::Parse(), cH264Parser::Parse(), cH265Parser::Parse(), and SkipBytes().

◆ Find()

bool cTsPayload::Find ( uint32_t  Code)

Searches for the four byte sequence given in Code and returns true if it was found within the payload data.

The next call to GetByte() will return the value immediately following the Code. If the code was not found, the read index will remain the same as before this call, so that several calls to Find() can be performed starting at the same index.. The special code 0xFFFFFFFF can not be searched, because this value is used to initialize the scanner.

Definition at line 334 of file remux.c.

References EMPTY_SCANNER, Eof(), GetByte(), index, numPacketsOther, and numPacketsPid.

Referenced by cMpeg2Fixer::FindHeader(), and cMpeg2Parser::Parse().

◆ GetByte()

uchar cTsPayload::GetByte ( void  )

◆ GetLastIndex()

int cTsPayload::GetLastIndex ( void  )

Returns the index into the TS data of the payload byte that has most recently been read.

If no byte has been read yet, -1 will be returned.

Definition at line 323 of file remux.c.

References index.

Referenced by cMpeg2Fixer::AdjGopTime(), cMpeg2Fixer::AdjTref(), cMpeg2Parser::Parse(), cMpeg2Fixer::SetBrokenLink(), and cMpeg2Fixer::SetClosedGop().

◆ Reset()

void cTsPayload::Reset ( void  )
protected

Definition at line 265 of file remux.c.

References index, numPacketsOther, and numPacketsPid.

Referenced by cTsPayload(), cMpeg2Fixer::FindHeader(), and Setup().

◆ SetByte()

void cTsPayload::SetByte ( uchar  Byte,
int  Index 
)

Sets the TS data byte at the given Index to the value Byte.

Index should be one that has been retrieved by a previous call to GetIndex(), otherwise the behaviour is undefined. The current read index will not be altered by a call to this function.

Definition at line 328 of file remux.c.

References data, and length.

Referenced by cMpeg2Fixer::AdjGopTime(), cMpeg2Fixer::AdjTref(), cMpeg2Fixer::SetBrokenLink(), and cMpeg2Fixer::SetClosedGop().

◆ SetEof()

uchar cTsPayload::SetEof ( void  )
private

Definition at line 259 of file remux.c.

References index, and length.

Referenced by GetByte().

◆ Setup()

void cTsPayload::Setup ( uchar Data,
int  Length,
int  Pid = -1 
)

Sets up this TS payload handler with the given Data, which points to a sequence of Length bytes of complete TS packets.

Any incomplete TS packet at the end will be ignored. If Pid is given, only TS packets with data for that PID will be processed. Otherwise the PID of the first TS packet defines which payload will be delivered. Any intermediate TS packets with different PIDs will be skipped.

Definition at line 272 of file remux.c.

References data, length, pid, Reset(), and TsPid().

Referenced by cMpeg2Fixer::cMpeg2Fixer(), cTsPayload(), cH264Parser::Parse(), and cH265Parser::Parse().

◆ SkipBytes()

bool cTsPayload::SkipBytes ( int  Bytes)

Skips the given number of bytes in the payload and returns true if there is still data left to read.

Definition at line 311 of file remux.c.

References Eof(), and GetByte().

Referenced by cMpeg2Fixer::SetBrokenLink(), cMpeg2Fixer::SetClosedGop(), and SkipPesHeader().

◆ SkipPesHeader()

bool cTsPayload::SkipPesHeader ( void  )

Skips all bytes belonging to the PES header of the payload.

Definition at line 318 of file remux.c.

References data, PesPayloadOffset(), SkipBytes(), and TsPayloadOffset().

Referenced by cMpeg2Parser::Parse(), cH264Parser::Parse(), and cH265Parser::Parse().

◆ Statistics()

void cTsPayload::Statistics ( void  ) const

May be called after a new frame has been detected, and will log a warning if the number of TS packets required to determine the frame type exceeded some safety limits.

Definition at line 351 of file remux.c.

References dsyslog, numPacketsOther, numPacketsPid, WRN_TS_PACKETS_FOR_FRAME_DETECTOR, and WRN_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION.

Referenced by cMpeg2Parser::Parse(), cH264Parser::Parse(), and cH265Parser::Parse().

◆ Used()

int cTsPayload::Used ( void  )
inline

Returns the number of raw bytes that have already been used (e.g.

by calling GetByte()). Any TS packet of which at least a single byte has been delivered is counted with its full size.

Definition at line 258 of file remux.h.

References index, and TS_SIZE.

Referenced by cMpeg2Parser::Parse(), cH264Parser::Parse(), and cH265Parser::Parse().

Member Data Documentation

◆ data

uchar* cTsPayload::data
private

Definition at line 228 of file remux.h.

Referenced by AtPayloadStart(), cTsPayload(), GetByte(), SetByte(), Setup(), and SkipPesHeader().

◆ index

int cTsPayload::index
private

Definition at line 231 of file remux.h.

Referenced by AtPayloadStart(), AtTsStart(), Available(), Eof(), Find(), GetByte(), GetLastIndex(), Reset(), SetEof(), and Used().

◆ length

int cTsPayload::length
private

Definition at line 229 of file remux.h.

Referenced by AtTsStart(), Available(), cTsPayload(), Eof(), GetByte(), SetByte(), SetEof(), and Setup().

◆ numPacketsOther

int cTsPayload::numPacketsOther
private

Definition at line 233 of file remux.h.

Referenced by Find(), GetByte(), Reset(), and Statistics().

◆ numPacketsPid

int cTsPayload::numPacketsPid
private

Definition at line 232 of file remux.h.

Referenced by Find(), GetByte(), Reset(), and Statistics().

◆ pid

int cTsPayload::pid
private

Definition at line 230 of file remux.h.

Referenced by AtPayloadStart(), cTsPayload(), GetByte(), and Setup().


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