![]() |
TSDuck v3.46-4930
MPEG Transport Stream Toolkit
|
#include <tsTLVSyntax.h>
Public Member Functions | |
| TLVSyntax (int start=-1, int size=-1, size_t tag_size=1, size_t length_size=1, bool msb=true, Report &report=(ts::CerrReport::Instance())) | |
| bool | fromString (const UString &s, Report &report=(ts::CerrReport::Instance())) |
| size_t | getLengthSize () const |
| size_t | getTagAndLength (const uint8_t *data, size_t size, uint32_t &tag, size_t &length) const |
| size_t | getTagSize () const |
| bool | locateTLV (const uint8_t *data, size_t data_size, size_t &tlv_start, size_t &tlv_size) const |
| bool | operator< (const TLVSyntax &other) const |
| bool | set (int start=-1, int size=-1, size_t tag_size=1, size_t length_size=1, bool msb=true, Report &report=(ts::CerrReport::Instance())) |
| void | setAutoLocation () |
Representation of a Tag, Length, Value (TVL) syntax.
An instance of this class describe how a part of a data area, typically in the payload of an MPEG section, is structured as a suite of TLV records. The complete suite of all contiguous TLV records is named the "TLV area" inside the larger data area.
A TLV area is described by the following values:
| ts::TLVSyntax::TLVSyntax | ( | int | start = -1, |
| int | size = -1, | ||
| size_t | tag_size = 1, | ||
| size_t | length_size = 1, | ||
| bool | msb = true, | ||
| Report & | report = (ts::CerrReport::Instance()) ) |
Default constructor.
| [in] | start | Starting index of the "TLV area" in the "data area". A negative value means "auto". |
| [in] | size | Size in bytes of the "TLV area". A negative value means "auto". |
| [in] | tag_size | Size in bytes of the tag field. The valid sizes are 1 (default), 2 and 4. |
| [in] | length_size | Size in bytes of the length field. The valid sizes are 1 (default), 2 and 4. |
| [in] | msb | If true, the tag and length fields are represented in MSB-first. |
| [in,out] | report | Where to report errors. |
| bool ts::TLVSyntax::set | ( | int | start = -1, |
| int | size = -1, | ||
| size_t | tag_size = 1, | ||
| size_t | length_size = 1, | ||
| bool | msb = true, | ||
| Report & | report = (ts::CerrReport::Instance()) ) |
Set the values of a TLVSyntax object.
| [in] | start | Starting index of the "TLV area" in the "data area". A negative value means "auto". |
| [in] | size | Size in bytes of the "TLV area". A negative value means "auto". |
| [in] | tag_size | Size in bytes of the tag field. The valid sizes are 1 (default), 2 and 4. |
| [in] | length_size | Size in bytes of the length field. The valid sizes are 1 (default), 2 and 4. |
| [in] | msb | If true, the tag and length fields are represented in MSB-first. |
| [in,out] | report | Where to report errors. |
|
inline |
Update the TLV syntax to automatically locate the TLV area.
|
inline |
Get the size in bytes of the Tag field.
|
inline |
Get the size in bytes of the Length field.
| bool ts::TLVSyntax::fromString | ( | const UString & | s, |
| Report & | report = (ts::CerrReport::Instance()) ) |
Set the values of a TLVSyntax object from a string representation. Typically used to ingest command line parameters.
| [in] | s | The string representation in the form "start,size,tagSize,lengthSize,order". The start and size fields can be set to "auto". The order field shall be either "msb" or lsb". All fields are optional. Missing fields receive the default value as defined in the constructor. |
| [in,out] | report | Where to report errors. |
| size_t ts::TLVSyntax::getTagAndLength | ( | const uint8_t * | data, |
| size_t | size, | ||
| uint32_t & | tag, | ||
| size_t & | length ) const |
Extract a tag and length value from a data area.
| [in] | data | Address of the TLV record. |
| [in] | size | Total size in bytes of the data area after data address. |
| [out] | tag | Returned tag value. |
| [out] | length | Returned length value. |
| bool ts::TLVSyntax::locateTLV | ( | const uint8_t * | data, |
| size_t | data_size, | ||
| size_t & | tlv_start, | ||
| size_t & | tlv_size ) const |
Locate the "TLV area" inside a data area. If the start or size are set to "auto", return the best match.
| [in] | data | Address of the TLV data area. |
| [in] | data_size | Total size in bytes of the data area. |
| [out] | tlv_start | Starting offset of the "TLV area" after data. |
| [out] | tlv_size | Size in bytes of the "TLV area". Zero if no suitable TLV area was found. |
|
inline |
Comparison operator, typically used to sort containers of TLVSyntax.
| [in] | other | Other instance to compare. |