TSDuck v3.40-4033
MPEG Transport Stream Toolkit
|
A class to display PSI/SI tables. More...
#include <tsTablesDisplay.h>
Public Member Functions | |
TablesDisplay (DuckContext &duck) | |
Constructor. | |
virtual | ~TablesDisplay ()=default |
Virtual destructor. | |
void | defineArgs (Args &args) |
Add command line option definitions in an Args. | |
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. | |
virtual void | displayCRC32 (const Section §ion, const UString &margin=UString()) |
Display a CRC32 from a section. | |
virtual void | displayCRC32 (const Section §ion, PSIBuffer &buf, const UString &margin=UString()) |
Display a CRC32 from a section. | |
virtual void | displayDescriptor (const Descriptor &desc, DescriptorContext &context, const UString &margin=UString()) |
Display a descriptor on the output stream. | |
virtual void | displayDescriptorData (const Descriptor &desc, DescriptorContext &context, const UString &margin=UString()) |
Display the payload of a descriptor on the output stream. | |
virtual void | displayDescriptorList (const DescriptorList &list, DescriptorContext &context, const UString &margin=UString()) |
Display a list of descriptors. | |
virtual void | displayDescriptorList (const Section §ion, DescriptorContext &context, bool top_level, const void *data, size_t size, const UString &margin=UString()) |
Display a list of descriptors from a memory area. | |
virtual void | displayDescriptorList (const Section §ion, DescriptorContext &context, bool top_level, PSIBuffer &buf, const UString &margin=UString(), const UString &title=UString(), const UString &empty_text=UString(), size_t length=NPOS) |
Display a list of descriptors from a PSI buffer. | |
virtual void | displayDescriptorListWithLength (const Section §ion, DescriptorContext &context, bool top_level, PSIBuffer &buf, const UString &margin=UString(), const UString &title=UString(), const UString &empty_text=UString(), size_t length_bits=12) |
Display a list of descriptors (with its preceding length) from a PSI buffer. | |
virtual void | displayExtraData (const void *data, size_t size, const UString &margin=UString()) |
A utility method to dump extraneous bytes after expected data. | |
virtual void | displayExtraData (PSIBuffer &buf, const UString &margin=UString()) |
A utility method to dump extraneous bytes after expected data in a PSI buffer. | |
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. | |
virtual void | displayInvalidSection (const DemuxedData &data, const UString &reason=UString(), const UString &margin=UString(), CASID cas=CASID_NULL, bool no_header=false) |
Display an invalid section on the output stream. | |
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. | |
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. | |
virtual void | displaySection (const Section §ion, const UString &margin=UString(), CASID cas=CASID_NULL, bool no_header=false) |
Display a section on the output stream. | |
virtual void | displaySectionData (const Section §ion, const UString &margin=UString(), CASID cas=CASID_NULL) |
Display the payload of a section on the output stream. | |
virtual void | displayTable (const BinaryTable &table, const UString &margin=UString(), CASID cas=CASID_NULL) |
Display a table on the output stream. | |
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. | |
void | displayUnkownDescriptor (DID did, const uint8_t *payload, size_t size, const UString &margin) |
Display the content of an unknown descriptor. | |
void | displayUnkownSectionData (const ts::Section §ion, const UString &margin=UString()) |
Display the content of an unknown section. | |
void | displayVector (const UString &title, const std::vector< bool > &values, const UString &margin=UString(), bool space_first=false, size_t num_per_line=40, char true_val='1', char false_val='0') |
Display boolean values in a structured manner using the characters specified and with the specified number of items on each line. | |
void | displayVector (const UString &title, const std::vector< int8_t > &values, const UString &margin=UString(), bool space_first=true, size_t num_per_line=8) |
Display the signed 8-bit values in a structured manner with specified number of items on each line. | |
void | displayVector (const UString &title, const std::vector< uint16_t > &values, const UString &margin=UString(), bool space_first=true, size_t num_per_line=6) |
Display the 16-bit values in a structured manner with specified number of items on each line. | |
void | displayVector (const UString &title, const std::vector< uint32_t > &values, const UString &margin=UString(), bool space_first=true, size_t num_per_line=6) |
Display the 32-bit values in a structured manner with specified number of items on each line. | |
void | displayVector (const UString &title, const std::vector< uint8_t > &values, const UString &margin=UString(), bool space_first=true, size_t num_per_line=8) |
Display the 8-bit values in a structured manner with specified number of items on each line. | |
void | displayVector (const UString &title, const UStringVector &values, const UString &margin=UString(), bool space_first=true, size_t num_per_line=3) |
Display the string values in a tabular manner with specified number of items on each line. | |
DuckContext & | duck () |
Get the TSDuck execution context. | |
bool | loadArgs (DuckContext &duck, Args &args) |
Load arguments from command line. | |
virtual void | logLine (const UString &line) |
Log a line, either on redirected output or on report if output was not redirected. | |
virtual void | logSectionData (const Section §ion, const UString &header=UString(), size_t max_bytes=0, CASID cas=CASID_NULL) |
Display the payload of a section on the output stream as a one-line "log" message. | |
template<typename T > | |
std::ostream & | operator<< (const T &expression) |
Output stream operator to use a TablesDisplay instance directly as an output stream. | |
std::ostream & | operator<< (std::ostream &(*manip)(std::ostream &)) |
Output stream operator to use a TablesDisplay instance directly as an output stream. | |
std::ostream & | out () |
Get the output stream. | |
Static Public Member Functions | |
static UString | LogUnknownSectionData (const Section §ion, size_t max_bytes) |
Log the content of an unknown section. | |
A class to display PSI/SI tables.
|
inlineexplicit |
Constructor.
By default, all displays are done on std::cout
. Use redirect() to redirect the output to a file.
[in,out] | duck | TSDuck context. |
void ts::TablesDisplay::defineArgs | ( | Args & | args | ) |
Add command line option definitions in an Args.
[in,out] | args | Command line arguments to update. |
bool ts::TablesDisplay::loadArgs | ( | DuckContext & | duck, |
Args & | args | ||
) |
Load arguments from command line.
Args error indicator is set in case of incorrect arguments.
[in,out] | duck | TSDuck execution context. |
[in,out] | args | Command line arguments. |
|
inline |
Get the TSDuck execution context.
|
inline |
Get the output stream.
|
inline |
Output stream operator to use a TablesDisplay instance directly as an output stream.
T | Any type |
[in] | expression | Any expression that can by output on streams. |
|
inline |
Output stream operator to use a TablesDisplay instance directly as an output stream.
[in] | manip | An I/O manipulator such as std::endl . |
|
virtual |
Log a line, either on redirected output or on report if output was not redirected.
[in] | line | The line to log. |
|
virtual |
Display a table on the output stream.
The content of the table is interpreted according to the table id.
[in] | table | The table to display. |
[in] | margin | Left margin content. |
[in] | cas | CAS id of the table. |
|
virtual |
Display a section on the output stream.
The content of the table is interpreted according to the table id.
[in] | section | The section to display. |
[in] | margin | Left margin content. |
[in] | cas | CAS id of the table. |
[in] | no_header | If true, do not display the section header. |
|
virtual |
Display the payload of a section on the output stream.
The content of the table is interpreted according to the table id.
[in] | section | The section to display. |
[in] | margin | Left margin content. |
[in] | cas | CAS id of the table. |
|
virtual |
Display the payload of a section on the output stream as a one-line "log" message.
[in] | section | The section to display. |
[in] | header | Header string to display as prefix on the line. |
[in] | max_bytes | Maximum number of bytes to log from the section. 0 means unlimited. |
[in] | cas | CAS id of the table. |
|
virtual |
Display an invalid section on the output stream.
[in] | data | The invalid section. |
[in] | reason | Reason for invalid section. |
[in] | margin | Left margin content. |
[in] | cas | CAS id of the table. |
[in] | no_header | If true, do not display the section header. |
|
virtual |
Display a descriptor on the output stream.
[in] | desc | The descriptor to display. |
[in,out] | context | Interpretation context of the descriptor. |
[in] | margin | Left margin content. |
|
virtual |
Display the payload of a descriptor on the output stream.
[in] | desc | The descriptor to display. |
[in,out] | context | Interpretation context of the descriptor. |
[in] | margin | Left margin content. |
|
virtual |
Display a list of descriptors from a memory area.
[in] | section | Section containing the descriptor list. |
[in,out] | context | Interpretation context of the descriptors. |
[in] | top_level | If true, the descriptor list is a top-level list in the table. Upon return, the descriptor list is set as top-level list in the descriptor context. |
[in] | data | Address of the descriptor list. |
[in] | size | Size in bytes of the descriptor list. |
[in] | margin | Left margin content. |
|
virtual |
Display a list of descriptors.
[in] | list | Descriptor list. |
[in,out] | context | Interpretation context of the descriptors. |
[in] | margin | Left margin content. |
|
virtual |
Display a list of descriptors from a PSI buffer.
[in] | section | Section containing the descriptor list. |
[in,out] | context | Interpretation context of the descriptors. |
[in] | top_level | If true, the descriptor list is a top-level list in the table. Upon return, the descriptor list is set as top-level list in the descriptor context. |
[in,out] | buf | Buffer containing the descriptor list to read |
[in] | margin | Left margin content. |
[in] | title | Optional title to display as preceding line. |
[in] | empty_text | Optional text to display when the descriptor list is empty. |
[in] | length | Number of bytes to read. If NPOS is specified (the default), read the rest of the buffer. |
|
virtual |
Display a list of descriptors (with its preceding length) from a PSI buffer.
[in] | section | Section containing the descriptor list. |
[in,out] | context | Interpretation context of the descriptors. |
[in] | top_level | If true, the descriptor list is a top-level list in the table. Upon return, the descriptor list is set as top-level list in the descriptor context. |
[in,out] | buf | Buffer containing the descriptor list to read |
[in] | margin | Left margin content. |
[in] | title | Optional title to display as preceding line. |
[in] | empty_text | Optional text to display when the descriptor list is empty. |
[in] | length_bits | Number of meaningful bits in the length field. |
|
virtual |
Display an ATSC multiple_string_structure() as defined in ATSC A/65 from a PSI buffer.
[in,out] | buf | Buffer containing the structure to read |
[in] | length_bytes | Size in bytes of the leading length field (0 if there is none). |
[in] | margin | Left margin content. |
[in] | title | Optional title to display. |
|
virtual |
|
virtual |
A utility method to dump extraneous bytes after expected data.
[in] | data | Address of extra data to dump. |
[in] | size | Size of extra data to dump. |
[in] | margin | Left margin content. |
|
virtual |
A utility method to dump extraneous bytes after expected data in a PSI buffer.
[in,out] | buf | Buffer containing extra data to read. |
[in] | margin | Left margin content. |
|
virtual |
A utility method to dump private binary data in a descriptor or section.
[in] | title | Name of the private data to display. |
[in] | data | Address of data to dump. |
[in] | size | Size of data to dump. |
[in] | margin | Left margin content. |
[in] | single_line_max | Below that size, private data are displayed on one line after the title. Above that size, a multi-line hexa/ascii display is used. |
|
virtual |
A utility method to dump private binary data in a descriptor or section.
[in] | title | Name of the private data to display. |
[in,out] | buf | Buffer containing extra data to read. |
[in] | size | Size of data to dump. If larger than buffer size, display the rest of the buffer. |
[in] | margin | Left margin content. |
[in] | single_line_max | Below that size, private data are displayed on one line after the title. Above that size, a multi-line hexa/ascii display is used. |
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.
[in] | format | A 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] | buf | Buffer containing the data to read. |
[in] | size | Size of the integer data. |
[in] | margin | Left margin content. |
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.
[in] | section | The section to display. |
[in] | margin | Left margin content. |
|
static |
Log the content of an unknown section.
[in] | section | The section to log. |
[in] | max_bytes | Maximum number of bytes to log from the section. 0 means unlimited. |
void ts::TablesDisplay::displayUnkownDescriptor | ( | DID | did, |
const uint8_t * | payload, | ||
size_t | size, | ||
const UString & | margin | ||
) |
Display the content of an unknown descriptor.
[in] | did | Descriptor id. |
[in] | payload | Address of the descriptor payload. |
[in] | size | Size in bytes of the descriptor payload. |
[in] | margin | Left margin content. |
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.
[in] | data | Starting address of memory area. |
[in] | tlvStart | Starting index of TLV records after data. |
[in] | tlvSize | Size in bytes of the TLV area. |
[in] | dataOffset | Display offset of data. |
[in] | indent | Left margin size. |
[in] | innerIndent | Inner margin size. |
[in] | tlv | TLV syntax. |
void ts::TablesDisplay::displayVector | ( | const UString & | title, |
const std::vector< uint32_t > & | values, | ||
const UString & | margin = UString() , |
||
bool | space_first = true , |
||
size_t | num_per_line = 6 |
||
) |
Display the 32-bit values in a structured manner with specified number of items on each line.
[in] | title | Label that identifies the values |
[in] | values | List of values to be output in hexadecimal form |
[in] | margin | Left margin content (default: ""). |
[in] | space_first | When set, inserts a space character before the hexadecimal value (default: true) |
[in] | num_per_line | Number of values to be output on a single line (default: 6) |
void ts::TablesDisplay::displayVector | ( | const UString & | title, |
const std::vector< uint16_t > & | values, | ||
const UString & | margin = UString() , |
||
bool | space_first = true , |
||
size_t | num_per_line = 6 |
||
) |
Display the 16-bit values in a structured manner with specified number of items on each line.
[in] | title | Label that identifies the values |
[in] | values | List of values to be output in hexadecimal form |
[in] | margin | Left margin content (default: ""). |
[in] | space_first | When set, inserts a space character before the hexadecimal value (default: true) |
[in] | num_per_line | Number of values to be output on a single line (default: 6) |
void ts::TablesDisplay::displayVector | ( | const UString & | title, |
const std::vector< uint8_t > & | values, | ||
const UString & | margin = UString() , |
||
bool | space_first = true , |
||
size_t | num_per_line = 8 |
||
) |
Display the 8-bit values in a structured manner with specified number of items on each line.
[in] | title | Label that identifies the values |
[in] | values | List of values to be output in hexadecimal form |
[in] | margin | Left margin content (default: ""). |
[in] | space_first | When set, inserts a space character before the hexadecimal value (default: true) |
[in] | num_per_line | Number of values to be output on a single line (default: 8) |
void ts::TablesDisplay::displayVector | ( | const UString & | title, |
const std::vector< int8_t > & | values, | ||
const UString & | margin = UString() , |
||
bool | space_first = true , |
||
size_t | num_per_line = 8 |
||
) |
Display the signed 8-bit values in a structured manner with specified number of items on each line.
[in] | title | Label that identifies the values |
[in] | values | List of values to be output in hexadecimal form |
[in] | margin | Left margin content (default: ""). |
[in] | space_first | When set, inserts a space character before the hexadecimal value (default: true) |
[in] | num_per_line | Number of values to be output on a single line (default: 8) |
void ts::TablesDisplay::displayVector | ( | const UString & | title, |
const std::vector< bool > & | values, | ||
const UString & | margin = UString() , |
||
bool | space_first = false , |
||
size_t | num_per_line = 40 , |
||
char | true_val = '1' , |
||
char | false_val = '0' |
||
) |
Display boolean values in a structured manner using the characters specified and with the specified number of items on each line.
[in] | title | Label that identifies the values |
[in] | values | List of values to be output in hexadecimal form |
[in] | margin | Left margin content (default: ""). |
[in] | space_first | When set, inserts a space character before the hexadecimal value (default: true) |
[in] | num_per_line | Number of values to be output on a single line (default: 6) |
[in] | true_val | Character to display when the value is true (default: '1') |
[in] | false_val | Character to display when the value is false (default: '0') |
void ts::TablesDisplay::displayVector | ( | const UString & | title, |
const UStringVector & | values, | ||
const UString & | margin = UString() , |
||
bool | space_first = true , |
||
size_t | num_per_line = 3 |
||
) |
Display the string values in a tabular manner with specified number of items on each line.
[in] | title | Label that identifies the values |
[in] | values | List of values to be output in hexadecimal form |
[in] | margin | Left margin content (default: ""). |
[in] | space_first | When set, inserts a space character before the value (default: true) |
[in] | num_per_line | Number of values to be output on a single line (default: 3) |