TSDuck v3.46-4965
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::InputSwitcher Class Reference

#include <tsInputSwitcher.h>

Inheritance diagram for ts::InputSwitcher:
Collaboration diagram for ts::InputSwitcher:

Public Member Functions

 InputSwitcher (const InputSwitcherArgs &args, Report &report)
 InputSwitcher (Report &report)
 ~InputSwitcher ()
size_t currentInput ()
 delete (self)
 Explicitly free the underlying C++ object.
bool isStarted () const
void nextInput ()
void previousInput ()
 registerEventHandler (self, handler, event_code)
 Register an event handler by event code.
 registerInputEventHandler (self, handler)
 Register an event handler for all events from the input plugin.
 registerOutputEventHandler (self, handler)
 Register an event handler for all events from the output plugin.
Report & report () const
void setInput (size_t pluginIndex)
bool start (const InputSwitcherArgs &args)
void stop ()
bool success () const
void waitForTermination ()

Protected Member Functions

 _getNative (self)
 Get the native object.
 _setNative (self, obj)
 Set the native object.

Detailed Description

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.

Constructor & Destructor Documentation

◆ InputSwitcher() [1/2]

ts::InputSwitcher::InputSwitcher ( Report & report)

Constructor. This constructor does not start the session.

Parameters
[in,out]reportWhere 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).

◆ ~InputSwitcher()

ts::InputSwitcher::~InputSwitcher ( )

Destructor. It waits for termination of the session if it is running.

◆ InputSwitcher() [2/2]

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.

Parameters
[in]argsArguments and options.
[in,out]reportWhere 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).

Member Function Documentation

◆ report()

Report & ts::InputSwitcher::report ( ) const
inline

Get a reference to the report object for the input switcher.

Returns
A reference to the report object for the input switcher.

◆ start()

bool ts::InputSwitcher::start ( const InputSwitcherArgs & args)

Start the input switcher session.

Parameters
[in]argsArguments and options.
Returns
True on success, false on failure to start.

◆ isStarted()

bool ts::InputSwitcher::isStarted ( ) const
inline

Check if the input switcher is started.

Returns
True if the input switcher is in progress, false otherwise.

◆ setInput()

void ts::InputSwitcher::setInput ( size_t pluginIndex)

Switch to another input plugin.

Parameters
[in]pluginIndexIndex of the new input plugin.

◆ nextInput()

void ts::InputSwitcher::nextInput ( )

Switch to the next input plugin.

◆ previousInput()

void ts::InputSwitcher::previousInput ( )

Switch to the previous input plugin.

◆ currentInput()

size_t ts::InputSwitcher::currentInput ( )

Get the index of the current input plugin.

Returns
The index of the current input plugin.

◆ stop()

void ts::InputSwitcher::stop ( )

Stop the input switcher.

◆ waitForTermination()

void ts::InputSwitcher::waitForTermination ( )

Suspend the calling thread until input switcher is completed.

◆ success()

bool ts::InputSwitcher::success ( ) const
inline

Check if the session, when completely run in the constructor, was successful.

Returns
True on success, false on failure to start.

◆ registerEventHandler()

tsduck.PluginEventHandlerRegistry.registerEventHandler ( self,
handler,
event_code )
inherited

Register an event handler by event code.

Parameters
handlerAn instance of AbstractPluginEventHandler.
event_codeThe code of the events to handle.
Returns
None.

◆ registerInputEventHandler()

tsduck.PluginEventHandlerRegistry.registerInputEventHandler ( self,
handler )
inherited

Register an event handler for all events from the input plugin.

Parameters
handlerAn instance of AbstractPluginEventHandler.
Returns
None.

◆ registerOutputEventHandler()

tsduck.PluginEventHandlerRegistry.registerOutputEventHandler ( self,
handler )
inherited

Register an event handler for all events from the output plugin.

Parameters
handlerAn instance of AbstractPluginEventHandler.
Returns
None.

◆ delete()

tsduck.NativeObject.delete ( self)
inherited

Explicitly free the underlying C++ object.

After this call, the object becomes unusable. Most usages are unpredictable but most likely will do nothing.

Returns
None.

Reimplemented in tsduck.AbstractPluginEventHandler, tsduck.AsyncReport, tsduck.DuckContext, tsduck.InputSwitcher, tsduck.SectionFile, tsduck.SystemMonitor, and tsduck.TSProcessor.

◆ _setNative()

tsduck.NativeObject._setNative ( self,
obj )
protectedinherited

Set the native object.

This is typically done by subclass constructors.

Parameters
objAddress of the C++ native object to store.

◆ _getNative()

tsduck.NativeObject._getNative ( self)
protectedinherited

Get the native object.

This is typically used by subclasses.

Returns
Address of the C++ native object.

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