QtlMovie 1.12 (A specialized FFmpeg front-end)
QtsSection Class Reference

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 QtsSectionoperator= (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...
 

Detailed Description

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 :

  • Ignore: Neither check nor compute the CRC32.
  • Check: Validate the CRC32 from the section data. Mark the section as invalid if the CRC is incorrect.
  • Compute: Compute the CRC32 and store it in the section.

Typically, if the data come from the wire, use Check. If the data are built by the application, use Compute,

Constructor & Destructor Documentation

◆ QtsSection() [1/6]

QtsSection::QtsSection ( )
inline

Default constructor.

Section is initially marked invalid.

◆ QtsSection() [2/6]

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.

Parameters
[in]otherOther instance to copy.

◆ QtsSection() [3/6]

QtsSection::QtsSection ( const void *  addr,
int  size,
QtsPid  pid = QTS_PID_NULL,
QtsCrc32::Validation  validation = QtsCrc32::Ignore 
)
inline

Constructor from full binary content.

The content is copied into the section if valid.

Parameters
[in]addrContent address.
[in]sizeContent size.
[in]pidThe PID from which the section was collected.
[in]validationType of validation to apply to the CRC32.

◆ QtsSection() [4/6]

QtsSection::QtsSection ( const QtlByteBlock content,
QtsPid  pid = QTS_PID_NULL,
QtsCrc32::Validation  validation = QtsCrc32::Ignore 
)
inline

Constructor from full binary content.

The content is copied into the section if valid.

Parameters
[in]contentBinary content.
[in]pidThe PID from which the section was collected.
[in]validationType of validation to apply to the CRC32.

◆ QtsSection() [5/6]

QtsSection::QtsSection ( QtsTableId  tid,
bool  isPrivateSection,
const void *  payload,
int  payloadSize,
QtsPid  pid = QTS_PID_NULL 
)
inline

Constructor from short section payload.

Parameters
[in]tidTable id.
[in]isPrivateSectionTrue if this is a "private" (ie. non-MPEG-defined) section.
[in]payloadAddress of payload content.
[in]payloadSizeSize of payload content.
[in]pidThe PID from which the section was collected.

◆ QtsSection() [6/6]

QtsSection::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 
)
inline

Constructor from long section payload.

The provided payload does not contain the CRC32. The CRC32 is automatically computed.

Parameters
[in]tidTable id.
[in]isPrivateSectionTrue if this is a "private" (ie. non-MPEG-defined) section.
[in]tidExtTable id extension.
[in]versionSection version.
[in]isCurrentTrue if "current" table (ie. not next).
[in]sectionNumberThis section number inside table.
[in]lastSectionNumberLast section number inside table.
[in]payloadAddress of payload content.
[in]payloadSizeSize of payload content.
[in]pidThe PID from which the section was collected.

Member Function Documentation

◆ reload() [1/4]

void QtsSection::reload ( const void *  addr,
int  size,
QtsPid  pid = QTS_PID_NULL,
QtsCrc32::Validation  validation = QtsCrc32::Ignore 
)
inline

Reload full binary content.

The content is copied into the section if valid.

Parameters
[in]addrContent address.
[in]sizeContent size.
[in]pidThe PID from which the section was collected.
[in]validationType of validation to apply to the CRC32.

◆ reload() [2/4]

void QtsSection::reload ( const QtlByteBlock content,
QtsPid  pid = QTS_PID_NULL,
QtsCrc32::Validation  validation = QtsCrc32::Ignore 
)
inline

Reload full binary content.

The content is copied into the section if valid.

Parameters
[in]contentBinary content.
[in]pidThe PID from which the section was collected.
[in]validationType of validation to apply to the CRC32.

◆ reload() [3/4]

void QtsSection::reload ( QtsTableId  tid,
bool  isPrivateSection,
const void *  payload,
int  payloadSize,
QtsPid  pid = QTS_PID_NULL 
)

Reload short section.

Parameters
[in]tidTable id.
[in]isPrivateSectionTrue if this is a "private" (ie. non-MPEG-defined) section.
[in]payloadAddress of payload content.
[in]payloadSizeSize of payload content.
[in]pidThe PID from which the section was collected.

◆ reload() [4/4]

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.

Parameters
[in]tidTable id.
[in]isPrivateSectionTrue if this is a "private" (ie. non-MPEG-defined) section.
[in]tidExtTable id extension.
[in]versionSection version.
[in]isCurrentTrue if "current" table (ie. not next).
[in]sectionNumberThis section number inside table.
[in]lastSectionNumberLast section number inside table.
[in]payloadAddress of payload content.
[in]payloadSizeSize of payload content.
[in]pidThe PID from which the section was collected.

◆ clear()

void QtsSection::clear ( )

Clear section content.

Becomes an invalid section.

◆ operator=()

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.

Parameters
[in]otherOther instance to copy.

◆ isValid()

bool QtsSection::isValid ( ) const
inline

Check if a section has valid content.

Returns
True if the section is valid.

◆ operator==()

bool QtsSection::operator== ( const QtsSection other) const

Comparison operator.

Parameters
[in]otherOther instance to compare.
Returns
True if the sections are identical, false otherwise. The source PID's are ignored, only the section contents are compared. Note: Invalid sections are never identical

◆ operator!=()

bool QtsSection::operator!= ( const QtsSection other) const
inline

Difference operator.

Parameters
[in]otherOther instance to compare.
Returns
True if the sections are different, false otherwise. The source PID's are ignored, only the section contents are compared. Note: Invalid sections are never identical

◆ tableId()

QtsTableId QtsSection::tableId ( ) const
inline

Get the table id.

Returns
The table id.

◆ isLongSection()

bool QtsSection::isLongSection ( ) const
inline

Check if the section has a long header.

Returns
True if the section has a long header.

◆ isShortSection()

bool QtsSection::isShortSection ( ) const
inline

Check if the section has a short header.

Returns
True if the section has a short header.

◆ isPrivateSection()

bool QtsSection::isPrivateSection ( ) const
inline

Check if the section is private (ie not-MPEG-defined).

Returns
True if the section is private.

◆ tableIdExtension()

quint16 QtsSection::tableIdExtension ( ) const
inline

Get the table id extension (long sections only).

Returns
The table id extension (zero for short sections).

◆ version()

quint8 QtsSection::version ( ) const
inline

Get the table version (long sections only).

Returns
The table version (zero for short sections).

◆ isCurrent()

bool QtsSection::isCurrent ( ) const
inline

Check if the section is "current" (long sections only).

Returns
True if the section is "current" (false for short sections).

◆ isNext()

bool QtsSection::isNext ( ) const
inline

Check if the section is "next" (long sections only).

Returns
True if the section is "next" (false for short sections).

◆ sectionNumber()

quint8 QtsSection::sectionNumber ( ) const
inline

Get the section number (long sections only).

Returns
The section number (zero for short sections).

◆ lastSectionNumber()

quint8 QtsSection::lastSectionNumber ( ) const
inline

Get the last section number in the table (long sections only).

Returns
The section number (zero for short sections).

◆ etid()

QtsExtTableId QtsSection::etid ( ) const
inline

Get the extended table id.

Returns
The extended table id.

◆ sourcePid()

QtsPid QtsSection::sourcePid ( ) const
inline

Get the PID from which the section was collected.

Returns
The PID from which the section was collected.

◆ content()

const quint8* QtsSection::content ( ) const
inline

Get the address of the full binary content of the section.

Returns
The address of the full binary content of the section. Do not modify the content. May be invalidated after modification in section.

◆ size()

int QtsSection::size ( ) const
inline

Get the size of the full binary content of the section.

Returns
The size of the full binary content of the section.

◆ headerSize()

int QtsSection::headerSize ( ) const
inline

Get the size of the section header.

Returns
The size of the section header.

◆ payload()

const quint8* QtsSection::payload ( ) const
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.

Returns
The address of the section payload. Do not modify the content. May be invalidated after modification in section.

◆ payloadSize()

int QtsSection::payloadSize ( ) const
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.

Returns
The size of the section payload.

◆ packetCount()

QtsPacketCounter QtsSection::packetCount ( ) const
inline

Get the minimum number of TS packets required to transport the section.

Returns
The minimum number of TS packets required to transport the section.

◆ setTableIdExtension()

void QtsSection::setTableIdExtension ( quint16  tidExt,
bool  recomputeCrc = true 
)

Modify the table id extension.

Parameters
[in]tidExtNew table id extension.
[in]recomputeCrcIf true, recompute the CRC32 of the section.

◆ setVersion()

void QtsSection::setVersion ( quint8  version,
bool  recomputeCrc = true 
)

Modify the table version.

Parameters
[in]versionNew table version.
[in]recomputeCrcIf true, recompute the CRC32 of the section.

◆ setIsCurrent()

void QtsSection::setIsCurrent ( bool  isCurrent,
bool  recomputeCrc = true 
)

Modify the "current" flag.

Parameters
[in]isCurrentNew "current" flag.
[in]recomputeCrcIf true, recompute the CRC32 of the section.

◆ setSectionNumber()

void QtsSection::setSectionNumber ( quint8  num,
bool  recomputeCrc = true 
)

Modify the section number.

Parameters
[in]numNew section number.
[in]recomputeCrcIf true, recompute the CRC32 of the section.

◆ setLastSectionNumber()

void QtsSection::setLastSectionNumber ( quint8  num,
bool  recomputeCrc = true 
)

Modify the last section number in the table.

Parameters
[in]numNew last section number in the table.
[in]recomputeCrcIf true, recompute the CRC32 of the section.

◆ setSourcePid()

void QtsSection::setSourcePid ( QtsPid  pid)
inline

Set the PID from which the section was collected (informational only).

Parameters
[in]pidThe PID from which the section was collected.

◆ getFirstTsPacketIndex()

QtsPacketCounter QtsSection::getFirstTsPacketIndex ( ) const
inline

Get the index of first TS packet of the section in the demultiplexed stream.

Returns
The index of first TS packet of the section.

◆ getLastTsPacketIndex()

QtsPacketCounter QtsSection::getLastTsPacketIndex ( ) const
inline

Get the index of last TS packet of the section in the demultiplexed stream.

Returns
The index of last TS packet of the section.

◆ setFirstTsPacketIndex()

void QtsSection::setFirstTsPacketIndex ( QtsPacketCounter  i)
inline

Set the index of first TS packet of the section in the demultiplexed stream.

Parameters
[in]iThe index of first TS packet of the section.

◆ setLastTsPacketIndex()

void QtsSection::setLastTsPacketIndex ( QtsPacketCounter  i)
inline

Set the index of last TS packet of the section in the demultiplexed stream.

Parameters
[in]iThe index of last TS packet of the section.

◆ recomputeCrc32()

void QtsSection::recomputeCrc32 ( )

Recomputes and replaces the CRC32 of the section.

◆ initialize() [1/2]

void QtsSection::initialize ( QtsPid  pid)
private

Initialize the object instance, helper for constructors.

Parameters
[in]pidThe PID from which the section was collected.

◆ initialize() [2/2]

void QtsSection::initialize ( const QtlByteBlock content,
QtsPid  pid,
QtsCrc32::Validation  validation 
)
private

Initialize the object instance, helper for constructors.

Parameters
[in]contentBinary content.
[in]pidThe PID from which the section was collected.
[in]validationType of validation to apply to the CRC32.

Member Data Documentation

◆ _isValid

bool QtsSection::_isValid
private

Content of _data is a valid section.

◆ _sourcePid

QtsPid QtsSection::_sourcePid
private

Source PID (informational).

◆ _firstPkt

QtsPacketCounter QtsSection::_firstPkt
private

Index of first packet in stream (informational).

◆ _lastPkt

QtsPacketCounter QtsSection::_lastPkt
private

Index of last packet in stream (informational).

◆ _data

QtlByteBlock QtsSection::_data
private

Full binary content of the section.


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