TSDuck v3.40-3963
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::ContinuityAnalyzer Class Reference

Continuity counters analysis and repair. More...

#include <tsContinuityAnalyzer.h>

Public Member Functions

 ContinuityAnalyzer (const ContinuityAnalyzer &other)=default
 Copy constructor.
 
 ContinuityAnalyzer (const PIDSet &pid_filter=NoPID, Report *report=nullptr)
 Constructor.
 
void addPID (PID pid)
 Add one PID to process.
 
void addPIDs (const PIDSet &pids)
 Add several PID's to process.
 
size_t dupCount (PID pid) const
 Get the last duplicate packet count for a PID.
 
PacketCounter errorCount () const
 Get the number of discontinuity errors.
 
bool feedPacket (const TSPacket &pkt)
 Process a constant TS packet.
 
bool feedPacket (TSPacket &pkt)
 Process or modify a TS packet.
 
uint8_t firstCC (PID pid) const
 Get the first CC in a PID.
 
PacketCounter fixCount () const
 Get the number of fixed (modified) TS packets.
 
void getLastPacket (PID pid, TSPacket &packet) const
 Get the last transport stream packet that was passed to feedPacket() for a PID.
 
bool hasPID (PID pid) const
 Check if a PID is processed.
 
uint8_t lastCC (PID pid) const
 Get the last CC in a PID.
 
TSPacket lastPacket (PID pid) const
 Get the last transport stream packet that was passed to feedPacket() for a PID.
 
ContinuityAnalyzeroperator= (const ContinuityAnalyzer &other)=default
 Assignment operator.
 
size_t pidCount () const
 Get the current number of PID's being processed.
 
PacketCounter processedPackets () const
 Get the number of processed TS packets.
 
void removePID (PID pid)
 Remove one PID to process.
 
void reset ()
 Reset all collected information.
 
void setDisplay (bool display)
 Change error reporting.
 
void setFix (bool fix)
 Change error fixing.
 
void setGenerator (bool gen)
 Set generator mode.
 
void setJSON (bool on)
 Specify to log messages in JSON format.
 
void setMessagePrefix (const UString &prefix)
 Define a prefix string to be displayed with each message.
 
void setMessageSeverity (int level)
 Define the severity of messages.
 
void setPIDFilter (const PIDSet &pid_filter)
 Replace the list of PID's to process.
 
void setReplicateDuplicated (bool on)
 When fixing errors, specify how to handle duplicated packets.
 
void setReport (Report *report)
 Change the output device to report errors.
 
PacketCounter totalPackets () const
 Get the total number of TS packets.
 

Static Public Member Functions

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

Detailed Description

Continuity counters analysis and repair.

Constructor & Destructor Documentation

◆ ContinuityAnalyzer() [1/2]

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.

◆ ContinuityAnalyzer() [2/2]

ts::ContinuityAnalyzer::ContinuityAnalyzer ( const ContinuityAnalyzer other)
default

Copy constructor.

Parameters
[in]otherOther instance to copy.

Member Function Documentation

◆ operator=()

ContinuityAnalyzer & ts::ContinuityAnalyzer::operator= ( const ContinuityAnalyzer other)
default

Assignment operator.

Parameters
[in]otherOther instance to copy.
Returns
A reference to this instance.

◆ 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.

◆ setReplicateDuplicated()

void ts::ContinuityAnalyzer::setReplicateDuplicated ( bool  on)
inline

When fixing errors, specify how to handle duplicated packets.

Two successive packets in the same PID are considered as duplicated if they have the same continuity counter and same content (except PCR, if any).

Parameters
[in]onWhen true (the default), duplicated input packets are replicated as duplicated on output (the corresponding output packets have the same continuity counters). When false, the input packets are not considered as duplicated and the output packets have incremented countinuity counters.

◆ 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.

◆ setJSON()

void ts::ContinuityAnalyzer::setJSON ( bool  on)
inline

Specify to log messages in JSON format.

If a message prefix is set, it is logged just before the JSON structure and can be used to locate the appropriate JSON messages in a flow of logs.

Parameters
[in]onSet the JSON mode on or off.

◆ 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.

◆ dupCount()

size_t ts::ContinuityAnalyzer::dupCount ( PID  pid) const

Get the last duplicate packet count for a PID.

Parameters
[in]pidThe PID to check.
Returns
The last duplicate packet count for the PID or ts::NPOS when the PID is not filtered.

◆ lastPacket()

TSPacket ts::ContinuityAnalyzer::lastPacket ( PID  pid) const

Get the last transport stream packet that was passed to feedPacket() for a PID.

Parameters
[in]pidThe PID to check.
Returns
The last packet for the PID or ts::NullPacket when the PID is not filtered.

◆ getLastPacket()

void ts::ContinuityAnalyzer::getLastPacket ( PID  pid,
TSPacket packet 
) const

Get the last transport stream packet that was passed to feedPacket() for a PID.

Parameters
[in]pidThe PID to check.
[out]packetThe last packet for the PID or ts::NullPacket when the PID is not filtered.

◆ MissingPackets()

static size_t 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: