![]() |
TSDuck v3.46-4965
MPEG Transport Stream Toolkit
|
#include <tsTSP.h>


Public Member Functions | |
| virtual | ~TSP () override |
| virtual bool | aborting () const override |
| BitRate | bitrate () const |
| BitRateConfidence | bitrateConfidence () const |
| bool | debug () const |
| template<class... Args> | |
| void | debug (const UChar *fmt, Args &&... args) |
| void | debug (const UChar *msg) |
| template<class... Args> | |
| void | debug (const UString &fmt, Args &&... args) |
| void | debug (const UString &msg) |
| Report * | delegateReport (Report *report) |
| template<class... Args> | |
| void | error (const UChar *fmt, Args &&... args) |
| void | error (const UChar *msg) |
| template<class... Args> | |
| void | error (const UString &fmt, Args &&... args) |
| void | error (const UString &msg) |
| template<class... Args> | |
| void | fatal (const UChar *fmt, Args &&... args) |
| void | fatal (const UChar *msg) |
| template<class... Args> | |
| void | fatal (const UString &fmt, Args &&... args) |
| void | fatal (const UString &msg) |
| bool | gotErrors () const |
| template<class... Args> | |
| void | info (const UChar *fmt, Args &&... args) |
| void | info (const UChar *msg) |
| template<class... Args> | |
| void | info (const UString &fmt, Args &&... args) |
| void | info (const UString &msg) |
| virtual void | jointTerminate ()=0 |
| template<class... Args> | |
| void | log (int severity, const UChar *fmt, Args &&... args) |
| template<class... Args> | |
| void | log (int severity, const UString &fmt, Args &&... args) |
| void | log (int severity, const UString &msg) |
| int | maxSeverity () const |
| virtual Plugin * | plugin () const =0 |
| virtual size_t | pluginCount () const =0 |
| virtual size_t | pluginIndex () const =0 |
| virtual UString | pluginName () const =0 |
| PacketCounter | pluginPackets () const |
| void | raiseMaxSeverity (int level) |
| bool | realtime () const |
| UString | reportPrefix () const |
| void | resetErrors () |
| void | setMaxSeverity (int level) |
| void | setPacketTimeout (cn::milliseconds timeout) |
| void | setReportPrefix (const UString &prefix) |
| template<class... Args> | |
| void | severe (const UChar *fmt, Args &&... args) |
| void | severe (const UChar *msg) |
| template<class... Args> | |
| void | severe (const UString &fmt, Args &&... args) |
| void | severe (const UString &msg) |
| virtual void | signalPluginEvent (uint32_t event_code, Object *plugin_data=nullptr) const =0 |
| virtual bool | thisJointTerminated () const =0 |
| PacketCounter | totalPacketsInThread () const |
| virtual bool | useJointTermination () const =0 |
| virtual void | useJointTermination (bool on)=0 |
| bool | verbose () const |
| template<class... Args> | |
| void | verbose (const UChar *fmt, Args &&... args) |
| void | verbose (const UChar *msg) |
| template<class... Args> | |
| void | verbose (const UString &fmt, Args &&... args) |
| void | verbose (const UString &msg) |
| template<class... Args> | |
| void | warning (const UChar *fmt, Args &&... args) |
| void | warning (const UChar *msg) |
| template<class... Args> | |
| void | warning (const UString &fmt, Args &&... args) |
| void | warning (const UString &msg) |
Protected Member Functions | |
| TSP (int max_severity, const UString &prefix=UString(), Report *report=nullptr) | |
| void | addNonPluginPackets (size_t incr) |
| void | addPluginPackets (size_t incr) |
| void | restartPluginSession () |
| virtual void | writeLog (int severity, const UString &msg) |
Protected Attributes | |
| std::atomic_bool | _tsp_aborting = false |
| TSP is currently aborting. | |
| BitRate | _tsp_bitrate = 0 |
| TSP input bitrate. | |
| BitRateConfidence | _tsp_bitrate_confidence = BitRateConfidence::LOW |
| TSP input bitrate confidence. | |
| cn::milliseconds | _tsp_timeout = cn::milliseconds(-1) |
| Timeout when waiting for packets, infinite if negative. | |
| bool | _use_realtime = false |
| The plugin should use realtime defaults. | |
TSP callback for plugins.
Each plugin has an associated TSP object to communicate with the Transport Stream Processor main executable.
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).
A plugin can decide to terminate tsp on its own (returning end of input, output error or ts::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().
|
overridevirtual |
Virtual desctructor.
|
protected |
Constructor for subclasses.
| [in] | max_severity | Initial maximum severity of reported messages. |
| [in] | prefix | The prefix to prepend to all messages. |
| [in] | report | New report object to which messages are delegated. |
|
inline |
Get the current input bitrate in bits/seconds.
|
inline |
Get the plugin bitrate confidence.
|
pure virtual |
Access the shared library through the plugin interface.
|
pure virtual |
Get the plugin name.
|
pure virtual |
Get the plugin index in the processing chain.
|
pure virtual |
Get the number of plugins in the processing chain.
|
inline |
Get total number of packets previously processed in the plugin object. For input and output plugins, this is the number of successfully read or written packets. For processor plugins, this is the number of packets which were submitted to the plugin object (ie. excluding previously dropped packets but including packets which were dropped by the current plugin).
|
inline |
Get total number of packets in the execution of the plugin thread. This includes the number of extra stuffing or dropped packets.
|
inline |
Check if the current plugin environment should use defaults for real-time.
|
inline |
Set a timeout for the reception of packets by the current plugin. For input plugins, this is the timeout for the availability of free space in input buffer.
When the timeout is triggered, the method handlePacketTimeout() is invoked in the plugin. If the method returns true, the application continues waiting for packets. If the method returns false, the plugin is aborted.
| [in] | timeout | Maximum number of milliseconds to wait for packets in the buffer. Infinite timeout when negative. The default timeout is infinite. |
|
overridevirtual |
Check for aborting application.
The plugin may invoke this method to check if the application is aborting for some reason (user interrupt for instance).
Implements ts::AbortInterface.
|
pure virtual |
Signal a plugin event.
If the application has registered plugin events for this kind of events, they will be invoked.
| [in] | event_code | A plugin-defined 32-bit code describing the event type. There is no predefined list of event codes. Plugin should define their own codes. |
| [in] | plugin_data | Address of optional plugin-specific data. It can be a null pointer. Each plugin may defined subclasses of Object to pass specific data to application handlers which are aware of this plugin. |
|
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().
| [in] | on | True to activate or false to deactivate joint termination. |
|
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.
|
pure virtual |
Check if the calling plugin uses "joint termination".
|
pure virtual |
Check if the calling plugin has already declared "joint termination".
|
inlineprotected |
Account for more processed packets in this plugin object.
| [in] | incr | Add this number of processed packets in the plugin object. |
|
inlineprotected |
Account for more processed packets in this plugin thread, but excluded from plugin object.
| [in] | incr | Add this number of processed packets in the plugin thread. |
|
inlineprotected |
Restart accounting for plugin session. Typically invoked when the plugin is restarted.
|
inherited |
Set maximum severity level. Messages with higher severities are not reported.
| [in] | level | Set report to that level. |
|
inherited |
Raise maximum severity level. The severity can only be increased (more verbose, more debug), never decreased.
| [in] | level | Set report at least to that level. |
|
inlineinherited |
Get maximum severity level.
|
inlineinherited |
Check if errors (or worse) were reported through this object. Errors which were reported through delegated reports are ignored.
|
inlineinherited |
Reset the error indicator.
|
inlineinherited |
Set the prefix to display before each message.
| [in] | prefix | The prefix to prepend to all messages. |
|
inlineinherited |
Get the current prefix to display.
Delegate message logging to another report object.
| [in] | report | New report object to which messages are delegated. Use nullptr to remove the delegation and return to normal logging. |
|
inlineinherited |
Check if debugging is active.
|
inlineinherited |
Report a debug message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a debug message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a debug message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a debug message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Check if verbose reporting is active.
|
inlineinherited |
Report a verbose message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a verbose message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a verbose message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a verbose message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inherited |
Report a message with an explicit severity.
| [in] | severity | Message severity. |
| [in] | msg | Message line. |
|
inlineinherited |
Report a message with an explicit severity and a printf-like interface.
| [in] | severity | Message severity. |
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a message with an explicit severity and a printf-like interface.
| [in] | severity | Message severity. |
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a fatal error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a fatal error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a fatal error message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a fatal error message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a severe error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a severe error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a severe error message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a severe error message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report an error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report an error message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an error message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a warning error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a warning error message.
| [in] | msg | Message line. |
|
inlineinherited |
Report a warning message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report a warning message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an informational message.
| [in] | msg | Message line. |
|
inlineinherited |
Report an informational message.
| [in] | msg | Message line. |
|
inlineinherited |
Report an informational message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
inlineinherited |
Report an informational message with a printf-like interface.
| [in] | fmt | Format string with embedded '%' sequences. |
| [in] | args | List of arguments to substitute in the format string. |
|
protectedvirtualinherited |
Actual message reporting method. The method is called only when a message passed the severity filter. It is not necessary to recheck the maximum severity inside the method. By default, does nothing.
| [in] | severity | Message severity. |
| [in] | msg | Message text. |
Reimplemented in ts::Args, ts::CerrReport, ts::NullReport, ts::ReportBuffer< SAFETY >, ts::ReportFile< SAFETY >, and ts::TextStream.