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

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

#include <tsPluginRepository.h>

Collaboration diagram for ts::PluginRepository:

Classes

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

Public Types

using InputPluginFactory = InputPlugin *(*)(TSP *tsp)
 Profile of a function which creates an input plugin.
 
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...
 
using OutputPluginFactory = OutputPlugin *(*)(TSP *tsp)
 Profile of a function which creates an output plugin.
 
using ProcessorPluginFactory = ProcessorPlugin *(*)(TSP *tsp)
 Profile of a function which creates a packet processor plugin.
 

Public Member Functions

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

Static Public Member Functions

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

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

Profile of a function which creates an input plugin.

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

◆ OutputPluginFactory

Profile of a function which creates an output plugin.

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

◆ ProcessorPluginFactory

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 ( )
inlinestatic

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: