TSDuck v3.40-3963
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::PluginEventContext Class Reference

Context of a plugin event. More...

#include <tsPluginEventContext.h>

Public Member Functions

 PluginEventContext (uint32_t event_code, const UString &plugin_name, size_t plugin_index, size_t plugin_count, Plugin *plugin, Object *plugin_data=nullptr, const BitRate &bitrate=0, PacketCounter plugin_packets=0, PacketCounter total_packets=0)
 Constructor.
 
BitRate bitrate () const
 Get the plugin bitrate.
 
uint32_t eventCode () const
 Get the event code.
 
Pluginplugin () const
 Get the plugin which signalled the event.
 
size_t pluginCount () const
 Get the total number of plugins in the processing chain.
 
ObjectpluginData () const
 Get the plugin-specific data for this event.
 
size_t pluginIndex () const
 Get the plugin index in the processing chain.
 
UString pluginName () const
 Get the plugin name.
 
PacketCounter pluginPackets () const
 Get the number of packets which passed through the plugin.
 
PacketCounter totalPackets () const
 Get the total number of packets which passed through the plugin thread.
 

Detailed Description

Context of a plugin event.

Each time a plugin signals an event for the application, a PluginEventContext instance is built and passed to all registered event handlers for that event.

Constructor & Destructor Documentation

◆ PluginEventContext()

ts::PluginEventContext::PluginEventContext ( uint32_t  event_code,
const UString plugin_name,
size_t  plugin_index,
size_t  plugin_count,
Plugin plugin,
Object plugin_data = nullptr,
const BitRate bitrate = 0,
PacketCounter  plugin_packets = 0,
PacketCounter  total_packets = 0 
)

Constructor.

Parameters
[in]event_codeA plugin-defined 32-bit code describing the event type. There is no predefined list of event codes. Plugin should define their own codes based on meaningful 4-char literals in order to avoid value clashes, for instance:
static constexpr uint32_t FAIL_EVENT = 'FAIL';
[in]plugin_namePlugin name as found in the plugin registry.
[in]plugin_indexPlugin index in the chain. For tsp, plugins are numbered from 0 (the input plugin) to N-1 (the output plugin). For tsswitch, the input plugins are numbered from 0 to N-2 and the output plugin is N-1.
[in]plugin_countTotal number N of plugins in the chain.
[in]pluginAddress of the plugin instance which signalled the event. If this is an application-defined plugin which exposes more services, the event handler may try a dynamic_cast on this pointer.
[in]plugin_dataAddress of the plugin-specific data. It can be a null pointer. In the case of an application-defined plugin the application may try a dynamic_cast on this pointer to an expected type
[in]bitrateKnown bitrate in the context of the plugin at the time of the event.
[in]plugin_packetsNumber of packets which passed through the plugin at the time of the event.
[in]total_packetsTotal number of packets which passed through the plugin thread at the time of the event. It can be more than plugin_packets if some packets were not submitted to the plugin (deleted or excluded packets).

Member Function Documentation

◆ eventCode()

uint32_t ts::PluginEventContext::eventCode ( ) const
inline

Get the event code.

Returns
A plugin-defined 32-bit code describing the event type.

◆ pluginName()

UString ts::PluginEventContext::pluginName ( ) const
inline

Get the plugin name.

Returns
Plugin name as found in the plugin registry.

◆ pluginIndex()

size_t ts::PluginEventContext::pluginIndex ( ) const
inline

Get the plugin index in the processing chain.

Returns
Plugin index in the chain. For tsp, plugins are numbered from 0 (the input plugin) to N-1 (the output plugin). For tsswitch, the input plugins are numbered from 0 to N-2 and the output plugin is N-1.

◆ pluginCount()

size_t ts::PluginEventContext::pluginCount ( ) const
inline

Get the total number of plugins in the processing chain.

Returns
Total number of plugins in the chain.

◆ plugin()

Plugin * ts::PluginEventContext::plugin ( ) const
inline

Get the plugin which signalled the event.

Returns
Address of the plugin instance which signalled the event. If this is an application-defined plugin which exposes more services, the event handler may try a dynamic_cast on this pointer.

◆ pluginData()

Object * ts::PluginEventContext::pluginData ( ) const
inline

Get the plugin-specific data for this event.

Returns
Address of the plugin-specific data. It can be a null pointer. In the case of an application-defined plugin the application may try a dynamic_cast on this pointer to an expected type

◆ bitrate()

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

Get the plugin bitrate.

Returns
Known bitrate in the context of the plugin at the time of the event.

◆ pluginPackets()

PacketCounter ts::PluginEventContext::pluginPackets ( ) const
inline

Get the number of packets which passed through the plugin.

Returns
Number of packets which passed through the plugin at the time of the event.

◆ totalPackets()

PacketCounter ts::PluginEventContext::totalPackets ( ) const
inline

Get the total number of packets which passed through the plugin thread.

Returns
Total number of packets which passed through the plugin thread at the time of the event. It can be more than plugin_packets if some packets were not submitted to the plugin (deleted or excluded packets).

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