TSDuck Version 3.32-2769 (TSDuck - The MPEG Transport Stream Toolkit)
ts::PluginRepository Class Reference

A repository of TSP plugins, either statically or dynamically linked. More...

Collaboration diagram for ts::PluginRepository:

Classes

class  Register
 A class to register plugins. More...
 

Public Types

typedef InputPlugin *(* InputPluginFactory) (TSP *tsp)
 Profile of a function which creates an input plugin. More...
 
enum  ListFlags {
  LIST_INPUT = 0x0001,
  LIST_PACKET = 0x0002,
  LIST_OUTPUT = 0x0004,
  LIST_COMPACT = 0x0010,
  LIST_NAMES = 0x0020,
  LIST_ALL = LIST_INPUT | LIST_PACKET | LIST_OUTPUT
}
 Flags for listPlugins(). More...
 
typedef OutputPlugin *(* OutputPluginFactory) (TSP *tsp)
 Profile of a function which creates an output plugin. More...
 
typedef ProcessorPlugin *(* ProcessorPluginFactory) (TSP *tsp)
 Profile of a function which creates a packet processor plugin. More...
 

Public Member Functions

InputPluginFactory getInput (const UString &name, Report &report)
 Get an input plugin by name. More...
 
OutputPluginFactory getOutput (const UString &name, Report &report)
 Get an output plugin by name. More...
 
ProcessorPluginFactory getProcessor (const UString &name, Report &report)
 Get a packet processor plugin by name. More...
 
size_t inputCount () const
 Get the number of registered input plugins. More...
 
UStringList inputNames () const
 Get the names of all registered input plugins. More...
 
UString listPlugins (bool loadAll, Report &report, int flags=LIST_ALL)
 List all tsp processors. More...
 
void loadAllPlugins (Report &report)
 Load all available tsp processors. More...
 
size_t outputCount () const
 Get the number of registered output plugins. More...
 
UStringList outputNames () const
 Get the names of all registered output plugins. More...
 
size_t processorCount () const
 Get the number of registered processor plugins. More...
 
UStringList processorNames () const
 Get the names of all registered packet processor plugins. More...
 
void registerInput (const UString &name, InputPluginFactory allocator)
 Register an input plugin. More...
 
void registerOutput (const UString &name, OutputPluginFactory allocator)
 Register an output plugin. More...
 
void registerProcessor (const UString &name, ProcessorPluginFactory allocator)
 Register a packet processor plugin. More...
 
void setSharedLibraryAllowed (bool allowed)
 Allow or disallow the loading of plugins from shareable objects. More...
 

Static Public Member Functions

static PluginRepositoryInstance ()
 Get the instance of the singleton of this class. More...
 

Static Public Attributes

static const Enumeration ListProcessorEnum
 Convenient command line options for "list processor" option.
 

Detailed Description

A repository of TSP plugins, either statically or dynamically linked.

This class is a singleton. Use static Instance() method to access the single instance.

Member Typedef Documentation

◆ InputPluginFactory

typedef InputPlugin*(* ts::PluginRepository::InputPluginFactory) (TSP *tsp)

Profile of a function which creates an input plugin.

Parameters
[in]tspAssociated callback to tsp.
Returns
A new allocated object implementing ts::InputPlugin.

◆ OutputPluginFactory

typedef OutputPlugin*(* ts::PluginRepository::OutputPluginFactory) (TSP *tsp)

Profile of a function which creates an output plugin.

Parameters
[in]tspAssociated callback to tsp.
Returns
A new allocated object implementing ts::OutputPlugin.

◆ ProcessorPluginFactory

typedef ProcessorPlugin*(* ts::PluginRepository::ProcessorPluginFactory) (TSP *tsp)

Profile of a function which creates a packet processor plugin.

Parameters
[in]tspAssociated callback to tsp.
Returns
A new allocated object implementing ts::ProcessorPlugin.

Member Enumeration Documentation

◆ ListFlags

Flags for listPlugins().

Enumerator
LIST_INPUT 

List input plugins.

LIST_PACKET 

List packet processor plugins.

LIST_OUTPUT 

List output plugins.

LIST_COMPACT 

Compact output.

LIST_NAMES 

Names only.

LIST_ALL 

List all plugins.

Member Function Documentation

◆ Instance()

static PluginRepository* ts::PluginRepository::Instance ( )
static

Get the instance of the singleton of this class.

Returns
The instance of the singleton of this class.

◆ setSharedLibraryAllowed()

void ts::PluginRepository::setSharedLibraryAllowed ( bool  allowed)
inline

Allow or disallow the loading of plugins from shareable objects.

When disabled, only statically registered plugins are allowed. Loading is initially enabled by default.

Parameters
[in]allowedWhen true, dynamically loading plugins is allowed.

◆ registerInput()

void ts::PluginRepository::registerInput ( const UString name,
InputPluginFactory  allocator 
)

Register an input plugin.

Parameters
[in]namePlugin name.
[in]allocatorNew input plugin allocator function. Ignored when zero.

◆ registerProcessor()

void ts::PluginRepository::registerProcessor ( const UString name,
ProcessorPluginFactory  allocator 
)

Register a packet processor plugin.

Parameters
[in]namePlugin name.
[in]allocatorNew packet processor plugin allocator function. Ignored when zero.

◆ registerOutput()

void ts::PluginRepository::registerOutput ( const UString name,
OutputPluginFactory  allocator 
)

Register an output plugin.

Parameters
[in]namePlugin name.
[in]allocatorNew output plugin allocator function. Ignored when zero.

◆ getInput()

InputPluginFactory ts::PluginRepository::getInput ( const UString name,
Report report 
)

Get an input plugin by name.

If not found and loading shareable library is allowed, try to load it.

Parameters
[in]namePlugin name.
[in,out]reportWhere to report errors.
Returns
Plugin allocator function. Zero when not found.

◆ getProcessor()

ProcessorPluginFactory ts::PluginRepository::getProcessor ( const UString name,
Report report 
)

Get a packet processor plugin by name.

If not found and loading shareable library is allowed, try to load it.

Parameters
[in]namePlugin name.
[in,out]reportWhere to report errors.
Returns
Plugin allocator function. Zero when not found.

◆ getOutput()

OutputPluginFactory ts::PluginRepository::getOutput ( const UString name,
Report report 
)

Get an output plugin by name.

If not found and loading shareable library is allowed, try to load it.

Parameters
[in]namePlugin name.
[in,out]reportWhere to report errors.
Returns
Plugin allocator function. Zero when not found.

◆ inputCount()

size_t ts::PluginRepository::inputCount ( ) const
inline

Get the number of registered input plugins.

Returns
The number of registered input plugins.

◆ processorCount()

size_t ts::PluginRepository::processorCount ( ) const
inline

Get the number of registered processor plugins.

Returns
The number of registered processor plugins.

◆ outputCount()

size_t ts::PluginRepository::outputCount ( ) const
inline

Get the number of registered output plugins.

Returns
The number of registered output plugins.

◆ inputNames()

UStringList ts::PluginRepository::inputNames ( ) const

Get the names of all registered input plugins.

Returns
The names of all registered input plugins.

◆ processorNames()

UStringList ts::PluginRepository::processorNames ( ) const

Get the names of all registered packet processor plugins.

Returns
The names of all registered packet processor plugins.

◆ outputNames()

UStringList ts::PluginRepository::outputNames ( ) const

Get the names of all registered output plugins.

Returns
The names of all registered output plugins.

◆ loadAllPlugins()

void ts::PluginRepository::loadAllPlugins ( Report report)

Load all available tsp processors.

Does nothing when dynamic loading of plugins is disabled.

Parameters
[in,out]reportWhere to report errors.

◆ listPlugins()

UString ts::PluginRepository::listPlugins ( bool  loadAll,
Report report,
int  flags = LIST_ALL 
)

List all tsp processors.

This function is typically used to implement the tsp --list-processors option.

Parameters
[in]loadAllWhen true, all available plugins are loaded first. Ignored when dynamic loading of plugins is disabled.
[in,out]reportWhere to report errors.
[in]flagsList options, an or'ed mask of ListFlags values.
Returns
The text to display.

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