![]() |
TSDuck
v3.35-3218
MPEG Transport Stream Toolkit
|
Implementation of the input plugin switcher. More...
Public Member Functions | |
InputSwitcher (const InputSwitcherArgs &args, Report &report) | |
Full session constructor. More... | |
InputSwitcher (Report &report) | |
Constructor. More... | |
~InputSwitcher () | |
Destructor. More... | |
void | callEventHandlers (const PluginEventContext &context) const |
Invoke all event handlers for a given event. More... | |
size_t | currentInput () |
Get the index of the current input plugin. More... | |
bool | isStarted () const |
Check if the input switcher is started. More... | |
void | nextInput () |
Switch to the next input plugin. | |
void | previousInput () |
Switch to the previous input plugin. | |
void | registerEventHandler (PluginEventHandlerInterface *handler, const Criteria &criteria=Criteria()) |
Register an event handler. More... | |
Report & | report () const |
Get a reference to the report object for the input switcher. More... | |
void | setInput (size_t pluginIndex) |
Switch to another input plugin. More... | |
bool | start (const InputSwitcherArgs &args) |
Start the input switcher session. More... | |
void | stop () |
Stop the input switcher. | |
bool | success () const |
Check if the session, when completely run in the constructor, was successful. More... | |
void | unregisterEventHandler (PluginEventHandlerInterface *handler=nullptr) |
Unregister all occurences of an event handler. More... | |
void | waitForTermination () |
Suspend the calling thread until input switcher is completed. | |
Implementation of the input plugin switcher.
This class is used by the tsswitch utility. It can also be used in other applications to switch between input plugins.
ts::InputSwitcher::InputSwitcher | ( | Report & | report | ) |
Constructor.
This constructor does not start the session.
[in,out] | report | Where to report errors, logs, etc. This object will be used concurrently by all plugin execution threads. Consequently, it must be thread-safe. For performance reasons, it should be asynchronous (see for instance class AsyncReport). |
ts::InputSwitcher::~InputSwitcher | ( | ) |
Destructor.
It waits for termination of the session if it is running.
ts::InputSwitcher::InputSwitcher | ( | const InputSwitcherArgs & | args, |
Report & | report | ||
) |
Full session constructor.
The complete input switching session is performed in this constructor. The constructor returns only when the input switcher session terminates or fails tp start.
[in] | args | Arguments and options. |
[in,out] | report | Where to report errors, logs, etc. This object will be used concurrently by all plugin execution threads. Consequently, it must be thread-safe. For performance reasons, it should be asynchronous (see for instance class AsyncReport). |
|
inline |
Get a reference to the report object for the input switcher.
bool ts::InputSwitcher::start | ( | const InputSwitcherArgs & | args | ) |
Start the input switcher session.
[in] | args | Arguments and options. |
|
inline |
Check if the input switcher is started.
void ts::InputSwitcher::setInput | ( | size_t | pluginIndex | ) |
Switch to another input plugin.
[in] | pluginIndex | Index of the new input plugin. |
size_t ts::InputSwitcher::currentInput | ( | ) |
Get the index of the current input plugin.
|
inline |
Check if the session, when completely run in the constructor, was successful.
|
inherited |
Register an event handler.
Note: calling this function while executing a plugin event hander does nothing.
[in] | handler | The event handler to register. |
[in] | criteria | The criteria for which the handler is to be called. |
|
inherited |
Unregister all occurences of an event handler.
Note: calling this function while executing a plugin event hander does nothing. This is typically used in the destructor of an event handler.
[in] | handler | The event handler to unregister. When null, all events are unregistered. |
|
inherited |
Invoke all event handlers for a given event.
[in] | context | Event context. |