TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
tsduck.AbstractPluginEventHandler Class Reference

An abstract class which can be derived by applications to get plugin events. More...

Inheritance diagram for tsduck.AbstractPluginEventHandler:
Collaboration diagram for tsduck.AbstractPluginEventHandler:

Public Member Functions

 __init__ (self)
 Constructor.
 
 delete (self)
 Explicitly free the underlying C++ object.
 
 handlePluginEvent (self, context, data)
 This handler is invoked when a plugin signals an event for which this object is registered.
 

Detailed Description

An abstract class which can be derived by applications to get plugin events.

Constructor & Destructor Documentation

◆ __init__()

tsduck.AbstractPluginEventHandler.__init__ (   self)

Constructor.

Reimplemented from tsduck.NativeObject.

Member Function Documentation

◆ delete()

tsduck.AbstractPluginEventHandler.delete (   self)

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 from tsduck.NativeObject.

◆ handlePluginEvent()

tsduck.AbstractPluginEventHandler.handlePluginEvent (   self,
  context,
  data 
)

This handler is invoked when a plugin signals an event for which this object is registered.

The application should override it to collect the event.

The associated input event data is passed in data. If context.read_only_data is False, it is possible to update the data. This is typically the case with the memory input plugin which signals events with empty input data and expects TS packets as returned data. The updated data, if any, should be returned by the function as a bytearray. The size of the returned data shall not exceed context.max_data_size. Otherwise, it will be ignored.

It is also possible to signal an error state by returning False.

The return value of this function can consequently be a bool, a bytearray or a tuple of both. The bool is True on success or False to set the error indicator of the event. The bytearray is the updated output event data (if the even data is not read-only). The default is no error, no data if the function returns nothing.

Example: error, no data:

return False

Example: no error, 10-byte data:

return bytearray(b'0123456789')

Example: error but also with 10-byte data:

return False, bytearray(b'0123456789')

or

return bytearray(b'0123456789'), False
Parameters
contextAn instance of PluginEventContext containing the details of the event.
dataA bytes object containing the data of the event. This is a read-only sequence of bytes. There is no way to return data from Python to the plugin.
Returns
A bool, a bytearray or a tuple of both.

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