TSDuck Version 3.15-964 (TSDuck - The MPEG Transport Stream Toolkit)
ts::TSP Class Referenceabstract

TSP callback for plugins. More...

Inheritance diagram for ts::TSP:
Collaboration diagram for ts::TSP:

Public Member Functions

virtual bool aborting () const override
 Check for aborting application. More...
 
BitRate bitrate () const
 Get the current input bitrate in bits/seconds. More...
 
bool debug () const
 Check if debugging is active. More...
 
void debug (const UString &msg)
 Report a debug message. More...
 
void debug (const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report a debug message with a printf-like interface. More...
 
void debug (const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report a debug message with a printf-like interface. More...
 
void error (const UString &msg)
 Report an error message. More...
 
void error (const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report an error message with a printf-like interface. More...
 
void error (const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report an error message with a printf-like interface. More...
 
void fatal (const UString &msg)
 Report a fatal error message. More...
 
void fatal (const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report a fatal error message with a printf-like interface. More...
 
void fatal (const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report a fatal error message with a printf-like interface. More...
 
void info (const UString &msg)
 Report an informational message. More...
 
void info (const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report an informational message with a printf-like interface. More...
 
void info (const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report an informational message with a printf-like interface. More...
 
virtual void jointTerminate ()=0
 Signaling "joint termination". More...
 
virtual void log (int severity, const UString &msg)
 Report a message with an explicit severity. More...
 
virtual void log (int severity, const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report a message with an explicit severity and a printf-like interface. More...
 
virtual void log (int severity, const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report a message with an explicit severity and a printf-like interface. More...
 
int maxSeverity () const
 Get maximum severity level. More...
 
virtual void raiseMaxSeverity (int level)
 Raise maximum severity level. More...
 
bool realtime () const
 Check if the current plugin environment should use defaults for real-time. More...
 
virtual void setMaxSeverity (int level)
 Set maximum severity level. More...
 
void severe (const UString &msg)
 Report a severe error message. More...
 
void severe (const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report a severe error message with a printf-like interface. More...
 
void severe (const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report a severe error message with a printf-like interface. More...
 
virtual bool thisJointTerminated () const =0
 Check if the calling plugin has already declared "joint termination". More...
 
virtual void useJointTermination (bool on)=0
 Activates or deactivates "joint termination". More...
 
virtual bool useJointTermination () const =0
 Check if the calling plugin uses "joint termination". More...
 
bool verbose () const
 Check if verbose reporting is active. More...
 
void verbose (const UString &msg)
 Report a verbose message. More...
 
void verbose (const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report a verbose message with a printf-like interface. More...
 
void verbose (const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report a verbose message with a printf-like interface. More...
 
void warning (const UString &msg)
 Report a warning message. More...
 
void warning (const UChar *fmt, const std::initializer_list< ArgMixIn > &args)
 Report a warning message with a printf-like interface. More...
 
void warning (const UString &fmt, const std::initializer_list< ArgMixIn > &args)
 Report a warning message with a printf-like interface. More...
 

Static Public Attributes

static const int API_VERSION = 8
 Plugin API Version Number. More...
 

Protected Member Functions

 TSP (int max_severity)
 Constructor for subclasses. More...
 
virtual void writeLog (int severity, const UString &msg)=0
 Actual message reporting method. More...
 

Protected Attributes

volatile int _max_severity
 Debug level is accessible to subclasses.
 
volatile bool _tsp_aborting
 TSP is currently aborting.
 
BitRate _tsp_bitrate
 TSP input bitrate.
 
bool _use_realtime
 The plugin should use realtime defaults.
 

Detailed Description

TSP callback for plugins.

Each plugin has an associated TSP object to communicate with the Transport Stream Processor main executable.

Message output

A shared library must exclusively use the tsp object for text display and must never use std::cout, printf or alike. When called in multi-threaded context, the supplied tsp object is thread-safe and asynchronous (the methods return to the caller without waiting for the message to be printed).

"Joint termination" support

A plugin can decide to terminate tsp on its own (returning end of input, output error or ts::ProcessorPlugin::TSP_END). The termination is unconditional, regardless of the state of the other plugins.

The idea behind "joint termination" is to terminate tsp when several plugins have jointly terminated their processing.

First, a plugin must decide to use "joint termination". This is usually done in method start(), using useJointTermination (bool) when the option --joint-termination is specified on the command line.

When the plugin has completed its work, it reports this using jointTerminate().

Constructor & Destructor Documentation

◆ TSP()

ts::TSP::TSP ( int  max_severity)
protected

Constructor for subclasses.

Parameters
[in]max_severityInitial maximum severity of reported messages.

Member Function Documentation

◆ bitrate()

BitRate ts::TSP::bitrate ( ) const
inline

Get the current input bitrate in bits/seconds.

Returns
The current input bitrate in bits/seconds or zero if unknown.

◆ realtime()

bool ts::TSP::realtime ( ) const
inline

Check if the current plugin environment should use defaults for real-time.

Returns
True if the current plugin environment should use defaults for real-time.

◆ aborting()

virtual bool ts::TSP::aborting ( ) const
inlineoverridevirtual

Check for aborting application.

The plugin may invoke this method to check if the application is aborting for some reason (user interrupt for instance).

Returns
True if the tsp application is currently aborting.

Implements ts::AbortInterface.

◆ useJointTermination() [1/2]

virtual void ts::TSP::useJointTermination ( bool  on)
pure virtual

Activates or deactivates "joint termination".

This method activates or deactivates "joint termination" for the calling plugin. It should be invoked during the plugin's start().

Parameters
[in]onTrue to activate or false to deactivate joint termination.

Implemented in ts::tsswitch::InputExecutor, ts::tsswitch::OutputExecutor, and ts::tsp::JointTermination.

◆ jointTerminate()

virtual void ts::TSP::jointTerminate ( )
pure virtual

Signaling "joint termination".

This method is used by the plugin to declare that its execution is potentially terminated in the context of "joint termination". After invoking this method, any packet which is processed by the plugin may be ignored by tsp.

Implemented in ts::tsswitch::InputExecutor, ts::tsswitch::OutputExecutor, and ts::tsp::JointTermination.

◆ useJointTermination() [2/2]

virtual bool ts::TSP::useJointTermination ( ) const
pure virtual

Check if the calling plugin uses "joint termination".

Returns
True if the calling plugin uses "joint termination".

Implemented in ts::tsswitch::InputExecutor, ts::tsswitch::OutputExecutor, and ts::tsp::JointTermination.

◆ thisJointTerminated()

virtual bool ts::TSP::thisJointTerminated ( ) const
pure virtual

Check if the calling plugin has already declared "joint termination".

Returns
True if the calling plugin has already declared "joint termination".

Implemented in ts::tsswitch::InputExecutor, ts::tsswitch::OutputExecutor, and ts::tsp::JointTermination.

◆ setMaxSeverity()

virtual void ts::Report::setMaxSeverity ( int  level)
virtualinherited

Set maximum severity level.

Messages with higher severities are not reported.

Parameters
[in]levelSet report to that level.

◆ raiseMaxSeverity()

virtual void ts::Report::raiseMaxSeverity ( int  level)
virtualinherited

Raise maximum severity level.

Parameters
[in]levelSet report at least to that level.

Reimplemented in ts::Args.

◆ maxSeverity()

int ts::Report::maxSeverity ( ) const
inlineinherited

Get maximum severity level.

Returns
Current maximum debug level.

◆ debug() [1/4]

bool ts::Report::debug ( ) const
inlineinherited

Check if debugging is active.

Returns
True if current reporting level is Debug or higher.

◆ debug() [2/4]

void ts::Report::debug ( const UString msg)
inlineinherited

Report a debug message.

Parameters
[in]msgMessage text.

◆ debug() [3/4]

void ts::Report::debug ( const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a debug message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ debug() [4/4]

void ts::Report::debug ( const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a debug message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ verbose() [1/4]

bool ts::Report::verbose ( ) const
inlineinherited

Check if verbose reporting is active.

Returns
True if current reporting level is Verbose or higher.

◆ verbose() [2/4]

void ts::Report::verbose ( const UString msg)
inlineinherited

Report a verbose message.

Parameters
[in]msgMessage text.

◆ verbose() [3/4]

void ts::Report::verbose ( const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a verbose message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ verbose() [4/4]

void ts::Report::verbose ( const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a verbose message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ log() [1/3]

virtual void ts::Report::log ( int  severity,
const UString msg 
)
virtualinherited

Report a message with an explicit severity.

This method is the central reporting point. If filters the severity and drops the message if severity is higher than maxSeverity().

Subclasses should override writeLog() to implement a specific reporting device. It is not necessary to override log() unless the subclass needs to implement a different severity filtering policy.

Parameters
[in]severityMessage severity.
[in]msgMessage text.

◆ log() [2/3]

virtual void ts::Report::log ( int  severity,
const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
virtualinherited

Report a message with an explicit severity and a printf-like interface.

Parameters
[in]severityMessage severity.
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ log() [3/3]

virtual void ts::Report::log ( int  severity,
const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
virtualinherited

Report a message with an explicit severity and a printf-like interface.

Parameters
[in]severityMessage severity.
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ fatal() [1/3]

void ts::Report::fatal ( const UString msg)
inlineinherited

Report a fatal error message.

Parameters
[in]msgMessage text.

◆ fatal() [2/3]

void ts::Report::fatal ( const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a fatal error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ fatal() [3/3]

void ts::Report::fatal ( const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a fatal error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ severe() [1/3]

void ts::Report::severe ( const UString msg)
inlineinherited

Report a severe error message.

Parameters
[in]msgMessage text.

◆ severe() [2/3]

void ts::Report::severe ( const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a severe error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ severe() [3/3]

void ts::Report::severe ( const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a severe error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ error() [1/3]

void ts::Report::error ( const UString msg)
inlineinherited

Report an error message.

Parameters
[in]msgMessage text.

◆ error() [2/3]

void ts::Report::error ( const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report an error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ error() [3/3]

void ts::Report::error ( const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report an error message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ warning() [1/3]

void ts::Report::warning ( const UString msg)
inlineinherited

Report a warning message.

Parameters
[in]msgMessage text.

◆ warning() [2/3]

void ts::Report::warning ( const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a warning message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ warning() [3/3]

void ts::Report::warning ( const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report a warning message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ info() [1/3]

void ts::Report::info ( const UString msg)
inlineinherited

Report an informational message.

Parameters
[in]msgMessage text.

◆ info() [2/3]

void ts::Report::info ( const UChar fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report an informational message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ info() [3/3]

void ts::Report::info ( const UString fmt,
const std::initializer_list< ArgMixIn > &  args 
)
inlineinherited

Report an informational message with a printf-like interface.

Parameters
[in]fmtFormat string with embedded '%' sequences.
[in]argsList of arguments to substitute in the format string.
See also
UString::format()

◆ writeLog()

virtual void ts::Report::writeLog ( int  severity,
const UString msg 
)
protectedpure virtualinherited

Actual message reporting method.

Must be implemented in actual classes. The method is called only when a message passed the severity filter. It is not necessary to recheck severity inside the method.

Parameters
[in]severityMessage severity.
[in]msgMessage text.

Implemented in ts::Args, ts::Plugin, ts::AsyncReport, ts::PluginThread, ts::ReportFile< MUTEX >, ts::ReportBuffer< MUTEX >, ts::ReportWithPrefix, ts::CerrReport, and ts::NullReport.

Member Data Documentation

◆ API_VERSION

const int ts::TSP::API_VERSION = 8
static

Plugin API Version Number.

Important: Must be incremented each time the tsp plugin abstract interfaces are modified. All shared libraries shall export a global int data named tspInterfaceVersion which contains the current interface version at the time the library is built.


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