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

A subclass of TSAnalyzer with reporting capabilities. More...

#include <tsTSAnalyzerReport.h>

Inheritance diagram for ts::TSAnalyzerReport:
Collaboration diagram for ts::TSAnalyzerReport:

Public Member Functions

 TSAnalyzerReport (DuckContext &duck, const BitRate &bitrate_hint=0, BitRateConfidence bitrate_confidence=BitRateConfidence::LOW)
 Default constructor.
 
virtual ~TSAnalyzerReport () override
 Virtual destructor.
 
void feedPacket (const TSPacket &packet, const TSPacketMetadata &mdata)
 The following method feeds the analyzer with a TS packet.
 
void getGlobalPIDs (std::vector< PID > &list)
 Get the list of global PID's.
 
void getPIDs (std::vector< PID > &list)
 Get the list of all PID's.
 
void getPIDsOfService (std::vector< PID > &list, uint16_t service_id)
 Get the list of PID's for one service id.
 
void getPIDsWithPES (std::vector< PID > &list)
 Get the list of PID's carrying PES packets.
 
void getServiceIds (std::vector< uint16_t > &list)
 Get the list of service ids.
 
void getUnreferencedPIDs (std::vector< PID > &list)
 Get the list of unreferenced PID's.
 
void report (std::ostream &strm, TSAnalyzerOptions &opt, Report &rep=(ts::NullReport::Instance()))
 General reporting method, using the specified options.
 
void reportErrors (std::ostream &strm, const UString &title=UString())
 This methods displays an error report.
 
void reportJSON (TSAnalyzerOptions &opt, std::ostream &strm, const UString &title=UString(), Report &rep=(ts::NullReport::Instance()))
 This methods displays a JSON report.
 
void reportNormalized (TSAnalyzerOptions &opt, std::ostream &strm, const UString &title=UString())
 This methods displays a normalized report.
 
void reportPIDs (Grid &grid, const UString &title=UString())
 Report formatted analysis about PID's.
 
void reportServices (Grid &grid, const UString &title=UString())
 Report formatted analysis about services.
 
void reportTables (Grid &grid, const UString &title=UString())
 Report formatted analysis about tables.
 
UString reportToString (TSAnalyzerOptions &opt, Report &rep=(ts::NullReport::Instance()))
 General reporting method, using the specified options.
 
void reportTS (Grid &grid, const UString &title=UString())
 Report formatted analysis about the global transport stream.
 
void reset ()
 Reset the analysis context.
 
void setAnalysisOptions (const TSAnalyzerOptions &opt)
 Set the analysis options.
 
void setBitrateHint (const BitRate &bitrate_hint=0, BitRateConfidence bitrate_confidence=BitRateConfidence::LOW)
 Specify a "bitrate hint" for the analysis.
 
void setMaxConsecutiveSuspectCount (uint64_t count)
 Set the maximum number of consecutive suspect packets.
 
void setMinErrorCountBeforeSuspect (uint64_t count)
 Set the number of consecutive packet errors threshold.
 

Protected Types

using ETIDContextMap = std::map< ETID, ETIDContextPtr >
 Map of ETIDContext, indexed by ETID.
 
using ETIDContextPtr = std::shared_ptr< ETIDContext >
 Safe pointer to an ETIDContext (not thread-safe).
 
using PIDContextMap = std::map< PID, PIDContextPtr >
 Map of PIDContext, indexed by PID.
 
using PIDContextPtr = std::shared_ptr< PIDContext >
 Safe pointer to a PIDContext (not thread-safe).
 
using ServiceContextMap = std::map< uint16_t, ServiceContextPtr >
 Map of ServiceContext, indexed by service id.
 
using ServiceContextPtr = std::shared_ptr< ServiceContext >
 Safe pointer to a ServiceContext (not thread-safe).
 
using ServiceIdSet = std::set< uint16_t >
 Set of service ids.
 

Protected Member Functions

ETIDContextPtr getETID (const Section &section)
 Get an ETID context.
 
PIDContextPtr getPID (PID pid, const UString &description=UNREFERENCED)
 Get a PID context.
 
ServiceContextPtr getService (uint16_t service_id)
 Get a service context.
 
bool pidExists (PID pid) const
 Check if a PID context exists.
 
void recomputeStatistics ()
 Update the global statistics value if internal data were modified.
 

Protected Attributes

UString _country_code {}
 TOT country code.
 
DuckContext_duck
 TSDuck execution context.
 
cn::milliseconds _duration {}
 Total broadcast duration.
 
Time _first_local {}
 First system local time (first packet).
 
Time _first_stt {}
 First STT (ATCS) UTC time stamp.
 
Time _first_tdt {}
 First TDT UTC time stamp.
 
Time _first_tot {}
 First TOT local time stamp.
 
Time _first_utc {}
 First system UTC time (first packet).
 
BitRate _global_bitrate = 0
 Bitrate for global PID's.
 
ISDBTLayerCounter _global_isdb_layers {}
 Same as _isdb_layers for global PID's.
 
size_t _global_pid_cnt = 0
 Number of global PID's (ref but no service).
 
uint64_t _global_pkt_cnt = 0
 Number of packets in global PID's.
 
size_t _global_scr_pids = 0
 Number of scrambled global PID's.
 
uint64_t _invalid_sync = 0
 Number of packets with invalid sync byte (not 0x47).
 
Time _last_local {}
 Last system local time (recomputeStatistics).
 
Time _last_stt {}
 Last STT (ATCS) time stamp.
 
Time _last_tdt {}
 Last TDT UTC time stamp.
 
Time _last_tot {}
 Last TOT local time stamp.
 
Time _last_utc {}
 Last system UTC time (recomputeStatistics).
 
size_t _pcr_pid_cnt = 0
 Number of PID's with PCR's.
 
size_t _pid_cnt = 0
 Number of PID's (with actual packets).
 
PIDContextMap _pids {}
 Description of PIDs.
 
BitRate _psisi_bitrate = 0
 Bitrate for global PSI/SI PID's.
 
size_t _psisi_pid_cnt = 0
 Number of global PSI/SI PID's (0x00 to 0x1F).
 
uint64_t _psisi_pkt_cnt = 0
 Number of packets in global PSI/SI PID's.
 
size_t _psisi_scr_pids = 0
 Number of scrambled global PSI/SI PID's (normally zero).
 
size_t _scrambled_pid_cnt = 0
 Number of scrambled PID's.
 
uint16_t _scrambled_services_cnt = 0
 Number of scrambled services.
 
ServiceContextMap _services {}
 Description of services, map key: service id.
 
uint64_t _suspect_ignored = 0
 Number of suspect packets, ignored.
 
std::bitset< TID_MAX_tid_present {}
 Array of detected tables.
 
uint64_t _transport_errors = 0
 Number of packets with transport error.
 
BitRate _ts_bitrate = 0
 TS bitrate (either from PCR or options).
 
std::optional< uint16_t > _ts_id {}
 Transport stream id.
 
ISDBTLayerCounter _ts_isdb_layers {}
 For ISDB-T streams with 204-byte packets, map key = layer indicator (0-1) to value = number of TS packets.
 
BitRate _ts_pcr_bitrate_188 = 0
 Average TS bitrate in b/s (eval from PCR).
 
BitRate _ts_pcr_bitrate_204 = 0
 Average TS bitrate in b/s (eval from PCR).
 
uint64_t _ts_pkt_cnt = 0
 Number of TS packets.
 
BitRate _ts_user_bitrate = 0
 User-specified TS bitrate (if any).
 
BitRateConfidence _ts_user_br_confidence = BitRateConfidence::LOW
 Confidence in user-specified TS bitrate.
 
BitRate _unref_bitrate = 0
 Bitrate for unreferenced PID's.
 
ISDBTLayerCounter _unref_isdb_layers {}
 Same as _isdb_layers for unreferenced PID's.
 
size_t _unref_pid_cnt = 0
 Number of unreferenced PID's.
 
uint64_t _unref_pkt_cnt = 0
 Number of packets in unreferenced PID's.
 
size_t _unref_scr_pids = 0
 Number of scrambled unreferenced PID's.
 

Detailed Description

A subclass of TSAnalyzer with reporting capabilities.

Constructor & Destructor Documentation

◆ TSAnalyzerReport()

ts::TSAnalyzerReport::TSAnalyzerReport ( DuckContext duck,
const BitRate bitrate_hint = 0,
BitRateConfidence  bitrate_confidence = BitRateConfidence::LOW 
)
explicit

Default constructor.

Parameters
[in,out]duckTSDuck execution context. The reference is kept inside the analyzer.
[in]bitrate_hintOptional bitrate "hint" for the analysis. It is the user-specified bitrate in bits/seconds, based on 188-byte packets. The bitrate hint is optional: if specified as zero, the analysis is based on the PCR values.
[in]bitrate_confidenceConfidence level in bitrate_hint.

Member Function Documentation

◆ setAnalysisOptions()

void ts::TSAnalyzerReport::setAnalysisOptions ( const TSAnalyzerOptions opt)

Set the analysis options.

Must be set before feeding the first packet.

Parameters
[in]optAnalysis options.

◆ report()

void ts::TSAnalyzerReport::report ( std::ostream &  strm,
TSAnalyzerOptions opt,
Report rep = (ts::NullReport::Instance()) 
)

General reporting method, using the specified options.

Parameters
[in,out]strmOutput text stream.
[in,out]optAnalysis options.
[in,out]repWhere to report errors.

◆ reportToString()

UString ts::TSAnalyzerReport::reportToString ( TSAnalyzerOptions opt,
Report rep = (ts::NullReport::Instance()) 
)

General reporting method, using the specified options.

Parameters
[in,out]optAnalysis options.
[in,out]repWhere to report errors.
Returns
The analysis as a String.

◆ reportTS()

void ts::TSAnalyzerReport::reportTS ( Grid grid,
const UString title = UString() 
)

Report formatted analysis about the global transport stream.

Parameters
[in,out]gridOutput stream in a grid.
[in]titleTitle string to display.

◆ reportServices()

void ts::TSAnalyzerReport::reportServices ( Grid grid,
const UString title = UString() 
)

Report formatted analysis about services.

Parameters
[in,out]gridOutput stream in a grid.
[in]titleTitle string to display.

◆ reportPIDs()

void ts::TSAnalyzerReport::reportPIDs ( Grid grid,
const UString title = UString() 
)

Report formatted analysis about PID's.

Parameters
[in,out]gridOutput stream in a grid.
[in]titleTitle string to display.

◆ reportTables()

void ts::TSAnalyzerReport::reportTables ( Grid grid,
const UString title = UString() 
)

Report formatted analysis about tables.

Parameters
[in,out]gridOutput stream in a grid.
[in]titleTitle string to display.

◆ reportErrors()

void ts::TSAnalyzerReport::reportErrors ( std::ostream &  strm,
const UString title = UString() 
)

This methods displays an error report.

Parameters
[in,out]strmOutput text stream.
[in]titleTitle string to display.

◆ reportNormalized()

void ts::TSAnalyzerReport::reportNormalized ( TSAnalyzerOptions opt,
std::ostream &  strm,
const UString title = UString() 
)

This methods displays a normalized report.

Parameters
[in,out]optAnalysis options.
[in,out]strmOutput text stream.
[in]titleTitle string to display.

◆ reportJSON()

void ts::TSAnalyzerReport::reportJSON ( TSAnalyzerOptions opt,
std::ostream &  strm,
const UString title = UString(),
Report rep = (ts::NullReport::Instance()) 
)

This methods displays a JSON report.

Parameters
[in,out]optAnalysis options.
[in,out]strmOutput text stream.
[in]titleTitle string.
[in,out]repWhere to report errors.

◆ feedPacket()

void ts::TSAnalyzer::feedPacket ( const TSPacket packet,
const TSPacketMetadata mdata 
)
inherited

The following method feeds the analyzer with a TS packet.

The stream is analyzed by repeatedly calling feedPacket().

Parameters
[in]packetOne TS packet from the stream.
[in]mdataAssociated metadata.

◆ setBitrateHint()

void ts::TSAnalyzer::setBitrateHint ( const BitRate bitrate_hint = 0,
BitRateConfidence  bitrate_confidence = BitRateConfidence::LOW 
)
inherited

Specify a "bitrate hint" for the analysis.

Parameters
[in]bitrate_hintOptional bitrate "hint" for the analysis. It is the user-specified bitrate in bits/seconds, based on 188-byte packets. The bitrate hint is optional: if specified as zero, the analysis is based on the PCR values.
[in]bitrate_confidenceConfidence level in bitrate_hint.

◆ setMinErrorCountBeforeSuspect()

void ts::TSAnalyzer::setMinErrorCountBeforeSuspect ( uint64_t  count)
inlineinherited

Set the number of consecutive packet errors threshold.

Parameters
[in]countThe number of consecutive packet errors after which a packet is considered as suspect if it does not belong to a previously known PID. If set to zero, suspect packet detection is disabled. Initially set to the default value 1.

◆ setMaxConsecutiveSuspectCount()

void ts::TSAnalyzer::setMaxConsecutiveSuspectCount ( uint64_t  count)
inlineinherited

Set the maximum number of consecutive suspect packets.

Parameters
[in]countWhen that number of consecutive suspect packets is reached, the next packet will not be considered for suspect detection. Initially set to the default value 1.

◆ getServiceIds()

void ts::TSAnalyzer::getServiceIds ( std::vector< uint16_t > &  list)
inherited

Get the list of service ids.

Parameters
[out]listThe returned list of service ids.

◆ getPIDs()

void ts::TSAnalyzer::getPIDs ( std::vector< PID > &  list)
inherited

Get the list of all PID's.

Parameters
[out]listThe returned list of all PID's.

◆ getGlobalPIDs()

void ts::TSAnalyzer::getGlobalPIDs ( std::vector< PID > &  list)
inherited

Get the list of global PID's.

Global PID's are PID's which do not belong to a service.

Parameters
[out]listThe returned list of global PID's.

◆ getUnreferencedPIDs()

void ts::TSAnalyzer::getUnreferencedPIDs ( std::vector< PID > &  list)
inherited

Get the list of unreferenced PID's.

Parameters
[out]listThe returned list of unreferenced PID's.

◆ getPIDsOfService()

void ts::TSAnalyzer::getPIDsOfService ( std::vector< PID > &  list,
uint16_t  service_id 
)
inherited

Get the list of PID's for one service id.

Parameters
[out]listThe returned list of PID's.
[in]service_idThe service id.

◆ getPIDsWithPES()

void ts::TSAnalyzer::getPIDsWithPES ( std::vector< PID > &  list)
inherited

Get the list of PID's carrying PES packets.

Parameters
[out]listThe returned list of PID's carrying PES packets.

◆ getService()

ServiceContextPtr ts::TSAnalyzer::getService ( uint16_t  service_id)
protectedinherited

Get a service context.

Allocate a new entry if service is not found.

Parameters
[in]service_idService to search.
Returns
A safe pointer to the service context.

◆ getETID()

ETIDContextPtr ts::TSAnalyzer::getETID ( const Section section)
protectedinherited

Get an ETID context.

Allocate a new entry if the ETID is not found.

Parameters
[in]sectionA section containing the ETID to search.
Returns
A safe pointer to the ETID context.

◆ pidExists()

bool ts::TSAnalyzer::pidExists ( PID  pid) const
protectedinherited

Check if a PID context exists.

Parameters
[in]pidPID to search.
Returns
True if the PID exists, false otherwise.

◆ getPID()

PIDContextPtr ts::TSAnalyzer::getPID ( PID  pid,
const UString description = UNREFERENCED 
)
protectedinherited

Get a PID context.

Allocate a new entry if PID not found.

Parameters
[in]pidPID to search.
[in]descriptionInitial description of the PID if the context is created.
Returns
A safe pointer to the PID context.

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