![]() |
TSDuck
v3.35-3218
MPEG Transport Stream Toolkit
|
General-purpose plugin event data referencing binary data to exchange with applications. More...
Public Member Functions | |
PluginEventData (const uint8_t *data, size_t size) | |
Constructor passing read-only event data. More... | |
PluginEventData (uint8_t *data, size_t size, size_t max_size) | |
Constructor passing read-write event data. More... | |
virtual | ~PluginEventData () override |
Destructor. | |
bool | append (const void *data_addr, size_t data_size) |
Append new application data inside the plugin event data area. More... | |
const uint8_t * | data () const |
Get the address of the plugin read-only event data. More... | |
bool | hasError () const |
Check the error indicator in the event data. More... | |
size_t | maxSize () const |
Get the maximum size in bytes of the plugin event data. More... | |
uint8_t * | outputData () const |
Get the address of the plugin modifiable event data. More... | |
bool | readOnly () const |
Check if the plugin event data area is read-only. More... | |
size_t | remainingSize () const |
Get the remaining modifiable size in bytes of the plugin event data. More... | |
void | setError (bool error=true) |
Set the error indicator in the event data. More... | |
size_t | size () const |
Get the current size in bytes of the plugin event data. More... | |
bool | updateSize (size_t size) |
Update the current size of the plugin modifiable event data. More... | |
General-purpose plugin event data referencing binary data to exchange with applications.
This subclass of Object can be used as "plugin data" when a plugin triggers an event and wants to pass to the application a read-only binary area.
The plugin event handlers in the application are synchronously invoked in the context of the thread plugin. The referenced binary data can be local data inside the plugin. The event handler may not saved a reference to it.
ts::PluginEventData::PluginEventData | ( | const uint8_t * | data, |
size_t | size | ||
) |
Constructor passing read-only event data.
[in] | data | Address of the plugin event data to pass to applications. It can be a null pointer. |
[in] | size | Size in bytes of the plugin data. |
ts::PluginEventData::PluginEventData | ( | uint8_t * | data, |
size_t | size, | ||
size_t | max_size | ||
) |
Constructor passing read-write event data.
[in] | data | Address of the plugin event data to pass to applications. It can be a null pointer. |
[in] | size | Initial size in bytes of the plugin event data. |
[in] | max_size | Maximum size in bytes of the plugin event data buffer. It must not be less than size. If the application modifies the data, it shall not write more than max_size bytes. |
|
inline |
Check if the plugin event data area is read-only.
|
inline |
Get the address of the plugin read-only event data.
|
inline |
Get the current size in bytes of the plugin event data.
If the event data is modifiable, this may change.
|
inline |
Get the maximum size in bytes of the plugin event data.
If the event data is modifiable, this may be more than size().
|
inline |
Get the remaining modifiable size in bytes of the plugin event data.
If the event data is modifiable, this is zero.
bool ts::PluginEventData::append | ( | const void * | data_addr, |
size_t | data_size | ||
) |
Append new application data inside the plugin event data area.
The plugin event data area must not
[in] | data_addr | Address of the data to append at the end of the plugin event data. |
[in] | data_size | Size in bytes of the data to append. |
|
inline |
Get the address of the plugin modifiable event data.
When the event data are not read-only, the application may update them directly, within the limits of maxSize().
bool ts::PluginEventData::updateSize | ( | size_t | size | ) |
Update the current size of the plugin modifiable event data.
When the event data are not read-only, the application may update the event data directly, within the limits of maxSize(). This method shall be used if the current data size is changed.
[in] | size | The new event data size in bytes. Must not be more than maxSize(). |
|
inline |
Set the error indicator in the event data.
[in] | error | Error indicator (default is true). |
|
inline |
Check the error indicator in the event data.