Representation of a binary MPEG PSI/SI section. More...
Public Member Functions | |
QtsSection () | |
Default constructor. More... | |
QtsSection (const QtsSection &other) | |
Copy constructor. More... | |
QtsSection (const void *addr, int size, QtsPid pid=QTS_PID_NULL, QtsCrc32::Validation validation=QtsCrc32::Ignore) | |
Constructor from full binary content. More... | |
QtsSection (const QtlByteBlock &content, QtsPid pid=QTS_PID_NULL, QtsCrc32::Validation validation=QtsCrc32::Ignore) | |
Constructor from full binary content. More... | |
QtsSection (QtsTableId tid, bool isPrivateSection, const void *payload, int payloadSize, QtsPid pid=QTS_PID_NULL) | |
Constructor from short section payload. More... | |
QtsSection (QtsTableId tid, bool isPrivateSection, quint16 tidExt, quint8 version, bool isCurrent, quint8 sectionNumber, quint8 lastSectionNumber, const void *payload, int payloadSize, QtsPid pid=QTS_PID_NULL) | |
Constructor from long section payload. More... | |
void | clear () |
Clear section content. More... | |
const quint8 * | content () const |
Get the address of the full binary content of the section. More... | |
QtsExtTableId | etid () const |
Get the extended table id. More... | |
QtsPacketCounter | getFirstTsPacketIndex () const |
Get the index of first TS packet of the section in the demultiplexed stream. More... | |
QtsPacketCounter | getLastTsPacketIndex () const |
Get the index of last TS packet of the section in the demultiplexed stream. More... | |
int | headerSize () const |
Get the size of the section header. More... | |
bool | isCurrent () const |
Check if the section is "current" (long sections only). More... | |
bool | isLongSection () const |
Check if the section has a long header. More... | |
bool | isNext () const |
Check if the section is "next" (long sections only). More... | |
bool | isPrivateSection () const |
Check if the section is private (ie not-MPEG-defined). More... | |
bool | isShortSection () const |
Check if the section has a short header. More... | |
bool | isValid () const |
Check if a section has valid content. More... | |
quint8 | lastSectionNumber () const |
Get the last section number in the table (long sections only). More... | |
bool | operator!= (const QtsSection &other) const |
Difference operator. More... | |
const QtsSection & | operator= (const QtsSection &other) |
Assignment operator. More... | |
bool | operator== (const QtsSection &other) const |
Comparison operator. More... | |
QtsPacketCounter | packetCount () const |
Get the minimum number of TS packets required to transport the section. More... | |
const quint8 * | payload () const |
Get the address of the section payload. More... | |
int | payloadSize () const |
Get the size of the section payload. More... | |
void | recomputeCrc32 () |
Recomputes and replaces the CRC32 of the section. More... | |
void | reload (const void *addr, int size, QtsPid pid=QTS_PID_NULL, QtsCrc32::Validation validation=QtsCrc32::Ignore) |
Reload full binary content. More... | |
void | reload (const QtlByteBlock &content, QtsPid pid=QTS_PID_NULL, QtsCrc32::Validation validation=QtsCrc32::Ignore) |
Reload full binary content. More... | |
void | reload (QtsTableId tid, bool isPrivateSection, const void *payload, int payloadSize, QtsPid pid=QTS_PID_NULL) |
Reload short section. More... | |
void | reload (QtsTableId tid, bool isPrivateSection, quint16 tidExt, quint8 version, bool isCurrent, quint8 sectionNumber, quint8 lastSectionNumber, const void *payload, int payloadSize, QtsPid pid=QTS_PID_NULL) |
Reload long section. More... | |
quint8 | sectionNumber () const |
Get the section number (long sections only). More... | |
void | setFirstTsPacketIndex (QtsPacketCounter i) |
Set the index of first TS packet of the section in the demultiplexed stream. More... | |
void | setIsCurrent (bool isCurrent, bool recomputeCrc=true) |
Modify the "current" flag. More... | |
void | setLastSectionNumber (quint8 num, bool recomputeCrc=true) |
Modify the last section number in the table. More... | |
void | setLastTsPacketIndex (QtsPacketCounter i) |
Set the index of last TS packet of the section in the demultiplexed stream. More... | |
void | setSectionNumber (quint8 num, bool recomputeCrc=true) |
Modify the section number. More... | |
void | setSourcePid (QtsPid pid) |
Set the PID from which the section was collected (informational only). More... | |
void | setTableIdExtension (quint16 tidExt, bool recomputeCrc=true) |
Modify the table id extension. More... | |
void | setVersion (quint8 version, bool recomputeCrc=true) |
Modify the table version. More... | |
int | size () const |
Get the size of the full binary content of the section. More... | |
QtsPid | sourcePid () const |
Get the PID from which the section was collected. More... | |
QtsTableId | tableId () const |
Get the table id. More... | |
quint16 | tableIdExtension () const |
Get the table id extension (long sections only). More... | |
quint8 | version () const |
Get the table version (long sections only). More... | |
Private Member Functions | |
void | initialize (QtsPid pid) |
Initialize the object instance, helper for constructors. More... | |
void | initialize (const QtlByteBlock &content, QtsPid pid, QtsCrc32::Validation validation) |
Initialize the object instance, helper for constructors. More... | |
Private Attributes | |
QtlByteBlock | _data |
Full binary content of the section. More... | |
QtsPacketCounter | _firstPkt |
Index of first packet in stream (informational). More... | |
bool | _isValid |
Content of _data is a valid section. More... | |
QtsPacketCounter | _lastPkt |
Index of last packet in stream (informational). More... | |
QtsPid | _sourcePid |
Source PID (informational). More... | |
Representation of a binary MPEG PSI/SI section.
Data from sections are not deeply copied thanks to the implicit sharing mechanism of the Qt containers. Whenever a section is modified, then a copy-on-write occurs.
General note: What to do with the CRC32 when building a section depends on the parameter named validation of type Qts::Crc32 :
Typically, if the data come from the wire, use Check. If the data are built by the application, use Compute,
|
inline |
Default constructor.
Section is initially marked invalid.
QtsSection::QtsSection | ( | const QtsSection & | other | ) |
Copy constructor.
Data from sections are not deeply copied thanks to the implicit sharing mechanism of the Qt containers. Whenever a section is modified, then a copy-on-write occurs.
[in] | other | Other instance to copy. |
|
inline |
Constructor from full binary content.
The content is copied into the section if valid.
[in] | addr | Content address. |
[in] | size | Content size. |
[in] | pid | The PID from which the section was collected. |
[in] | validation | Type of validation to apply to the CRC32. |
|
inline |
Constructor from full binary content.
The content is copied into the section if valid.
[in] | content | Binary content. |
[in] | pid | The PID from which the section was collected. |
[in] | validation | Type of validation to apply to the CRC32. |
|
inline |
Constructor from short section payload.
[in] | tid | Table id. |
[in] | isPrivateSection | True if this is a "private" (ie. non-MPEG-defined) section. |
[in] | payload | Address of payload content. |
[in] | payloadSize | Size of payload content. |
[in] | pid | The PID from which the section was collected. |
|
inline |
Constructor from long section payload.
The provided payload does not contain the CRC32. The CRC32 is automatically computed.
[in] | tid | Table id. |
[in] | isPrivateSection | True if this is a "private" (ie. non-MPEG-defined) section. |
[in] | tidExt | Table id extension. |
[in] | version | Section version. |
[in] | isCurrent | True if "current" table (ie. not next). |
[in] | sectionNumber | This section number inside table. |
[in] | lastSectionNumber | Last section number inside table. |
[in] | payload | Address of payload content. |
[in] | payloadSize | Size of payload content. |
[in] | pid | The PID from which the section was collected. |
|
inline |
Reload full binary content.
The content is copied into the section if valid.
[in] | addr | Content address. |
[in] | size | Content size. |
[in] | pid | The PID from which the section was collected. |
[in] | validation | Type of validation to apply to the CRC32. |
|
inline |
Reload full binary content.
The content is copied into the section if valid.
[in] | content | Binary content. |
[in] | pid | The PID from which the section was collected. |
[in] | validation | Type of validation to apply to the CRC32. |
void QtsSection::reload | ( | QtsTableId | tid, |
bool | isPrivateSection, | ||
const void * | payload, | ||
int | payloadSize, | ||
QtsPid | pid = QTS_PID_NULL |
||
) |
Reload short section.
[in] | tid | Table id. |
[in] | isPrivateSection | True if this is a "private" (ie. non-MPEG-defined) section. |
[in] | payload | Address of payload content. |
[in] | payloadSize | Size of payload content. |
[in] | pid | The PID from which the section was collected. |
void QtsSection::reload | ( | QtsTableId | tid, |
bool | isPrivateSection, | ||
quint16 | tidExt, | ||
quint8 | version, | ||
bool | isCurrent, | ||
quint8 | sectionNumber, | ||
quint8 | lastSectionNumber, | ||
const void * | payload, | ||
int | payloadSize, | ||
QtsPid | pid = QTS_PID_NULL |
||
) |
Reload long section.
The provided payload does not contain the CRC32. The CRC32 is automatically computed.
[in] | tid | Table id. |
[in] | isPrivateSection | True if this is a "private" (ie. non-MPEG-defined) section. |
[in] | tidExt | Table id extension. |
[in] | version | Section version. |
[in] | isCurrent | True if "current" table (ie. not next). |
[in] | sectionNumber | This section number inside table. |
[in] | lastSectionNumber | Last section number inside table. |
[in] | payload | Address of payload content. |
[in] | payloadSize | Size of payload content. |
[in] | pid | The PID from which the section was collected. |
void QtsSection::clear | ( | ) |
Clear section content.
Becomes an invalid section.
const QtsSection & QtsSection::operator= | ( | const QtsSection & | other | ) |
Assignment operator.
Data from sections are not deeply copied thanks to the implicit sharing mechanism of the Qt containers. Whenever a section is modified, then a copy-on-write occurs.
[in] | other | Other instance to copy. |
|
inline |
Check if a section has valid content.
bool QtsSection::operator== | ( | const QtsSection & | other | ) | const |
Comparison operator.
[in] | other | Other instance to compare. |
|
inline |
Difference operator.
[in] | other | Other instance to compare. |
|
inline |
Get the table id.
|
inline |
Check if the section has a long header.
|
inline |
Check if the section has a short header.
|
inline |
Check if the section is private (ie not-MPEG-defined).
|
inline |
Get the table id extension (long sections only).
|
inline |
Get the table version (long sections only).
|
inline |
Check if the section is "current" (long sections only).
|
inline |
Check if the section is "next" (long sections only).
|
inline |
Get the section number (long sections only).
|
inline |
Get the last section number in the table (long sections only).
|
inline |
Get the extended table id.
|
inline |
Get the PID from which the section was collected.
|
inline |
Get the address of the full binary content of the section.
|
inline |
Get the size of the full binary content of the section.
|
inline |
Get the size of the section header.
|
inline |
Get the address of the section payload.
For short sections, the payload starts after the private_section_length field. For long sections, the payload starts after the last_section_number field and ends before the CRC32 field.
|
inline |
Get the size of the section payload.
For short sections, the payload starts after the private_section_length field. For long sections, the payload starts after the last_section_number field and ends before the CRC32 field.
|
inline |
Get the minimum number of TS packets required to transport the section.
void QtsSection::setTableIdExtension | ( | quint16 | tidExt, |
bool | recomputeCrc = true |
||
) |
Modify the table id extension.
[in] | tidExt | New table id extension. |
[in] | recomputeCrc | If true, recompute the CRC32 of the section. |
void QtsSection::setVersion | ( | quint8 | version, |
bool | recomputeCrc = true |
||
) |
Modify the table version.
[in] | version | New table version. |
[in] | recomputeCrc | If true, recompute the CRC32 of the section. |
void QtsSection::setIsCurrent | ( | bool | isCurrent, |
bool | recomputeCrc = true |
||
) |
Modify the "current" flag.
[in] | isCurrent | New "current" flag. |
[in] | recomputeCrc | If true, recompute the CRC32 of the section. |
void QtsSection::setSectionNumber | ( | quint8 | num, |
bool | recomputeCrc = true |
||
) |
Modify the section number.
[in] | num | New section number. |
[in] | recomputeCrc | If true, recompute the CRC32 of the section. |
void QtsSection::setLastSectionNumber | ( | quint8 | num, |
bool | recomputeCrc = true |
||
) |
Modify the last section number in the table.
[in] | num | New last section number in the table. |
[in] | recomputeCrc | If true, recompute the CRC32 of the section. |
|
inline |
Set the PID from which the section was collected (informational only).
[in] | pid | The PID from which the section was collected. |
|
inline |
Get the index of first TS packet of the section in the demultiplexed stream.
|
inline |
Get the index of last TS packet of the section in the demultiplexed stream.
|
inline |
Set the index of first TS packet of the section in the demultiplexed stream.
[in] | i | The index of first TS packet of the section. |
|
inline |
Set the index of last TS packet of the section in the demultiplexed stream.
[in] | i | The index of last TS packet of the section. |
void QtsSection::recomputeCrc32 | ( | ) |
Recomputes and replaces the CRC32 of the section.
|
private |
Initialize the object instance, helper for constructors.
[in] | pid | The PID from which the section was collected. |
|
private |
Initialize the object instance, helper for constructors.
[in] | content | Binary content. |
[in] | pid | The PID from which the section was collected. |
[in] | validation | Type of validation to apply to the CRC32. |
|
private |
Content of _data is a valid section.
|
private |
Source PID (informational).
|
private |
Index of first packet in stream (informational).
|
private |
Index of last packet in stream (informational).
|
private |
Full binary content of the section.