TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
An abstract class which can be derived by applications to get plugin events. More...
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. | |
An abstract class which can be derived by applications to get plugin events.
tsduck.AbstractPluginEventHandler.__init__ | ( | self | ) |
Constructor.
Reimplemented from tsduck.NativeObject.
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.
Reimplemented from tsduck.NativeObject.
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:
Example: no error, 10-byte data:
Example: error but also with 10-byte data:
or
context | An instance of PluginEventContext containing the details of the event. |
data | A 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. |