Basic definition of an MPEG-2 PES packet(Packetized Elementary Stream). More...
Public Member Functions | |
QtsPesPacket () | |
Default constructor. More... | |
QtsPesPacket (const void *addr, int size, QtsPid pid=QTS_PID_NULL) | |
Constructor from full binary content. More... | |
QtsPesPacket (const QtlByteBlock &content, QtsPid pid=QTS_PID_NULL) | |
Constructor from full binary content. More... | |
void | clear () |
Clear packet content, becomes an invalid packet. More... | |
QtlByteBlock | content () const |
Get a copy of the full binary content of the packet. More... | |
quint64 | getDts () const |
Get the DTS (Decoding Time Stamp) - 33 bits. More... | |
QtsPacketCounter | getFirstTsPacketIndex () const |
Get the index of first TS packet of the PES packet in the demultiplexed stream. More... | |
QtsPacketCounter | getLastTsPacketIndex () const |
Get the index of last TS packet of the PES packet in the demultiplexed stream. More... | |
quint64 | getPts () const |
Get the PTS (Presentation Time Stamp) - 33 bits. More... | |
QtsPid | getSourcePid () const |
Get the PID from which the packet was collected (informational only). More... | |
QtsPesStreamId | getStreamId () const |
Get the stream identifier of the PES packet. More... | |
bool | hasDts () const |
Check if the PES packet contains a DTS (Decoding Time Stamp). More... | |
bool | hasLongHeader () const |
Check if the packet has a long header. More... | |
bool | hasPts () const |
Check if the PES packet contains a PTS (Presentation Time Stamp). More... | |
const quint8 * | header () const |
Get the address of the PES header in the packet. More... | |
int | headerSize () const |
Get the size of the PES header in the packet. More... | |
bool | isAc3 () const |
Check if the PES packet contains AC-3 or Enhanced-AC-3 audio. More... | |
bool | isAvc () const |
Check if the PES packet contains AVC / H.264. More... | |
bool | isMpeg2Video () const |
Check if the PES packet contains MPEG-2 video (also applies to MPEG-1 video). More... | |
bool | isValid () const |
Check if a packet has valid content. More... | |
bool | operator!= (const QtsPesPacket &other) const |
Difference operator. More... | |
bool | operator== (const QtsPesPacket &other) const |
Comparison operator. More... | |
const quint8 * | payload () const |
Get the address of the PES payload in the packet. More... | |
int | payloadSize () const |
Get the size of the PES payload in the packet. More... | |
void | reload (const void *addr, int size, QtsPid pid=QTS_PID_NULL) |
Reload full binary content. More... | |
void | reload (const QtlByteBlock &content, QtsPid pid=QTS_PID_NULL) |
Reload full binary content. More... | |
void | setDts (const quint64 &dts) |
Replace the DTS (Decoding Time Stamp) value - 33 bits. More... | |
void | setFirstTsPacketIndex (QtsPacketCounter i) |
Set the index of first TS packet of the PES packet in the demultiplexed stream. More... | |
void | setLastTsPacketIndex (QtsPacketCounter i) |
Set the index of last TS packet of the PES packet in the demultiplexed stream. More... | |
void | setPts (const quint64 &pts) |
Replace the PTS (Presentation Time Stamp) value - 33 bits. More... | |
void | setSourcePid (QtsPid pid) |
Set the PID from which the packet was collected (informational only). More... | |
void | setStreamId (QtsPesStreamId sid) |
Set the stream identifier of the PES packet. More... | |
int | size () const |
Get the size in bytes of the packet. More... | |
Private Member Functions | |
void | initialize (QtsPid pid) |
Helper for constructor. More... | |
void | initialize (const QtlByteBlock &bb, QtsPid pid) |
Helper for constructor. More... | |
Private Attributes | |
QtlByteBlock | _data |
Full binary content of the packet. More... | |
QtsPacketCounter | _firstPkt |
Index of first packet in stream. More... | |
int | _headerSize |
PES header size in bytes. More... | |
bool | _isValid |
Content of _data is a valid packet. More... | |
QtsPacketCounter | _lastPkt |
Index of last packet in stream. More... | |
QtsPid | _sourcePid |
Source PID (informational). More... | |
Basic definition of an MPEG-2 PES packet(Packetized Elementary Stream).
|
inline |
Default constructor.
The PES packet is initially marked invalid.
|
inline |
Constructor from full binary content.
The content is copied into the packet only if valid.
[in] | addr | Address of binary content. |
[in] | size | Size of binary content. |
[in] | pid | PID from which the PES packet was extracted (informational only). |
|
inline |
Constructor from full binary content.
The content is copied into the packet only if valid.
[in] | content | Binary content. |
[in] | pid | PID from which the PES packet was extracted (informational only). |
|
inline |
Reload full binary content.
The content is copied into the packet only if valid.
[in] | addr | Address of binary content. |
[in] | size | Size of binary content. |
[in] | pid | PID from which the PES packet was extracted (informational only). |
|
inline |
Reload full binary content.
The content is copied into the packet only if valid.
[in] | content | Binary content. |
[in] | pid | PID from which the PES packet was extracted (informational only). |
void QtsPesPacket::clear | ( | ) |
Clear packet content, becomes an invalid packet.
|
inline |
Check if a packet has valid content.
bool QtsPesPacket::operator== | ( | const QtsPesPacket & | other | ) | const |
Comparison operator.
The source PID are ignored, only the packet contents are compared. Note: Invalid packets are never identical
[in] | other | Other instance to compare. |
|
inline |
Difference operator.
The source PID are ignored, only the packet contents are compared. Note: Invalid packets are never identical
[in] | other | Other instance to compare. |
|
inline |
Get the PID from which the packet was collected (informational only).
|
inline |
Set the PID from which the packet was collected (informational only).
[in] | pid | The PID from which the packet was collected. |
|
inline |
Get the index of first TS packet of the PES packet in the demultiplexed stream.
|
inline |
Get the index of last TS packet of the PES packet in the demultiplexed stream.
|
inline |
Set the index of first TS packet of the PES packet in the demultiplexed stream.
[in] | i | The index of first TS packet of the PES packet. |
|
inline |
Set the index of last TS packet of the PES packet in the demultiplexed stream.
[in] | i | The index of last TS packet of the PES packet. |
|
inline |
Get the stream identifier of the PES packet.
|
inline |
Set the stream identifier of the PES packet.
[in] | sid | The stream identifier of the PES packet. |
|
inline |
Check if the packet has a long header.
|
inline |
Get a copy of the full binary content of the packet.
|
inline |
Get the size in bytes of the packet.
|
inline |
Get the address of the PES header in the packet.
Do not modify the content.
|
inline |
Get the size of the PES header in the packet.
|
inline |
Get the address of the PES payload in the packet.
Do not modify the content.
|
inline |
Get the size of the PES payload in the packet.
bool QtsPesPacket::isMpeg2Video | ( | ) | const |
Check if the PES packet contains MPEG-2 video (also applies to MPEG-1 video).
bool QtsPesPacket::isAvc | ( | ) | const |
Check if the PES packet contains AVC / H.264.
bool QtsPesPacket::isAc3 | ( | ) | const |
Check if the PES packet contains AC-3 or Enhanced-AC-3 audio.
Warning: As specified in ETSI TS 102 366, an AC-3 audio frame always starts with 0x0B77. This is what we check here. However, it is still possible that other encodings may start from time to time with 0x0B77. Thus, it is safe to say that a PID in which all PES packets start with 0x0B77(ie isAc3() returns true) contains AC-3. However, if only a few PES packets start with 0x0B77, it is safe to say that it should be something else.
bool QtsPesPacket::hasPts | ( | ) | const |
Check if the PES packet contains a PTS (Presentation Time Stamp).
quint64 QtsPesPacket::getPts | ( | ) | const |
Get the PTS (Presentation Time Stamp) - 33 bits.
void QtsPesPacket::setPts | ( | const quint64 & | pts | ) |
Replace the PTS (Presentation Time Stamp) value - 33 bits.
Do nothing if the packet has not PTS.
pts | PTS value to replace. |
bool QtsPesPacket::hasDts | ( | ) | const |
Check if the PES packet contains a DTS (Decoding Time Stamp).
quint64 QtsPesPacket::getDts | ( | ) | const |
Get the DTS (Decoding Time Stamp) - 33 bits.
void QtsPesPacket::setDts | ( | const quint64 & | dts | ) |
Replace the DTS (Decoding Time Stamp) value - 33 bits.
Do nothing if the packet has not DTS.
dts | DTS value to replace. |
|
private |
Helper for constructor.
[in] | pid | Source PID. |
|
private |
Helper for constructor.
[in] | bb | PES packet binary content. |
[in] | pid | Source PID. |
|
private |
Content of _data is a valid packet.
|
private |
PES header size in bytes.
|
private |
Source PID (informational).
|
private |
Index of first packet in stream.
|
private |
Index of last packet in stream.
|
private |
Full binary content of the packet.