QtlMovie 1.12 (A specialized FFmpeg front-end)
QtsTsPacket Struct Reference

Basic definition of an MPEG-2 transport packet. More...

Public Member Functions

void clearPriority ()
 Clear the transport_priority - 1 bit. More...
 
void clearPusi ()
 Clear the payload_unit_start_indicator (PUSI) - 1 bit. More...
 
void clearTei ()
 Clear the transport_error_indicator (TEI) - 1 bit. More...
 
int getAdaptationFieldSize () const
 Compute the adaptation_field (AF) size in bytes. More...
 
quint8 getCc () const
 Extract the continuity_counter (CC) - 4 bits. More...
 
bool getDiscontinuityIndicator () const
 Check if packet has a discontinuity_indicator set - 1 bit. More...
 
quint64 getDts () const
 Get the DTS - 33 bits. More...
 
bool getEspi () const
 Check if packet has a elementary_stream_priority_indicator (ESPI) set - 1 bit. More...
 
int getHeaderSize () const
 Compute the size of the TS header (ie. More...
 
quint64 getOpcr () const
 Get the Original Program Clock Reference (OPCR) - 42 bits. More...
 
const quint8 * getPayload () const
 Get payload start address inside this object. More...
 
quint8 * getPayload ()
 Get payload start address inside this object. More...
 
int getPayloadSize () const
 Compute the payload size. More...
 
quint64 getPcr () const
 Get the Program Clock Reference (PCR) - 42 bits. More...
 
QtsPid getPid () const
 Extract the PID - 13 bits. More...
 
bool getPriority () const
 Extract the transport_priority - 1 bit. More...
 
quint64 getPts () const
 Get the PTS - 33 bits. More...
 
bool getPusi () const
 Extract the payload_unit_start_indicator (PUSI) - 1 bit. More...
 
bool getRandomAccessIndicator () const
 Check if packet has a random_access_indicator set - 1 bit. More...
 
quint8 getScrambling () const
 Extract the transport_scrambling_control - 2 bits. More...
 
bool getTei () const
 Extract the transport_error_indicator (TEI) - 1 bit. More...
 
bool hasAdaptationField () const
 Check if the packet has an adaptation_field (AF). More...
 
bool hasDTS () const
 Check if the TS packet contains a Decoding Time Stamp (DTS). More...
 
bool hasOpcr () const
 Check if packet has an Original Program Clock Reference (OPCR). More...
 
bool hasPayload () const
 Check if the packet has a payload. More...
 
bool hasPcr () const
 Check if packet has a Program Clock Reference (PCR). More...
 
bool hasPts () const
 Check if the TS packet contains a Presentation Time Stamp (PTS). More...
 
bool hasValidSync () const
 Check if the sync byte is valid in the packet. More...
 
bool isClear () const
 Check if the packet is clear. More...
 
bool isScrambled () const
 Check if the packet is scrambled. More...
 
bool operator!= (const QtsTsPacket &p) const
 Difference operator. More...
 
const QtsTsPacketoperator= (const QtsTsPacket &p)
 Assigment operator. More...
 
bool operator== (const QtsTsPacket &p) const
 Comparison operator. More...
 
void setCc (quint8 cc)
 Set the continuity_counter (CC) - 4 bits. More...
 
void setOpcr (const quint64 &opcr)
 Replace the Original Program Clock Reference (OPCR) value - 42 bits. More...
 
void setPcr (const quint64 &pcr)
 Replace the Program Clock Reference (PCR) value - 42 bits. More...
 
void setPid (QtsPid pid)
 Set the PID - 13 bits. More...
 
void setPriority ()
 Set the transport_priority - 1 bit. More...
 
void setPusi ()
 Set the payload_unit_start_indicator (PUSI) - 1 bit. More...
 
void setScrambling (quint8 sc)
 Set the transport_scrambling_control - 2 bits. More...
 
void setTei ()
 Set the transport_error_indicator (TEI) - 1 bit. More...
 
bool startPes () const
 Check if the packet contains the start of a clear PES header. More...
 

Static Public Member Functions

static void sanityCheck ()
 Sanity check routine. More...
 

Public Attributes

quint8 b [QTS_PKT_SIZE]
 Public content is a byte array. More...
 

Private Member Functions

int dtsOffset () const
 Compute the offset of DTS. More...
 
quint64 getPdts (int offset) const
 Get the PTS or DTS at specified offset. More...
 
int opcrOffset () const
 Compute the offset of OPCR. More...
 
int pcrOffset () const
 Compute the offset of PCR. More...
 
int ptsOffset () const
 Compute the offset of PTS. More...
 

Detailed Description

Basic definition of an MPEG-2 transport packet.

The binary representation of this object is exactly 188 bytes. Arrays of QtsTsPacket can be mapped on transport stream data buffers.

Member Function Documentation

◆ operator=()

const QtsTsPacket& QtsTsPacket::operator= ( const QtsTsPacket p)
inline

Assigment operator.

Parameters
pOther instance to assign.
Returns
A reference to this object.

◆ operator==()

bool QtsTsPacket::operator== ( const QtsTsPacket p) const
inline

Comparison operator.

Parameters
pOther instance to compare with.
Returns
True if both packets have same content, false otherwise.

◆ operator!=()

bool QtsTsPacket::operator!= ( const QtsTsPacket p) const
inline

Difference operator.

Parameters
pOther instance to compare with.
Returns
True if packets have distinct contents, false otherwise.

◆ hasValidSync()

bool QtsTsPacket::hasValidSync ( ) const
inline

Check if the sync byte is valid in the packet.

Returns
True if the sync byte is valid.

◆ getPid()

QtsPid QtsTsPacket::getPid ( ) const
inline

Extract the PID - 13 bits.

Returns
The PID of the packet.

◆ setPid()

void QtsTsPacket::setPid ( QtsPid  pid)
inline

Set the PID - 13 bits.

Parameters
[in]pidThe PID of the packet.

◆ getPusi()

bool QtsTsPacket::getPusi ( ) const
inline

Extract the payload_unit_start_indicator (PUSI) - 1 bit.

Returns
True if the PUSI is set, false otherwise.

◆ clearPusi()

void QtsTsPacket::clearPusi ( )
inline

Clear the payload_unit_start_indicator (PUSI) - 1 bit.

◆ setPusi()

void QtsTsPacket::setPusi ( )
inline

Set the payload_unit_start_indicator (PUSI) - 1 bit.

◆ getTei()

bool QtsTsPacket::getTei ( ) const
inline

Extract the transport_error_indicator (TEI) - 1 bit.

Returns
True if the TEI is set, false otherwise.

◆ clearTei()

void QtsTsPacket::clearTei ( )
inline

Clear the transport_error_indicator (TEI) - 1 bit.

◆ setTei()

void QtsTsPacket::setTei ( )
inline

Set the transport_error_indicator (TEI) - 1 bit.

◆ getPriority()

bool QtsTsPacket::getPriority ( ) const
inline

Extract the transport_priority - 1 bit.

Returns
True if the transport_priority is set, false otherwise.

◆ clearPriority()

void QtsTsPacket::clearPriority ( )
inline

Clear the transport_priority - 1 bit.

◆ setPriority()

void QtsTsPacket::setPriority ( )
inline

Set the transport_priority - 1 bit.

◆ getScrambling()

quint8 QtsTsPacket::getScrambling ( ) const
inline

Extract the transport_scrambling_control - 2 bits.

Returns
The transport_scrambling_control value.

◆ isClear()

bool QtsTsPacket::isClear ( ) const
inline

Check if the packet is clear.

Returns
True if the packet is clear, false if it is scrambled.

◆ isScrambled()

bool QtsTsPacket::isScrambled ( ) const
inline

Check if the packet is scrambled.

Returns
True if the packet is scrambled, false if it is clear.

◆ setScrambling()

void QtsTsPacket::setScrambling ( quint8  sc)
inline

Set the transport_scrambling_control - 2 bits.

Parameters
[in]scThe transport_scrambling_control value.

◆ getCc()

quint8 QtsTsPacket::getCc ( ) const
inline

Extract the continuity_counter (CC) - 4 bits.

Returns
The continuity_counter value.

◆ setCc()

void QtsTsPacket::setCc ( quint8  cc)
inline

Set the continuity_counter (CC) - 4 bits.

Parameters
[in]ccThe continuity_counter value.

◆ hasAdaptationField()

bool QtsTsPacket::hasAdaptationField ( ) const
inline

Check if the packet has an adaptation_field (AF).

Returns
True if the packet has an adaptation_field, false otherwise.

◆ getAdaptationFieldSize()

int QtsTsPacket::getAdaptationFieldSize ( ) const
inline

Compute the adaptation_field (AF) size in bytes.

Returns
Adaptation field size in bytes (zero if there is no adaptation field).

◆ getHeaderSize()

int QtsTsPacket::getHeaderSize ( ) const
inline

Compute the size of the TS header (ie.

index to TS payload).

Returns
The size of the TS header (ie. index to TS payload).

◆ hasPayload()

bool QtsTsPacket::hasPayload ( ) const
inline

Check if the packet has a payload.

Returns
True if the packet has a payload, false otherwise.

◆ getPayload() [1/2]

const quint8* QtsTsPacket::getPayload ( ) const
inline

Get payload start address inside this object.

Returns
The payload start address inside this object.

◆ getPayload() [2/2]

quint8* QtsTsPacket::getPayload ( )
inline

Get payload start address inside this object.

Returns
The payload start address inside this object.

◆ getPayloadSize()

int QtsTsPacket::getPayloadSize ( ) const
inline

Compute the payload size.

Returns
The payload size in bytes.

◆ getDiscontinuityIndicator()

bool QtsTsPacket::getDiscontinuityIndicator ( ) const
inline

Check if packet has a discontinuity_indicator set - 1 bit.

Returns
True if the packet has a discontinuity_indicator set, false otherwise.

◆ getRandomAccessIndicator()

bool QtsTsPacket::getRandomAccessIndicator ( ) const
inline

Check if packet has a random_access_indicator set - 1 bit.

Returns
True if the packet has a random_access_indicator set, false otherwise.

◆ getEspi()

bool QtsTsPacket::getEspi ( ) const
inline

Check if packet has a elementary_stream_priority_indicator (ESPI) set - 1 bit.

Returns
True if the packet has a elementary_stream_priority_indicator (ESPI) set, false otherwise.

◆ hasPcr()

bool QtsTsPacket::hasPcr ( ) const
inline

Check if packet has a Program Clock Reference (PCR).

Returns
True if the packet has a Program Clock Reference (PCR), false otherwise.

◆ hasOpcr()

bool QtsTsPacket::hasOpcr ( ) const
inline

Check if packet has an Original Program Clock Reference (OPCR).

Returns
True if the packet has an Original Program Clock Reference (OPCR), false otherwise.

◆ getPcr()

quint64 QtsTsPacket::getPcr ( ) const

Get the Program Clock Reference (PCR) - 42 bits.

Returns
PCR value or zero if not found.

◆ getOpcr()

quint64 QtsTsPacket::getOpcr ( ) const

Get the Original Program Clock Reference (OPCR) - 42 bits.

Returns
OPCR value or zero if not found.

◆ setPcr()

void QtsTsPacket::setPcr ( const quint64 &  pcr)

Replace the Program Clock Reference (PCR) value - 42 bits.

Do nothing if the packet has not PCR.

Parameters
pcrPCR value to replace.

◆ setOpcr()

void QtsTsPacket::setOpcr ( const quint64 &  opcr)

Replace the Original Program Clock Reference (OPCR) value - 42 bits.

Do nothing if the packet has not OPCR.

Parameters
opcrOPCR value to replace.

◆ startPes()

bool QtsTsPacket::startPes ( ) const

Check if the packet contains the start of a clear PES header.

Returns
True if the packet contains the start of a clear PES header, false otherwise.

◆ hasPts()

bool QtsTsPacket::hasPts ( ) const
inline

Check if the TS packet contains a Presentation Time Stamp (PTS).

Technically, the PTS and DTS are part of the PES packet, not the TS packet. If the TS packet is the first TS packet of a PES packet, it is possible that the PTS and/or DTS are present in the PES packet but outside the first TS packet. This is possible but rare. So, we provide here a fast way of getting PTS and/or DTS from the TS packet if available.

Returns
True if the TS packet contains a Presentation Time Stamp (PTS).

◆ hasDTS()

bool QtsTsPacket::hasDTS ( ) const
inline

Check if the TS packet contains a Decoding Time Stamp (DTS).

Returns
True if the TS packet contains a Decoding Time Stamp (DTS).
See also
hasPts()

◆ getPts()

quint64 QtsTsPacket::getPts ( ) const
inline

Get the PTS - 33 bits.

Returns
The PTS value or zero if there is none.
See also
hasPts()

◆ getDts()

quint64 QtsTsPacket::getDts ( ) const
inline

Get the DTS - 33 bits.

Returns
The DTS value or zero if there is none.
See also
hasPts()
hasDts()

◆ sanityCheck()

void QtsTsPacket::sanityCheck ( )
static

Sanity check routine.

Ensure that the QtsTsPacket structure can be used in contiguous memory array and array of packets. Crash the application if this is not the case. Can be used once at startup time in paranoid applications.

◆ pcrOffset()

int QtsTsPacket::pcrOffset ( ) const
private

Compute the offset of PCR.

Returns
PCR offset in packet or zero if there is none.

◆ opcrOffset()

int QtsTsPacket::opcrOffset ( ) const
private

Compute the offset of OPCR.

Returns
OPCR offset in packet or zero if there is none.

◆ ptsOffset()

int QtsTsPacket::ptsOffset ( ) const
private

Compute the offset of PTS.

Returns
PTS offset in packet or zero if there is none.

◆ dtsOffset()

int QtsTsPacket::dtsOffset ( ) const
private

Compute the offset of DTS.

Returns
DTS offset in packet or zero if there is none.

◆ getPdts()

quint64 QtsTsPacket::getPdts ( int  offset) const
private

Get the PTS or DTS at specified offset.

Parameters
[in]offsetOffset in packet.
Returns
A PTS/DTS value or zero if offset is zero.

Member Data Documentation

◆ b

quint8 QtsTsPacket::b[QTS_PKT_SIZE]

Public content is a byte array.

This byte array exactly fills the memory area of a transport packet. This is why arrays of QtsTsPacket can be mapped on transport stream data buffers.


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