TSDuck Version 3.32-2769 (TSDuck - The MPEG Transport Stream Toolkit)
ts::TablesDisplay Class Reference

A class to display PSI/SI tables. More...

Inheritance diagram for ts::TablesDisplay:
Collaboration diagram for ts::TablesDisplay:

Public Member Functions

 TablesDisplay (DuckContext &d)
 Constructor. More...
 
virtual ~TablesDisplay () override
 Virtual destructor.
 
virtual void defineArgs (Args &args) override
 Add command line option definitions in an Args. More...
 
virtual void displayATSCMultipleString (PSIBuffer &buf, size_t length_bytes=0, const UString &margin=UString(), const UString &title=UString())
 Display an ATSC multiple_string_structure() as defined in ATSC A/65 from a PSI buffer. More...
 
virtual void displayCRC32 (const Section &section, const UString &margin=UString())
 Display a CRC32 from a section. More...
 
virtual void displayCRC32 (const Section &section, PSIBuffer &buf, const UString &margin=UString())
 Display a CRC32 from a section. More...
 
virtual void displayDescriptor (const Descriptor &desc, const UString &margin=UString(), TID tid=TID_NULL, PDS pds=0, uint16_t cas=CASID_NULL)
 Display a descriptor on the output stream. More...
 
virtual void displayDescriptorData (DID did, const uint8_t *payload, size_t size, const UString &margin=UString(), TID tid=TID_NULL, PDS pds=0, uint16_t cas=CASID_NULL)
 Display the payload of a descriptor on the output stream. More...
 
virtual void displayDescriptorList (const DescriptorList &list, const UString &margin=UString(), uint16_t cas=CASID_NULL)
 Display a list of descriptors. More...
 
virtual void displayDescriptorList (const Section &section, const void *data, size_t size, const UString &margin=UString(), uint16_t cas=CASID_NULL)
 Display a list of descriptors from a memory area. More...
 
virtual void displayDescriptorList (const Section &section, PSIBuffer &buf, const UString &margin=UString(), const UString &title=UString(), const UString &empty_text=UString(), size_t length=NPOS, uint16_t cas=CASID_NULL)
 Display a list of descriptors from a PSI buffer. More...
 
virtual void displayDescriptorListWithLength (const Section &section, PSIBuffer &buf, const UString &margin=UString(), const UString &title=UString(), const UString &empty_text=UString(), size_t length_bits=12, uint16_t cas=CASID_NULL)
 Display a list of descriptors (with its preceding length) from a PSI buffer. More...
 
virtual void displayExtraData (const void *data, size_t size, const UString &margin=UString())
 A utility method to dump extraneous bytes after expected data. More...
 
virtual void displayExtraData (PSIBuffer &buf, const UString &margin=UString())
 A utility method to dump extraneous bytes after expected data in a PSI buffer. More...
 
void displayIntAndASCII (const UString &format, PSIBuffer &buf, size_t size, const UString &margin=UString())
 A utility method to display and integer and its optional ASCII interpretation. More...
 
virtual void displayInvalidSection (const DemuxedData &data, const UString &reason=UString(), const UString &margin=UString(), uint16_t cas=CASID_NULL, bool no_header=false)
 Display an invalid section on the output stream. More...
 
virtual void displayPrivateData (const UString &title, const void *data, size_t size, const UString &margin=UString(), size_t single_line_max=8)
 A utility method to dump private binary data in a descriptor or section. More...
 
virtual void displayPrivateData (const UString &title, PSIBuffer &buf, size_t size=NPOS, const UString &margin=UString(), size_t single_line_max=8)
 A utility method to dump private binary data in a descriptor or section. More...
 
virtual void displaySection (const Section &section, const UString &margin=UString(), uint16_t cas=CASID_NULL, bool no_header=false)
 Display a section on the output stream. More...
 
virtual void displaySectionData (const Section &section, const UString &margin=UString(), uint16_t cas=CASID_NULL)
 Display the payload of a section on the output stream. More...
 
virtual void displayTable (const BinaryTable &table, const UString &margin=UString(), uint16_t cas=CASID_NULL)
 Display a table on the output stream. More...
 
void displayTLV (const uint8_t *data, size_t tlvStart, size_t tlvSize, size_t dataOffset, size_t indent, size_t innerIndent, const TLVSyntax &tlv)
 Display a memory area containing a list of TLV records. More...
 
void displayUnkownDescriptor (DID did, const uint8_t *payload, size_t size, const UString &margin, TID tid, PDS pds)
 Display the content of an unknown descriptor. More...
 
void displayUnkownSectionData (const ts::Section &section, const UString &margin=UString())
 Display the content of an unknown section. More...
 
DuckContextduck ()
 Get the TSDuck execution context. More...
 
virtual bool loadArgs (DuckContext &duck, Args &args) override
 Load arguments from command line. More...
 
virtual void logSectionData (const Section &section, const UString &header=UString(), size_t max_bytes=0, uint16_t cas=CASID_NULL)
 Display the payload of a section on the output stream as a one-line "log" message. More...
 
template<typename T >
std::ostream & operator<< (const T &expression)
 Output stream operator to use a TablesDisplay instance directly as an output stream. More...
 
std::ostream & operator<< (std::ostream &(*manip)(std::ostream &))
 Output stream operator to use a TablesDisplay instance directly as an output stream. More...
 
std::ostream & out ()
 Get the output stream. More...
 

Static Public Member Functions

static UString LogUnknownSectionData (const Section &section, size_t max_bytes)
 Log the content of an unknown section. More...
 

Detailed Description

A class to display PSI/SI tables.

Constructor & Destructor Documentation

◆ TablesDisplay()

ts::TablesDisplay::TablesDisplay ( DuckContext d)
explicit

Constructor.

By default, all displays are done on std::cout. Use redirect() to redirect the output to a file.

Parameters
[in,out]dTSDuck context.

Member Function Documentation

◆ defineArgs()

virtual void ts::TablesDisplay::defineArgs ( Args args)
overridevirtual

Add command line option definitions in an Args.

Parameters
[in,out]argsCommand line arguments to update.

Implements ts::ArgsSupplierInterface.

◆ loadArgs()

virtual bool ts::TablesDisplay::loadArgs ( DuckContext duck,
Args args 
)
overridevirtual

Load arguments from command line.

Args error indicator is set in case of incorrect arguments.

Parameters
[in,out]duckTSDuck execution context.
[in,out]argsCommand line arguments.
Returns
True on success, false on error in argument line.

Implements ts::ArgsSupplierInterface.

◆ duck()

DuckContext& ts::TablesDisplay::duck ( )
inline

Get the TSDuck execution context.

Returns
A reference to the TSDuck execution context.

◆ out()

std::ostream& ts::TablesDisplay::out ( )
inline

Get the output stream.

Returns
A reference to the output stream.

◆ operator<<() [1/2]

template<typename T >
std::ostream& ts::TablesDisplay::operator<< ( const T &  expression)
inline

Output stream operator to use a TablesDisplay instance directly as an output stream.

Template Parameters
TAny type
Parameters
[in]expressionAny expression that can by output on streams.
Returns
A reference to the output stream.
See also
out()

◆ operator<<() [2/2]

std::ostream& ts::TablesDisplay::operator<< ( std::ostream &(*)(std::ostream &)  manip)
inline

Output stream operator to use a TablesDisplay instance directly as an output stream.

Parameters
[in]manipAn I/O manipulator such as std::endl.
Returns
A reference to the output stream.
See also
out()

◆ displayTable()

virtual void ts::TablesDisplay::displayTable ( const BinaryTable table,
const UString margin = UString(),
uint16_t  cas = CASID_NULL 
)
virtual

Display a table on the output stream.

The content of the table is interpreted according to the table id.

Parameters
[in]tableThe table to display.
[in]marginLeft margin content.
[in]casCAS id of the table.

◆ displaySection()

virtual void ts::TablesDisplay::displaySection ( const Section section,
const UString margin = UString(),
uint16_t  cas = CASID_NULL,
bool  no_header = false 
)
virtual

Display a section on the output stream.

The content of the table is interpreted according to the table id.

Parameters
[in]sectionThe section to display.
[in]marginLeft margin content.
[in]casCAS id of the table.
[in]no_headerIf true, do not display the section header.

◆ displaySectionData()

virtual void ts::TablesDisplay::displaySectionData ( const Section section,
const UString margin = UString(),
uint16_t  cas = CASID_NULL 
)
virtual

Display the payload of a section on the output stream.

The content of the table is interpreted according to the table id.

Parameters
[in]sectionThe section to display.
[in]marginLeft margin content.
[in]casCAS id of the table.

◆ logSectionData()

virtual void ts::TablesDisplay::logSectionData ( const Section section,
const UString header = UString(),
size_t  max_bytes = 0,
uint16_t  cas = CASID_NULL 
)
virtual

Display the payload of a section on the output stream as a one-line "log" message.

Parameters
[in]sectionThe section to display.
[in]headerHeader string to display as prefix on the line.
[in]max_bytesMaximum number of bytes to log from the section. 0 means unlimited.
[in]casCAS id of the table.

◆ displayInvalidSection()

virtual void ts::TablesDisplay::displayInvalidSection ( const DemuxedData data,
const UString reason = UString(),
const UString margin = UString(),
uint16_t  cas = CASID_NULL,
bool  no_header = false 
)
virtual

Display an invalid section on the output stream.

Parameters
[in]dataThe invalid section.
[in]reasonReason for invalid section.
[in]marginLeft margin content.
[in]casCAS id of the table.
[in]no_headerIf true, do not display the section header.

◆ displayDescriptor()

virtual void ts::TablesDisplay::displayDescriptor ( const Descriptor desc,
const UString margin = UString(),
TID  tid = TID_NULL,
PDS  pds = 0,
uint16_t  cas = CASID_NULL 
)
virtual

Display a descriptor on the output stream.

Parameters
[in]descThe descriptor to display.
[in]marginLeft margin content.
[in]tidTable id of table containing the descriptors. This is optional. Used by some descriptors the interpretation of which may vary depending on the table that they are in.
[in]pdsPrivate Data Specifier. Used to interpret private descriptors.
[in]casCAS id of the table.

◆ displayDescriptorData()

virtual void ts::TablesDisplay::displayDescriptorData ( DID  did,
const uint8_t *  payload,
size_t  size,
const UString margin = UString(),
TID  tid = TID_NULL,
PDS  pds = 0,
uint16_t  cas = CASID_NULL 
)
virtual

Display the payload of a descriptor on the output stream.

Parameters
[in]didDescriptor id.
[in]payloadAddress of the descriptor payload.
[in]sizeSize in bytes of the descriptor payload.
[in]marginLeft margin content.
[in]tidTable id of table containing the descriptors. This is optional. Used by some descriptors the interpretation of which may vary depending on the table that they are in.
[in]pdsPrivate Data Specifier. Used to interpret private descriptors.
[in]casCAS id of the table.

◆ displayDescriptorList() [1/3]

virtual void ts::TablesDisplay::displayDescriptorList ( const Section section,
const void *  data,
size_t  size,
const UString margin = UString(),
uint16_t  cas = CASID_NULL 
)
virtual

Display a list of descriptors from a memory area.

Parameters
[in]sectionSection containing the descriptor list.
[in]dataAddress of the descriptor list.
[in]sizeSize in bytes of the descriptor list.
[in]marginLeft margin content.
[in]casCAS id of the table.

◆ displayDescriptorList() [2/3]

virtual void ts::TablesDisplay::displayDescriptorList ( const DescriptorList list,
const UString margin = UString(),
uint16_t  cas = CASID_NULL 
)
virtual

Display a list of descriptors.

Parameters
[in]listDescriptor list.
[in]marginLeft margin content.
[in]casCAS id of the table.

◆ displayDescriptorList() [3/3]

virtual void ts::TablesDisplay::displayDescriptorList ( const Section section,
PSIBuffer buf,
const UString margin = UString(),
const UString title = UString(),
const UString empty_text = UString(),
size_t  length = NPOS,
uint16_t  cas = CASID_NULL 
)
virtual

Display a list of descriptors from a PSI buffer.

Parameters
[in]sectionSection containing the descriptor list.
[in,out]bufBuffer containing the descriptor list to read
[in]marginLeft margin content.
[in]titleOptional title to display as preceding line.
[in]empty_textOptional text to display when the descriptor list is empty.
[in]lengthNumber of bytes to read. If NPOS is specified (the default), read the rest of the buffer.
[in]casCAS id of the table.

◆ displayDescriptorListWithLength()

virtual void ts::TablesDisplay::displayDescriptorListWithLength ( const Section section,
PSIBuffer buf,
const UString margin = UString(),
const UString title = UString(),
const UString empty_text = UString(),
size_t  length_bits = 12,
uint16_t  cas = CASID_NULL 
)
virtual

Display a list of descriptors (with its preceding length) from a PSI buffer.

Parameters
[in]sectionSection containing the descriptor list.
[in,out]bufBuffer containing the descriptor list to read
[in]marginLeft margin content.
[in]titleOptional title to display as preceding line.
[in]empty_textOptional text to display when the descriptor list is empty.
[in]length_bitsNumber of meaningful bits in the length field.
[in]casCAS id of the table.

◆ displayATSCMultipleString()

virtual void ts::TablesDisplay::displayATSCMultipleString ( PSIBuffer buf,
size_t  length_bytes = 0,
const UString margin = UString(),
const UString title = UString() 
)
virtual

Display an ATSC multiple_string_structure() as defined in ATSC A/65 from a PSI buffer.

Parameters
[in,out]bufBuffer containing the structure to read
[in]length_bytesSize in bytes of the leading length field (0 if there is none).
[in]marginLeft margin content.
[in]titleOptional title to display.

◆ displayCRC32() [1/2]

virtual void ts::TablesDisplay::displayCRC32 ( const Section section,
const UString margin = UString() 
)
virtual

Display a CRC32 from a section.

Not required on section with long header since the CRC32 is validated when the section is read. Only useful on sections with short header and a CRC32 (TOT, splice_information_table).

Parameters
[in]sectionSection containing the CRC32.
[in]marginLeft margin content.

◆ displayCRC32() [2/2]

virtual void ts::TablesDisplay::displayCRC32 ( const Section section,
PSIBuffer buf,
const UString margin = UString() 
)
virtual

Display a CRC32 from a section.

Not required on section with long header since the CRC32 is validated when the section is read. Only useful on sections with short header and a CRC32 (TOT, splice_information_table).

Parameters
[in]sectionSection containing the CRC32.
[in,out]bufBuffer containing the section payload. If there are exactly 4 remaining bytes in buf, the CRC32 is displayed and the 4 bytes are skipped. Otherwise, nothing is displayed.
[in]marginLeft margin content.

◆ displayExtraData() [1/2]

virtual void ts::TablesDisplay::displayExtraData ( const void *  data,
size_t  size,
const UString margin = UString() 
)
virtual

A utility method to dump extraneous bytes after expected data.

Parameters
[in]dataAddress of extra data to dump.
[in]sizeSize of extra data to dump.
[in]marginLeft margin content.

◆ displayExtraData() [2/2]

virtual void ts::TablesDisplay::displayExtraData ( PSIBuffer buf,
const UString margin = UString() 
)
virtual

A utility method to dump extraneous bytes after expected data in a PSI buffer.

Parameters
[in,out]bufBuffer containing extra data to read.
[in]marginLeft margin content.

◆ displayPrivateData() [1/2]

virtual void ts::TablesDisplay::displayPrivateData ( const UString title,
const void *  data,
size_t  size,
const UString margin = UString(),
size_t  single_line_max = 8 
)
virtual

A utility method to dump private binary data in a descriptor or section.

Parameters
[in]titleName of the private data to display.
[in]dataAddress of data to dump.
[in]sizeSize of data to dump.
[in]marginLeft margin content.
[in]single_line_maxBelow that size, private data are displayed on one line after the title. Above that size, a multi-line hexa/ascii display is used.

◆ displayPrivateData() [2/2]

virtual void ts::TablesDisplay::displayPrivateData ( const UString title,
PSIBuffer buf,
size_t  size = NPOS,
const UString margin = UString(),
size_t  single_line_max = 8 
)
virtual

A utility method to dump private binary data in a descriptor or section.

Parameters
[in]titleName of the private data to display.
[in,out]bufBuffer containing extra data to read.
[in]sizeSize of data to dump. If larger than buffer size, display the rest of the buffer.
[in]marginLeft margin content.
[in]single_line_maxBelow that size, private data are displayed on one line after the title. Above that size, a multi-line hexa/ascii display is used.

◆ displayIntAndASCII()

void ts::TablesDisplay::displayIntAndASCII ( const UString format,
PSIBuffer buf,
size_t  size,
const UString margin = UString() 
)

A utility method to display and integer and its optional ASCII interpretation.

Parameters
[in]formatA format string for UString::Format(), including the '' sequence for the integer data. It the integer data can be interpreted as an ASCII string, the string is displayed after.
[in,out]bufBuffer containing the data to read.
[in]sizeSize of the integer data.
[in]marginLeft margin content.

◆ displayUnkownSectionData()

void ts::TablesDisplay::displayUnkownSectionData ( const ts::Section section,
const UString margin = UString() 
)

Display the content of an unknown section.

The command-line formatting options are used to analyze the content.

Parameters
[in]sectionThe section to display.
[in]marginLeft margin content.

◆ LogUnknownSectionData()

static UString ts::TablesDisplay::LogUnknownSectionData ( const Section section,
size_t  max_bytes 
)
static

Log the content of an unknown section.

Parameters
[in]sectionThe section to log.
[in]max_bytesMaximum number of bytes to log from the section. 0 means unlimited.
Returns
A one-line brief summary of the table.

◆ displayUnkownDescriptor()

void ts::TablesDisplay::displayUnkownDescriptor ( DID  did,
const uint8_t *  payload,
size_t  size,
const UString margin,
TID  tid,
PDS  pds 
)

Display the content of an unknown descriptor.

Parameters
[in]didDescriptor id.
[in]payloadAddress of the descriptor payload.
[in]sizeSize in bytes of the descriptor payload.
[in]marginLeft margin content.
[in]tidTable id of table containing the descriptors.
[in]pdsPrivate Data Specifier. Used to interpret private descriptors.

◆ displayTLV()

void ts::TablesDisplay::displayTLV ( const uint8_t *  data,
size_t  tlvStart,
size_t  tlvSize,
size_t  dataOffset,
size_t  indent,
size_t  innerIndent,
const TLVSyntax tlv 
)

Display a memory area containing a list of TLV records.

The displayed area extends from data to data + tlvStart + tlvSize.

  • From data to data + tlvStart : Raw data.
  • From data + tlvStart to data + tlvStart + tlvSize : TLV records.
Parameters
[in]dataStarting address of memory area.
[in]tlvStartStarting index of TLV records after data.
[in]tlvSizeSize in bytes of the TLV area.
[in]dataOffsetDisplay offset of data.
[in]indentLeft margin size.
[in]innerIndentInner margin size.
[in]tlvTLV syntax.

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