TSDuck Version 3.20-1669 (TSDuck - The MPEG Transport Stream Toolkit)
ts::ContinuityAnalyzer Class Reference

Continuity counters analysis and repair. More...

Public Member Functions

 ContinuityAnalyzer (const PIDSet &pid_filter=NoPID, Report *report=nullptr)
 Constructor. More...
 
void addPID (PID pid)
 Add one PID to process. More...
 
void addPIDs (const PIDSet &pids)
 Add several PID's to process. More...
 
PacketCounter errorCount () const
 Get the number of discontinuity errors. More...
 
bool feedPacket (const TSPacket &pkt)
 Process a constant TS packet. More...
 
bool feedPacket (TSPacket &pkt)
 Process or modify a TS packet. More...
 
uint8_t firstCC (PID pid) const
 Get the first CC in a PID. More...
 
PacketCounter fixCount () const
 Get the number of fixed (modified) TS packets. More...
 
bool hasPID (PID pid) const
 Check if a PID is processed. More...
 
uint8_t lastCC (PID pid) const
 Get the last CC in a PID. More...
 
size_t pidCount () const
 Get the current number of PID's being processed. More...
 
PacketCounter processedPackets () const
 Get the number of processed TS packets. More...
 
void removePID (PID pid)
 Remove one PID to process. More...
 
void reset ()
 Reset all collected information. More...
 
void setDisplay (bool display)
 Change error reporting. More...
 
void setFix (bool fix)
 Change error fixing. More...
 
void setGenerator (bool gen)
 Set generator mode. More...
 
void setMessagePrefix (const UString &prefix)
 Define a prefix string to be displayed with each message. More...
 
void setMessageSeverity (int level)
 Define the severity of messages. More...
 
void setPIDFilter (const PIDSet &pid_filter)
 Replace the list of PID's to process. More...
 
void setReport (Report *report)
 Change the output device to report errors. More...
 
PacketCounter totalPackets () const
 Get the total number of TS packets. More...
 

Static Public Member Functions

static int MissingPackets (int cc1, int cc2)
 Compute the number of missing packets between two continuity counters. More...
 

Detailed Description

Continuity counters analysis and repair.

Constructor & Destructor Documentation

◆ ContinuityAnalyzer()

ts::ContinuityAnalyzer::ContinuityAnalyzer ( const PIDSet pid_filter = NoPID,
Report report = nullptr 
)
explicit

Constructor.

Parameters
[in]pid_filterThe set of PID's to analyze or fix.
[in]reportWhere to report discontinuity errors. Drop errors if null.

Member Function Documentation

◆ reset()

void ts::ContinuityAnalyzer::reset ( )

Reset all collected information.

Do not change processing options (display and/or fix errors).

◆ feedPacket() [1/2]

bool ts::ContinuityAnalyzer::feedPacket ( const TSPacket pkt)
inline

Process a constant TS packet.

Can be used only to report discontinuity errors.

Parameters
[in]pktA transport stream packet.
Returns
True if the packet has no discontinuity error. False if it has an error.

◆ feedPacket() [2/2]

bool ts::ContinuityAnalyzer::feedPacket ( TSPacket pkt)
inline

Process or modify a TS packet.

Parameters
[in,out]pktA transport stream packet. It can be modified only when error fixing or generator mode is activated.
Returns
True if the packet had no discontinuity error and is unmodified. False if the packet had an error or was modified.

◆ totalPackets()

PacketCounter ts::ContinuityAnalyzer::totalPackets ( ) const
inline

Get the total number of TS packets.

Returns
The total number of TS packets.

◆ processedPackets()

PacketCounter ts::ContinuityAnalyzer::processedPackets ( ) const
inline

Get the number of processed TS packets.

Only packets from selected PID's are counted.

Returns
The number of processed TS packets.

◆ fixCount()

PacketCounter ts::ContinuityAnalyzer::fixCount ( ) const
inline

Get the number of fixed (modified) TS packets.

Returns
The number of fixed (modified) TS packets.

◆ errorCount()

PacketCounter ts::ContinuityAnalyzer::errorCount ( ) const
inline

Get the number of discontinuity errors.

Returns
The number of discontinuity errors.

◆ setReport()

void ts::ContinuityAnalyzer::setReport ( Report report)

Change the output device to report errors.

Parameters
[in]reportWhere to report discontinuity errors. Drop errors if null.

◆ setDisplay()

void ts::ContinuityAnalyzer::setDisplay ( bool  display)
inline

Change error reporting.

Parameters
[in]displayWhen true, display discontinuity errors.

◆ setFix()

void ts::ContinuityAnalyzer::setFix ( bool  fix)
inline

Change error fixing.

Parameters
[in]fixWhen true, fix discontinuity errors.

◆ setGenerator()

void ts::ContinuityAnalyzer::setGenerator ( bool  gen)
inline

Set generator mode.

When the generator mode is on, the input continuity counters are always ignored. The output continuity counters are updated to create a continuous stream. No error is reported.

Parameters
[in]genWhen true, activate generator mode.

◆ setMessageSeverity()

void ts::ContinuityAnalyzer::setMessageSeverity ( int  level)
inline

Define the severity of messages.

The default severity is Severity::Info.

Parameters
[in]levelThe severity of each message.

◆ setMessagePrefix()

void ts::ContinuityAnalyzer::setMessagePrefix ( const UString prefix)
inline

Define a prefix string to be displayed with each message.

Parameters
[in]prefixThe prefix string to be displayed with each message.

◆ setPIDFilter()

void ts::ContinuityAnalyzer::setPIDFilter ( const PIDSet pid_filter)

Replace the list of PID's to process.

Parameters
[in]pid_filterThe list of PID's to process.

◆ addPID()

void ts::ContinuityAnalyzer::addPID ( PID  pid)

Add one PID to process.

Parameters
[in]pidThe new PID to process.

◆ addPIDs()

void ts::ContinuityAnalyzer::addPIDs ( const PIDSet pids)

Add several PID's to process.

Parameters
[in]pidsThe list of new PID's to process.

◆ removePID()

void ts::ContinuityAnalyzer::removePID ( PID  pid)

Remove one PID to process.

Parameters
[in]pidThe PID to no longer process.

◆ pidCount()

size_t ts::ContinuityAnalyzer::pidCount ( ) const
inline

Get the current number of PID's being processed.

Returns
The current number of PID's being processed.

◆ hasPID()

bool ts::ContinuityAnalyzer::hasPID ( PID  pid) const

Check if a PID is processed.

Parameters
[in]pidThe PID to test.
Returns
True if pid is processed.

◆ firstCC()

uint8_t ts::ContinuityAnalyzer::firstCC ( PID  pid) const

Get the first CC in a PID.

Parameters
[in]pidThe PID to check.
Returns
The first CC value in the PID or ts::INVALID_CC when the PID is not filtered. The first CC in a PID is never modified.

◆ lastCC()

uint8_t ts::ContinuityAnalyzer::lastCC ( PID  pid) const

Get the last CC in a PID.

Parameters
[in]pidThe PID to check.
Returns
The last CC value in the PID or ts::INVALID_CC when the PID is not filtered. This is the output CC value, possibly modified.

◆ MissingPackets()

static int ts::ContinuityAnalyzer::MissingPackets ( int  cc1,
int  cc2 
)
static

Compute the number of missing packets between two continuity counters.

Parameters
[in]cc1First continuity counter.
[in]cc2Second continuity counter.
Returns
Number of missing packets between cc1 and cc2.

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