TSDuck Version 3.32-2820 (TSDuck - The MPEG Transport Stream Toolkit)
ts::TablesLogger Class Reference

This class logs sections and tables. More...

Inheritance diagram for ts::TablesLogger:
Collaboration diagram for ts::TablesLogger:

Public Member Functions

 TablesLogger (TablesDisplay &display)
 Constructor. More...
 
virtual ~TablesLogger () override
 Destructor.
 
void close ()
 Close all operations, flush tables if required, close files and sockets. More...
 
bool completed () const
 Check if the operation is complete. More...
 
void defineArgs (Args &args)
 Add command line option definitions in an Args. More...
 
void feedPacket (const TSPacket &pkt)
 The following method feeds the logger with a TS packet. More...
 
bool hasErrors () const
 Check if an error was found. More...
 
bool loadArgs (DuckContext &duck, Args &args)
 Load arguments from command line. More...
 
bool open ()
 Open files, start operations. More...
 
void reportDemuxErrors (Report &report, int level=Severity::Info)
 Report the demux errors (if any). More...
 
void reportDemuxErrors (std::ostream &strm)
 Report the demux errors (if any). More...
 
void setSectionHandler (SectionHandlerInterface *h)
 Set a section handler which is called for each section in addition to logging. More...
 
void setTableHandler (TableHandlerInterface *h)
 Set a table handler which is called for each complete table in addition to logging. More...
 

Static Public Member Functions

static bool AnalyzeUDPMessage (const uint8_t *data, size_t size, bool no_encapsulation, SectionPtrVector &sections, Time &timestamp)
 Static routine to analyze UDP messages as sent by the table logger (option –ip-udp). More...
 

Static Public Attributes

static constexpr size_t DEFAULT_LOG_SIZE = 8
 Default table log size. More...
 

Protected Member Functions

virtual void handleInvalidSection (SectionDemux &, const DemuxedData &) override
 This hook is invoked when an invalid section is detected. More...
 
virtual void handleSection (SectionDemux &, const Section &) override
 This hook is invoked when a complete section is available. More...
 
virtual void handleTable (SectionDemux &, const BinaryTable &) override
 This hook is invoked when a complete table is available. More...
 

Detailed Description

This class logs sections and tables.

Constructor & Destructor Documentation

◆ TablesLogger()

ts::TablesLogger::TablesLogger ( TablesDisplay display)

Constructor.

Parameters
[in,out]displayObject to display tables and sections.

Member Function Documentation

◆ defineArgs()

void ts::TablesLogger::defineArgs ( Args args)

Add command line option definitions in an Args.

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

◆ loadArgs()

bool ts::TablesLogger::loadArgs ( DuckContext duck,
Args args 
)

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.

◆ setTableHandler()

void ts::TablesLogger::setTableHandler ( TableHandlerInterface h)
inline

Set a table handler which is called for each complete table in addition to logging.

When the table handler or the section handler is not null, there is no default logging. To have the tables or sections displayed, you must explicitly specify --text-output -.

Parameters
[in]hThe new table handler.

◆ setSectionHandler()

void ts::TablesLogger::setSectionHandler ( SectionHandlerInterface h)
inline

Set a section handler which is called for each section in addition to logging.

When the table handler or the section handler is not null, there is no default logging. To have the tables or sections displayed, you must explicitly specify --text-output -.

Parameters
[in]hThe new handler.

◆ feedPacket()

void ts::TablesLogger::feedPacket ( const TSPacket pkt)

The following method feeds the logger with a TS packet.

Parameters
[in]pktA new transport stream packet.

◆ open()

bool ts::TablesLogger::open ( )

Open files, start operations.

The options must have been loaded first.

Returns
True on success, false on error.

◆ close()

void ts::TablesLogger::close ( )

Close all operations, flush tables if required, close files and sockets.

No longer accept packets. Automatically done in destructor.

◆ hasErrors()

bool ts::TablesLogger::hasErrors ( ) const
inline

Check if an error was found.

Returns
True when an error was found.

◆ completed()

bool ts::TablesLogger::completed ( ) const
inline

Check if the operation is complete.

Returns
True when the operation is complete (eg. max number of logged tables reached).

◆ reportDemuxErrors() [1/2]

void ts::TablesLogger::reportDemuxErrors ( std::ostream &  strm)

Report the demux errors (if any).

Parameters
[in,out]strmOutput text stream.

◆ reportDemuxErrors() [2/2]

void ts::TablesLogger::reportDemuxErrors ( Report report,
int  level = Severity::Info 
)

Report the demux errors (if any).

Parameters
[in,out]reportOutput Report object.
[in]levelSeverity level to report.

◆ AnalyzeUDPMessage()

static bool ts::TablesLogger::AnalyzeUDPMessage ( const uint8_t *  data,
size_t  size,
bool  no_encapsulation,
SectionPtrVector sections,
Time timestamp 
)
static

Static routine to analyze UDP messages as sent by the table logger (option –ip-udp).

Parameters
[in]dataAddress of UDP message.
[in]sizeSize in bytes of UDP message.
[in]no_encapsulationWhen true, the UDP message contains raw sections. When false, the UDP message contains a TLV structure.
[out]sectionsList of sections in the message.
[out]timestampTime of the collection of the table. Available only in TLV message. Contains Time::Epoch if not available.
Returns
True on success, false on invalid message.

◆ handleTable()

virtual void ts::TablesLogger::handleTable ( SectionDemux demux,
const BinaryTable table 
)
overrideprotectedvirtual

This hook is invoked when a complete table is available.

Tables with long sections are reported only when a new version is available.

Parameters
[in,out]demuxA reference to the section demux.
[in]tableA reference to the demultiplexed table.

Implements ts::TableHandlerInterface.

◆ handleSection()

virtual void ts::TablesLogger::handleSection ( SectionDemux demux,
const Section section 
)
overrideprotectedvirtual

This hook is invoked when a complete section is available.

Parameters
[in,out]demuxThe demux which sends the section.
[in]sectionThe new section from the demux.

Implements ts::SectionHandlerInterface.

◆ handleInvalidSection()

virtual void ts::TablesLogger::handleInvalidSection ( SectionDemux demux,
const DemuxedData data 
)
overrideprotectedvirtual

This hook is invoked when an invalid section is detected.

Parameters
[in,out]demuxThe demux which sends the section.
[in]dataThe invalid section from the demux.

Implements ts::InvalidSectionHandlerInterface.

Member Data Documentation

◆ DEFAULT_LOG_SIZE

constexpr size_t ts::TablesLogger::DEFAULT_LOG_SIZE = 8
staticconstexpr

Default table log size.

With option --log, specify how many bytes are displayed at the beginning of the table payload (the header is not displayed). The default is 8 bytes.


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