TSDuck v3.40-3968
MPEG Transport Stream Toolkit
|
Metadata of an MPEG-2 transport packet for tsp plugins. More...
#include <tsTSPacketMetadata.h>
Public Member Functions | |
TSPacketMetadata () | |
Constructor. | |
uint8_t * | auxData () |
Direct access to the auxiliary data. | |
const uint8_t * | auxData () const |
Direct access to the auxiliary data. | |
size_t | auxDataSize () const |
Size in bytes of the auxiliary data. | |
void | clearAllLabels () |
Clear all labels for the TS packet. | |
void | clearInputTimeStamp () |
Clear the input time stamp. | |
void | clearLabel (size_t label) |
Clear a specific label for the TS packet. | |
void | clearLabels (const TSPacketLabelSet &mask) |
Clear a specific set of labels for the TS packet. | |
bool | deserialize (const ByteBlock &bin) |
Deserialize the content of this instance from a byteblock. | |
bool | deserialize (const void *data, size_t size) |
Deserialize the content of this instance from a byteblock. | |
size_t | getAuxData (void *data, size_t max_size) const |
Copy bytes from the auxiliary data. | |
void | getAuxData (void *data, size_t max_size, uint8_t pad) const |
Copy bytes from the auxiliary data and pad user buffer if necessary. | |
bool | getBitrateChanged () const |
Check if the plugin has changed the transport stream bitrate. | |
bool | getFlush () const |
Check if the packet chain shall be flushed by tsp as soon as possible. | |
bool | getInputStuffing () const |
Check if the packet was artificially inserted as input stuffing. | |
TimeSource | getInputTimeSource () const |
Get the identification of the source of the input time stamp. | |
PCR | getInputTimeStamp () const |
Get the optional input time stamp of the packet. | |
bool | getNullified () const |
Check if the packet was explicitly turned into a null packet by a plugin. | |
bool | hasAllLabels (const TSPacketLabelSet &mask) const |
Check if the TS packet has all labels set from a set of labels. | |
bool | hasAnyLabel () const |
Check if the TS packet has any label set. | |
bool | hasAnyLabel (const TSPacketLabelSet &mask) const |
Check if the TS packet has any label set from a set of labels. | |
bool | hasInputTimeStamp () const |
Check if the packet has an input time stamp. | |
bool | hasLabel (size_t label) const |
Check if the TS packet has a specific label set. | |
UString | inputTimeStampString (const UString &none=u"none") const |
Get the input time stamp as a string, typically for debug messages. | |
TSPacketLabelSet | labels () const |
Get all labels from the TS packet. | |
UString | labelsString (const UString &separator=u" ", const UString &none=u"none") const |
Get the list of labels as a string, typically for debug messages. | |
void | reset () |
Reset the content of this instance. | |
void | serialize (ByteBlock &bin) const |
Serialize the content of this instance into a byteblock. | |
size_t | serialize (void *data, size_t size) const |
Serialize the content of this instance into a memory area. | |
void | setAuxData (const void *data, size_t size) |
Copy bytes into the auxiliary data. | |
void | setBitrateChanged (bool on) |
Specify if the plugin has changed the transport stream bitrate. | |
void | setFlush (bool on) |
Specify if the packet chain shall be flushed by tsp as soon as possible. | |
void | setInputStuffing (bool on) |
Specify if the packet was artificially inserted as input stuffing. | |
template<class Rep , class Period > | |
void | setInputTimeStamp (const cn::duration< Rep, Period > &time_stamp, TimeSource source) |
Set the optional input time stamp of the packet. | |
void | setLabel (size_t label) |
Set a specific label for the TS packet. | |
void | setLabels (const TSPacketLabelSet &mask) |
Set a specific set of labels for the TS packet. | |
void | setNullified (bool on) |
Specify if the packet was explicitly turned into a null packet by a plugin. | |
Static Public Member Functions | |
static void | Copy (TSPacketMetadata *dest, const TSPacketMetadata *source, size_t count) |
Copy contiguous TS packet metadata. | |
static void | DisplayLayout (std::ostream &out, const char *prefix="") |
Display the structure layout of the data structure (for debug only). | |
static void | Reset (TSPacketMetadata *dest, size_t count) |
Reset contiguous TS packet metadata. | |
Static Public Attributes | |
static constexpr size_t | AUX_DATA_MAX_SIZE = 16 |
Maximum size in bytes of auxiliary data. | |
static constexpr uint8_t | SERIALIZATION_MAGIC = SYNC_BYTE ^ 0xFF |
First "magic" byte of the structure into which a TSPacketMetadata was serialized. | |
static constexpr size_t | SERIALIZATION_SIZE = 14 |
Size in bytes of the structure into which a TSPacketMetadata can be serialized. | |
Metadata of an MPEG-2 transport packet for tsp plugins.
An instance of this class is passed with each TS packet to packet processor plugins.
void ts::TSPacketMetadata::reset | ( | ) |
Reset the content of this instance.
Return to initial empty state.
|
inline |
Specify if the packet was artificially inserted as input stuffing.
[in] | on | When true, the packet was artificially inserted as input stuffing. |
|
inline |
Check if the packet was artificially inserted as input stuffing.
|
inline |
Specify if the packet was explicitly turned into a null packet by a plugin.
[in] | on | When true, the packet was explicitly turned into a null packet by a plugin. |
|
inline |
Check if the packet was explicitly turned into a null packet by a plugin.
|
inline |
Specify if the packet chain shall be flushed by tsp as soon as possible.
This is typically called by a packet processing plugin.
[in] | on | When set to true by a packet processing plugin, the packet and all previously processed and buffered packets should be passed to the next processor as soon as possible. |
|
inline |
Check if the packet chain shall be flushed by tsp as soon as possible.
|
inline |
Specify if the plugin has changed the transport stream bitrate.
This is typically called by a packet processing plugin.
[in] | on | When set to true by a packet processing plugin, tsp should call its getBitrate() callback as soon as possible. |
|
inline |
Check if the plugin has changed the transport stream bitrate.
|
inline |
Check if the TS packet has a specific label set.
[in] | label | The label to check. |
|
inline |
Check if the TS packet has any label set.
|
inline |
Check if the TS packet has any label set from a set of labels.
[in] | mask | The mask of labels to check. |
|
inline |
Check if the TS packet has all labels set from a set of labels.
[in] | mask | The mask of labels to check. |
|
inline |
Get all labels from the TS packet.
|
inline |
Set a specific label for the TS packet.
[in] | label | The label to set. |
|
inline |
Set a specific set of labels for the TS packet.
[in] | mask | The mask of labels to set. |
|
inline |
Clear a specific label for the TS packet.
[in] | label | The label to clear. |
|
inline |
Clear a specific set of labels for the TS packet.
[in] | mask | The mask of labels to clear. |
UString ts::TSPacketMetadata::labelsString | ( | const UString & | separator = u" " , |
const UString & | none = u"none" |
||
) | const |
Get the list of labels as a string, typically for debug messages.
[in] | separator | Separator between labale values. |
[in] | none | String to display when there is no label set. |
|
inline |
Get the optional input time stamp of the packet.
tsp
or not set at all.tsp
software (based on internal clock), by the receiving hardware (the NIC for instance) or by some external source (RTP or M2TS time stamp).
|
inline |
Get the identification of the source of the input time stamp.
|
inline |
Check if the packet has an input time stamp.
void ts::TSPacketMetadata::setInputTimeStamp | ( | const cn::duration< Rep, Period > & | time_stamp, |
TimeSource | source | ||
) |
Set the optional input time stamp of the packet.
[in] | time_stamp | Input time stamp value. This value should be taken from a monotonic clock. |
[in] | source | Identification of time stamp source. |
Get the input time stamp as a string, typically for debug messages.
[in] | none | String to display when there is no label set. |
void ts::TSPacketMetadata::setAuxData | ( | const void * | data, |
size_t | size | ||
) |
Copy bytes into the auxiliary data.
The auxiliary data are made of up to 16 bytes and are attached to the packet metadata. There is no predefined usage for auxiliary data. In practice, they are read from the 16-byte trailer which can be found in some modulation systems, after the TS packet.
data | [in] Address of data to copy into the auxiliary data. |
size | [in] Size in bytes of the data to copy. Up to 16 bytes are used, the rest is ignored. |
size_t ts::TSPacketMetadata::getAuxData | ( | void * | data, |
size_t | max_size | ||
) | const |
Copy bytes from the auxiliary data.
data | [out] Address of user buffer to receive the auxiliary data. |
max_size | [in] Maximum size in bytes of the user buffer. |
void ts::TSPacketMetadata::getAuxData | ( | void * | data, |
size_t | max_size, | ||
uint8_t | pad | ||
) | const |
Copy bytes from the auxiliary data and pad user buffer if necessary.
data | [out] Address of user buffer to receive the auxiliary data. |
max_size | [in] Maximum size in bytes of the user buffer. |
pad | [in] Pad value to copy in all additional bytes in the user's buffer if the auxiliary data are shorter than max_size. |
|
inline |
Size in bytes of the auxiliary data.
|
inline |
Direct access to the auxiliary data.
|
inline |
Direct access to the auxiliary data.
|
static |
Copy contiguous TS packet metadata.
[out] | dest | Address of the first contiguous TS packet metadata to write. |
[in] | source | Address of the first contiguous TS packet metadata to read. |
[in] | count | Number of TS packet metadata to copy. |
|
static |
Reset contiguous TS packet metadata.
[out] | dest | Address of the first contiguous TS packet metadata to reset. |
[in] | count | Number of TS packet metadata to copy. |
void ts::TSPacketMetadata::serialize | ( | ByteBlock & | bin | ) | const |
Serialize the content of this instance into a byteblock.
The serialized data is a fixed size block of SERIALIZATION_SIZE bytes. The auxiliary data are not included in the serialized buffer.
[out] | bin | Returned binary data. |
size_t ts::TSPacketMetadata::serialize | ( | void * | data, |
size_t | size | ||
) | const |
Serialize the content of this instance into a memory area.
The serialized data is a fixed size block of SERIALIZATION_SIZE bytes. The auxiliary data are not included in the serialized buffer.
[out] | data | Address of the memory area. |
[in] | size | Size in bytes of the memory area. |
|
inline |
Deserialize the content of this instance from a byteblock.
[in] | bin | Binary data containing a serialized instance of TSPacketMetadata. |
bool ts::TSPacketMetadata::deserialize | ( | const void * | data, |
size_t | size | ||
) |
Deserialize the content of this instance from a byteblock.
[in] | data | Address of binary data containing a serialized instance of TSPacketMetadata. |
[in] | size | Size in bytes of these data. |
|
static |
Display the structure layout of the data structure (for debug only).
[in,out] | out | Output stream, where to display. |
[in] | prefix | Optional prefix on each line. |
|
staticconstexpr |
Maximum size in bytes of auxiliary data.
|
staticconstexpr |
First "magic" byte of the structure into which a TSPacketMetadata was serialized.
Intentionally the opposite of the TS packet synchro byte.