TSDuck v3.38-3691
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::PluginEventData Class Reference

General-purpose plugin event data referencing binary data to exchange with applications. More...

#include <tsPluginEventData.h>

Inheritance diagram for ts::PluginEventData:
Collaboration diagram for ts::PluginEventData:

Public Member Functions

 PluginEventData (const uint8_t *data, size_t size)
 Constructor passing read-only event data.
 
 PluginEventData (uint8_t *data, size_t size, size_t max_size)
 Constructor passing read-write event data.
 
virtual ~PluginEventData () override
 Destructor.
 
bool append (const void *data_addr, size_t data_size)
 Append new application data inside the plugin event data area.
 
const uint8_t * data () const
 Get the address of the plugin read-only event data.
 
bool hasError () const
 Check the error indicator in the event data.
 
size_t maxSize () const
 Get the maximum size in bytes of the plugin event data.
 
uint8_t * outputData () const
 Get the address of the plugin modifiable event data.
 
bool readOnly () const
 Check if the plugin event data area is read-only.
 
size_t remainingSize () const
 Get the remaining modifiable size in bytes of the plugin event data.
 
void setError (bool error=true)
 Set the error indicator in the event data.
 
size_t size () const
 Get the current size in bytes of the plugin event data.
 
bool updateSize (size_t size)
 Update the current size of the plugin modifiable event data.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PluginEventData() [1/2]

ts::PluginEventData::PluginEventData ( const uint8_t *  data,
size_t  size 
)

Constructor passing read-only event data.

Parameters
[in]dataAddress of the plugin event data to pass to applications. It can be a null pointer.
[in]sizeSize in bytes of the plugin data.

◆ PluginEventData() [2/2]

ts::PluginEventData::PluginEventData ( uint8_t *  data,
size_t  size,
size_t  max_size 
)

Constructor passing read-write event data.

Parameters
[in]dataAddress of the plugin event data to pass to applications. It can be a null pointer.
[in]sizeInitial size in bytes of the plugin event data.
[in]max_sizeMaximum 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.

Member Function Documentation

◆ readOnly()

bool ts::PluginEventData::readOnly ( ) const
inline

Check if the plugin event data area is read-only.

Returns
True if the plugin event data area is read-only.

◆ data()

const uint8_t * ts::PluginEventData::data ( ) const
inline

Get the address of the plugin read-only event data.

Returns
The address of the plugin event data.

◆ size()

size_t ts::PluginEventData::size ( ) const
inline

Get the current size in bytes of the plugin event data.

If the event data is modifiable, this may change.

Returns
The current size in bytes of the plugin data.

◆ maxSize()

size_t ts::PluginEventData::maxSize ( ) const
inline

Get the maximum size in bytes of the plugin event data.

If the event data is modifiable, this may be more than size().

Returns
The maximum size in bytes of the plugin data.

◆ remainingSize()

size_t ts::PluginEventData::remainingSize ( ) const
inline

Get the remaining modifiable size in bytes of the plugin event data.

If the event data is modifiable, this is zero.

Returns
The remaining modifiable size in bytes of the plugin data.

◆ append()

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

Parameters
[in]data_addrAddress of the data to append at the end of the plugin event data.
[in]data_sizeSize in bytes of the data to append.
Returns
True if the data were copied. False if the data area is read-only of the specified data are too large.

◆ outputData()

uint8_t * ts::PluginEventData::outputData ( ) const
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().

Returns
The address of the plugin event data or the null pointer if the event data area is read-only.

◆ updateSize()

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.

Parameters
[in]sizeThe new event data size in bytes. Must not be more than maxSize().
Returns
True on success, false if the event data are read-only or size is too large.

◆ setError()

void ts::PluginEventData::setError ( bool  error = true)
inline

Set the error indicator in the event data.

Parameters
[in]errorError indicator (default is true).

◆ hasError()

bool ts::PluginEventData::hasError ( ) const
inline

Check the error indicator in the event data.

Returns
True if an event handler has reported an error.

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