TSDuck v3.40-4033
MPEG Transport Stream Toolkit
|
Serialization of TLV messages. More...
#include <tstlvSerializer.h>
Public Member Functions | |
Serializer (const ByteBlockPtr &bb) | |
Constructor. | |
Serializer (const Serializer &s) | |
Constructor. | |
~Serializer () | |
Destructor. | |
void | closeTLV () |
Close a TLV structure. | |
void | openTLV (TAG tag) |
Open a TLV structure. | |
void | put (const ByteBlock &bl) |
Insert a byte block in the stream. | |
void | put (const std::string &val) |
Insert a string in the stream. | |
void | put (const void *pval, size_t len) |
Insert raw data in the stream. | |
template<typename INT > requires std::integral<INT> | |
void | put (INT i) |
Insert an integer value in the stream (template variant). | |
void | put (TAG tag, const ByteBlock &bl) |
Insert a TLV field containing a byte block in the stream. | |
void | put (TAG tag, const std::string &val) |
Insert a TLV field containing a string in the stream. | |
template<typename INT > requires std::integral<INT> | |
void | put (TAG tag, const std::vector< INT > &val) |
Insert a TLV field containing a vector of integer values in the stream (template variant). | |
void | put (TAG tag, const std::vector< std::string > &val) |
Insert a TLV field containing a vector of strings in the stream. | |
void | put (TAG tag, const void *pval, size_t len) |
Insert a TLV field containing raw data in the stream. | |
template<typename INT > requires std::integral<INT> | |
void | put (TAG tag, INT i) |
Insert a TLV field containing an integer value in the stream (template variant). | |
void | putBool (bool val) |
Insert a boolean value in the stream. | |
void | putBool (TAG tag, bool val) |
Insert a TLV field containing a boolean value in the stream. | |
void | putBool (TAG tag, const std::vector< bool > &val) |
Insert a TLV field containing a vector of boolean values in the stream. | |
void | putInt16 (int16_t i) |
Insert a signed 16-bit integer value in the stream. | |
void | putInt16 (TAG tag, const std::vector< int16_t > &v) |
Insert a TLV field containing a vector of signed 16-bit integer values in the stream. | |
void | putInt16 (TAG tag, int16_t i) |
Insert a TLV field containing a signed 16-bit integer value in the stream. | |
void | putInt32 (int32_t i) |
Insert a signed 32-bit integer value in the stream. | |
void | putInt32 (TAG tag, const std::vector< int32_t > &v) |
Insert a TLV field containing a vector of signed 32-bit integer values in the stream. | |
void | putInt32 (TAG tag, int32_t i) |
Insert a TLV field containing a signed 32-bit integer value in the stream. | |
void | putInt64 (int64_t i) |
Insert a signed 64-bit integer value in the stream. | |
void | putInt64 (TAG tag, const std::vector< int64_t > &v) |
Insert a TLV field containing a vector of signed 64-bit integer values in the stream. | |
void | putInt64 (TAG tag, int64_t i) |
Insert a TLV field containing a signed 64-bit integer value in the stream. | |
void | putInt8 (int8_t i) |
Insert a signed 8-bit integer value in the stream. | |
void | putInt8 (TAG tag, const std::vector< int8_t > &v) |
Insert a TLV field containing a vector of signed 8-bit integer values in the stream. | |
void | putInt8 (TAG tag, int8_t i) |
Insert a TLV field containing a signed 8-bit integer value in the stream. | |
void | putUInt16 (TAG tag, const std::vector< uint16_t > &v) |
Insert a TLV field containing a vector of unsigned 16-bit integer values in the stream. | |
void | putUInt16 (TAG tag, uint16_t i) |
Insert a TLV field containing an unsigned 16-bit integer value in the stream. | |
void | putUInt16 (uint16_t i) |
Insert an unsigned 16-bit integer value in the stream. | |
void | putUInt32 (TAG tag, const std::vector< uint32_t > &v) |
Insert a TLV field containing a vector of unsigned 32-bit integer values in the stream. | |
void | putUInt32 (TAG tag, uint32_t i) |
Insert a TLV field containing an unsigned 32-bit integer value in the stream. | |
void | putUInt32 (uint32_t i) |
Insert an unsigned 16-bit integer value in the stream. | |
void | putUInt64 (TAG tag, const std::vector< uint64_t > &v) |
Insert a TLV field containing a vector of unsigned 64-bit integer values in the stream. | |
void | putUInt64 (TAG tag, uint64_t i) |
Insert a TLV field containing an unsigned 64-bit integer value in the stream. | |
void | putUInt64 (uint64_t i) |
Insert an unsigned 64-bit integer value in the stream. | |
void | putUInt8 (TAG tag, const std::vector< uint8_t > &v) |
Insert a TLV field containing a vector of unsigned 8-bit integer values in the stream. | |
void | putUInt8 (TAG tag, uint8_t i) |
Insert a TLV field containing an unsigned 8-bit integer value in the stream. | |
void | putUInt8 (uint8_t i) |
Insert an unsigned 8-bit integer value in the stream. | |
UString | toString () const |
Convert to a string (for debug purpose). | |
Serialization of TLV messages.
A DVB message is serialized in TLV into a ByteBlock. A Serializer is always associated to a ByteBlock.
|
inline |
Constructor.
Associates an existing message block.
[in] | bb | Safe pointer to an existing message block. The messages will be serialized in this block. |
|
inline |
Constructor.
Use the same message block as another Serializer. Useful to nest serializer when building compound TLV parameters.
[in] | s | Another serializer, will use the same byte block for serialization. |
|
inline |
Destructor.
Close potential pending TLV.
void ts::tlv::Serializer::openTLV | ( | TAG | tag | ) |
Open a TLV structure.
The tag field and a placeholder for the length field are inserted. Cannot be nested in the same serializer. Use nested factories but not nested TLV into one serializer.
[in] | tag | Message or parameter tag. |
void ts::tlv::Serializer::closeTLV | ( | ) |
Close a TLV structure.
The length field is updated.
|
inline |
Insert an unsigned 8-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
Insert an unsigned 16-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
Insert an unsigned 16-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
Insert an unsigned 64-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
Insert a signed 8-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
Insert a signed 16-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
Insert a signed 32-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
Insert a signed 64-bit integer value in the stream.
[in] | i | Integer value to insert. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void ts::tlv::Serializer::putUInt8 | ( | TAG | tag, |
const std::vector< uint8_t > & | v | ||
) |
Insert a TLV field containing a vector of unsigned 8-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
void ts::tlv::Serializer::putUInt16 | ( | TAG | tag, |
const std::vector< uint16_t > & | v | ||
) |
Insert a TLV field containing a vector of unsigned 16-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
void ts::tlv::Serializer::putUInt32 | ( | TAG | tag, |
const std::vector< uint32_t > & | v | ||
) |
Insert a TLV field containing a vector of unsigned 32-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
void ts::tlv::Serializer::putUInt64 | ( | TAG | tag, |
const std::vector< uint64_t > & | v | ||
) |
Insert a TLV field containing a vector of unsigned 64-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
void ts::tlv::Serializer::putInt8 | ( | TAG | tag, |
const std::vector< int8_t > & | v | ||
) |
Insert a TLV field containing a vector of signed 8-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
void ts::tlv::Serializer::putInt16 | ( | TAG | tag, |
const std::vector< int16_t > & | v | ||
) |
Insert a TLV field containing a vector of signed 16-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
void ts::tlv::Serializer::putInt32 | ( | TAG | tag, |
const std::vector< int32_t > & | v | ||
) |
Insert a TLV field containing a vector of signed 32-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
void ts::tlv::Serializer::putInt64 | ( | TAG | tag, |
const std::vector< int64_t > & | v | ||
) |
Insert a TLV field containing a vector of signed 64-bit integer values in the stream.
[in] | tag | Message or parameter tag. |
[in] | v | Vector of integer values to insert. |
|
inline |
Insert a boolean value in the stream.
[in] | val | Boolean value to insert. |
|
inline |
Insert a TLV field containing a boolean value in the stream.
[in] | tag | Message or parameter tag. |
[in] | val | Boolean value to insert. |
void ts::tlv::Serializer::putBool | ( | TAG | tag, |
const std::vector< bool > & | val | ||
) |
Insert a TLV field containing a vector of boolean values in the stream.
[in] | tag | Message or parameter tag. |
[in] | val | Vector of boolean values to insert. |
|
inline |
Insert a string in the stream.
[in] | val | String to insert. |
|
inline |
Insert a TLV field containing a string in the stream.
[in] | tag | Message or parameter tag. |
[in] | val | String to insert. |
void ts::tlv::Serializer::put | ( | TAG | tag, |
const std::vector< std::string > & | val | ||
) |
Insert a TLV field containing a vector of strings in the stream.
[in] | tag | Message or parameter tag. |
[in] | val | Vector of strings to insert. |
|
inline |
Insert a byte block in the stream.
[in] | bl | Byte block to insert. |
Insert a TLV field containing a byte block in the stream.
[in] | tag | Message or parameter tag. |
[in] | bl | Byte block to insert. |
|
inline |
Insert raw data in the stream.
[in] | pval | Address of data to insert. |
[in] | len | Length of data to insert. |
|
inline |
Insert a TLV field containing raw data in the stream.
[in] | tag | Message or parameter tag. |
[in] | pval | Address of data to insert. |
[in] | len | Length of data to insert. |
UString ts::tlv::Serializer::toString | ( | ) | const |
Convert to a string (for debug purpose).