Representation of MPEG PES packets. More...
Public Member Functions | |
PESPacket (PID source_pid=PID_NULL) | |
Default constructor. More... | |
PESPacket (const PESPacket &other, CopyShare mode) | |
Copy constructor. More... | |
PESPacket (const void *content, size_t content_size, PID source_pid=PID_NULL) | |
Constructor from full binary content. More... | |
PESPacket (const ByteBlock &content, PID source_pid=PID_NULL) | |
Constructor from full binary content. More... | |
PESPacket (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL) | |
Constructor from full binary content. More... | |
void | clear () |
Clear packet content. More... | |
const uint8_t * | content () const |
Access to the full binary content of the packet. More... | |
PESPacket & | copy (const PESPacket &other) |
Duplication. More... | |
PacketCounter | getFirstTSPacketIndex () const |
Index of first TS packet of the PES packet in the demultiplexed stream. More... | |
PacketCounter | getLastTSPacketIndex () const |
Index of last TS packet of the PES packet in the demultiplexed stream. More... | |
PID | getSourcePID () const |
Get the source PID. More... | |
uint8_t | getStreamId () const |
Stream id of the PES packet. More... | |
uint8_t | getStreamType () const |
Get the stream type, as specified in the PMT (optional). More... | |
bool | hasLongHeader () const |
Check if the packet has a long header. More... | |
const uint8_t * | header () const |
Access to the PES header of the packet. More... | |
size_t | headerSize () const |
Size of the PES header of 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 video. More... | |
bool | isMPEG2Video () const |
Check if the PES packet contains MPEG-2 video. More... | |
bool | isValid () const |
Check if the packet has valid content. More... | |
bool | operator!= (const PESPacket &other) const |
Unequality operator. More... | |
PESPacket & | operator= (const PESPacket &other) |
Assignment operator. More... | |
bool | operator== (const PESPacket &other) const |
Equality operator. More... | |
const uint8_t * | payload () const |
Access to the payload of the packet. More... | |
size_t | payloadSize () const |
Size of the payload of the packet. More... | |
void | reload (const void *content, size_t content_size, PID source_pid=PID_NULL) |
Reload from full binary content. More... | |
void | reload (const ByteBlock &content, PID source_pid=PID_NULL) |
Reload from full binary content. More... | |
void | reload (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL) |
Reload from full binary content. More... | |
void | setFirstTSPacketIndex (PacketCounter i) |
Set the first TS packet of the PES packet in the demultiplexed stream. More... | |
void | setLastTSPacketIndex (PacketCounter i) |
Set the last TS packet of the PES packet in the demultiplexed stream. More... | |
void | setSourcePID (PID pid) |
Set the source PID. More... | |
void | setStreamId (uint8_t sid) |
Set the stream id of the PES packet. More... | |
void | setStreamType (uint8_t type) |
Set the stream type, as specified in the PMT. More... | |
size_t | size () const |
Size of the binary content of the packet. More... | |
Representation of MPEG PES packets.
Default constructor.
The PESPacket is initially marked invalid.
[in] | source_pid | PID from which the packet was read. |
Constructor from full binary content.
The content is copied into the packet if valid.
[in] | content | Address of the binary packet data. |
[in] | content_size | Size in bytes of the packet. |
[in] | source_pid | PID from which the packet was read. |
Constructor from full binary content.
The content is copied into the packet if valid.
[in] | content | Binary packet data. |
[in] | source_pid | PID from which the packet was read. |
ts::PESPacket::PESPacket | ( | const ByteBlockPtr & | content_ptr, |
PID | source_pid = PID_NULL |
||
) |
Constructor from full binary content.
The content is copied into the packet if valid.
|
inline |
Reload from full binary content.
The content is copied into the packet if valid.
[in] | content | Address of the binary packet data. |
[in] | content_size | Size in bytes of the packet. |
[in] | source_pid | PID from which the packet was read. |
Reload from full binary content.
The content is copied into the packet if valid.
[in] | content | Binary packet data. |
[in] | source_pid | PID from which the packet was read. |
|
inline |
Reload from full binary content.
The content is copied into the packet if valid.
void ts::PESPacket::clear | ( | ) |
Clear packet content.
Becomes an invalid packet.
Assignment operator.
The packets are referenced, and thus shared between the two packet objects.
[in] | other | Other packet to assign to this object. |
Duplication.
Similar to assignment but the packets are duplicated.
[in] | other | Other packet to duplicate into this object. |
|
inline |
Check if the packet has valid content.
bool ts::PESPacket::operator== | ( | const PESPacket & | other | ) | const |
Equality operator.
The source PID's are ignored, only the packet contents are compared. Invalid packets are never identical.
[in] | other | Other packet to compare. |
|
inline |
Unequality operator.
The source PID's are ignored, only the packet contents are compared. Invalid packets are never identical.
[in] | other | Other packet to compare. |
|
inline |
Get the source PID.
|
inline |
Set the source PID.
[in] | pid | The source PID. |
|
inline |
Get the stream type, as specified in the PMT (optional).
|
inline |
Set the stream type, as specified in the PMT.
[in] | type | The stream type. |
|
inline |
Index of first TS packet of the PES packet in the demultiplexed stream.
Usually valid only if the PES packet was extracted by a PES demux.
|
inline |
Index of last TS packet of the PES packet in the demultiplexed stream.
Usually valid only if the PES packet was extracted by a PES demux.
|
inline |
Set the first TS packet of the PES packet in the demultiplexed stream.
[in] | i | The first TS packet of the PES packet in the demultiplexed stream. |
|
inline |
Set the last TS packet of the PES packet in the demultiplexed stream.
[in] | i | The last TS packet of the PES packet in the demultiplexed stream. |
|
inline |
Stream id of the PES packet.
|
inline |
Set the stream id of the PES packet.
[in] | sid | The stream id of the PES packet. |
|
inline |
Check if the packet has a long header.
|
inline |
Access to the full binary content of the packet.
Do not modify content.
|
inline |
Size of the binary content of the packet.
|
inline |
Access to the PES header of the packet.
|
inline |
Size of the PES header of the packet.
|
inline |
Access to the payload of the packet.
|
inline |
Size of the payload of the packet.
bool ts::PESPacket::isMPEG2Video | ( | ) | const |
Check if the PES packet contains MPEG-2 video.
Also applies to MPEG-1 video.
bool ts::PESPacket::isAVC | ( | ) | const |
Check if the PES packet contains AVC / H.264 video.
bool ts::PESPacket::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.