TSDuck v3.46-4930
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

#include <tsPESPacket.h>

Inheritance diagram for ts::PESPacket:
Collaboration diagram for ts::PESPacket:

Public Types

using SuperClass = DemuxedData

Public Member Functions

 PESPacket (const ByteBlock &content, PID source_pid=PID_NULL)
 PESPacket (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL)
 PESPacket (const PESPacket &other, ShareMode mode)
 PESPacket (const void *content, size_t content_size, PID source_pid=PID_NULL)
 PESPacket (PESPacket &&other) noexcept
 PESPacket (PID source_pid=PID_NULL)
const UString & attribute () const
virtual void clear () override
virtual const uint8_t * content () const
DataBlock & copy (const DataBlock &other)
DemuxedData & copy (const DemuxedData &other)
PESPacket & copy (const PESPacket &other)
size_t findIntraImage () const
PacketCounter firstTSPacketIndex () const
CodecType getCodec () const
uint64_t getPCR () const
uint8_t getStreamId () const
uint8_t getStreamType () const
bool hasLongHeader () const
const uint8_t * header () const
size_t headerSize () const
bool isAC3 () const
bool isAVC () const
bool isHEVC () const
bool isMPEG2Video () const
virtual bool isValid () const override
bool isVVC () const
PacketCounter lastTSPacketIndex () const
bool matchContent (const ByteBlock &pattern, const ByteBlock &mask=ByteBlock()) const
PESPacket & operator= (const PESPacket &other)
PESPacket & operator= (PESPacket &&other) noexcept
bool operator== (const DataBlock &other) const
bool operator== (const DemuxedData &other) const
bool operator== (const PESPacket &other) const
const uint8_t * payload () const
size_t payloadSize () const
size_t rawDataSize () const
void reload (const ByteBlock &content)
void reload (const ByteBlockPtr &content_ptr)
void reload (const void *content, size_t content_size)
virtual void reload (const ByteBlock &content, PID source_pid=PID_NULL) override
virtual void reload (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL) override
virtual void reload (const void *content, size_t content_size, PID source_pid=PID_NULL) override
void setAttribute (const UString &attr)
void setCodec (CodecType codec)
void setDefaultCodec (CodecType default_codec)
void setFirstTSPacketIndex (PacketCounter i)
void setLastTSPacketIndex (PacketCounter i)
void setPCR (uint64_t pcr)
void setSourcePID (PID pid)
void setStreamId (uint8_t sid)
void setStreamType (uint8_t type)
virtual size_t size () const override
PID sourcePID () const
size_t spuriousDataSize () const

Static Public Member Functions

static size_t FindIntraImage (const uint8_t *data, size_t size, uint8_t stream_type=ST_NULL, CodecType default_format=CodecType::UNDEFINED)
static size_t GetLengthField (const void *content, size_t content_size)
static bool HasCommonVideoHeader (const uint8_t *data, size_t size)
static size_t HeaderSize (const uint8_t *data, size_t size)
static bool IsAC3 (const uint8_t *data, size_t size, uint8_t stream_type=ST_NULL)
static bool IsAVC (const uint8_t *data, size_t size, uint8_t stream_type=ST_NULL)
static bool IsHEVC (const uint8_t *data, size_t size, uint8_t stream_type=ST_NULL)
static bool IsMPEG2Video (const uint8_t *data, size_t size, uint8_t stream_type=ST_NULL)
static bool IsVVC (const uint8_t *data, size_t size, uint8_t stream_type=ST_NULL)
static bool ValidateLengthField (const void *content, size_t content_size, bool allow_extra_data)

Static Public Attributes

static constexpr size_t AFTER_LEN_BYTE_OFFSET = LEN_SIZE == 0 ? 0 : (LEN_OFFSET + LEN_SIZE + 7) / 8
static constexpr size_t LEN_BIT_OFFSET = LEN_SIZE == 0 ? 0 : LEN_OFFSET
static constexpr size_t LEN_BIT_SIZE = LEN_SIZE
static constexpr bool UNBOUNDED_IS_ALLOWED = UNBOUNDED_ALLOWED

Protected Member Functions

void rwAppend (const void *data, size_t dsize)
uint8_t * rwContent ()
void rwResize (size_t s)

Detailed Description

Representation of MPEG PES packets.

Member Typedef Documentation

◆ SuperClass

Explicit identification of super class.

Constructor & Destructor Documentation

◆ PESPacket() [1/6]

ts::PESPacket::PESPacket ( PID source_pid = PID_NULL)

Default constructor. The PESPacket is initially marked invalid.

Parameters
[in]source_pidPID from which the packet was read.

◆ PESPacket() [2/6]

ts::PESPacket::PESPacket ( const PESPacket & other,
ShareMode mode )

Copy constructor.

Parameters
[in]otherAnother instance to copy.
[in]modeThe packet's data are either shared (ShareMode::SHARE) between the two instances or duplicated (ShareMode::COPY).

◆ PESPacket() [3/6]

ts::PESPacket::PESPacket ( PESPacket && other)
noexcept

Move constructor.

Parameters
[in,out]otherAnother instance to move.

◆ PESPacket() [4/6]

ts::PESPacket::PESPacket ( const void * content,
size_t content_size,
PID source_pid = PID_NULL )

Constructor from full binary content. The content is copied into the packet if valid.

Parameters
[in]contentAddress of the binary packet data.
[in]content_sizeSize in bytes of the packet.
[in]source_pidPID from which the packet was read.

◆ PESPacket() [5/6]

ts::PESPacket::PESPacket ( const ByteBlock & content,
PID source_pid = PID_NULL )

Constructor from full binary content. The content is copied into the packet if valid.

Parameters
[in]contentBinary packet data.
[in]source_pidPID from which the packet was read.

◆ PESPacket() [6/6]

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.

Parameters
[in]content_ptrSafe pointer to the binary packet data. The content is referenced, and thus shared. Do not modify the referenced ByteBlock from outside the PESPacket.
[in]source_pidPID from which the packet was read.

Member Function Documentation

◆ clear()

virtual void ts::PESPacket::clear ( )
overridevirtual

Clear data content.

Reimplemented from ts::DemuxedData.

◆ reload() [1/6]

virtual void ts::PESPacket::reload ( const void * content,
size_t content_size,
PID source_pid = PID_NULL )
overridevirtual

Reload from full binary content.

Parameters
[in]contentAddress of the binary packet data.
[in]content_sizeSize in bytes of the packet.
[in]source_pidPID from which the data were read.

Reimplemented from ts::DemuxedData.

◆ reload() [2/6]

virtual void ts::PESPacket::reload ( const ByteBlock & content,
PID source_pid = PID_NULL )
overridevirtual

Reload from full binary content.

Parameters
[in]contentBinary packet data.
[in]source_pidPID from which the data were read.

Reimplemented from ts::DemuxedData.

◆ reload() [3/6]

virtual void ts::PESPacket::reload ( const ByteBlockPtr & content_ptr,
PID source_pid = PID_NULL )
overridevirtual

Reload from full binary content.

Parameters
[in]content_ptrSafe pointer to the binary packet data. The content is referenced, and thus shared. Do not modify the referenced ByteBlock from outside the DemuxedData.
[in]source_pidPID from which the data were read.

Reimplemented from ts::DemuxedData.

◆ size()

virtual size_t ts::PESPacket::size ( ) const
overridevirtual

Size of the logical binary content of the data. For subclasses of DataBlock, this is the logical size of the data structure inside the DataBlock blob.

Returns
Size of the logical binary content of the data.
See also
rawDataSize()

Reimplemented from ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >.

◆ operator=() [1/2]

PESPacket & ts::PESPacket::operator= ( const PESPacket & other)

Assignment operator. The packets are referenced, and thus shared between the two packet objects.

Parameters
[in]otherOther packet to assign to this object.
Returns
A reference to this object.

◆ operator=() [2/2]

PESPacket & ts::PESPacket::operator= ( PESPacket && other)
noexcept

Move assignment operator.

Parameters
[in,out]otherOther packet to assign to this object.
Returns
A reference to this object.

◆ copy() [1/3]

PESPacket & ts::PESPacket::copy ( const PESPacket & other)

Duplication. Similar to assignment but the packets are duplicated.

Parameters
[in]otherOther packet to duplicate into this object.
Returns
A reference to this object.

◆ isValid()

virtual bool ts::PESPacket::isValid ( ) const
overridevirtual

Check if the packet has valid content.

Returns
True if the packet has valid content.

Reimplemented from ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >.

◆ operator==() [1/3]

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.

Parameters
[in]otherOther packet to compare.
Returns
True if the two packets are identical. False otherwise.

◆ getPCR()

uint64_t ts::PESPacket::getPCR ( ) const
inline

Get the optional PCR value which was associated to the PES packets. It was typically extracted from the first TS packet of the PES packet.

Returns
The 42-bit PCR or INVALID_PCR if there is none.

◆ setPCR()

void ts::PESPacket::setPCR ( uint64_t pcr)

Set the PCR value for this PES packet.

Parameters
[in]pcrThe new 42-bit PCR value. Specify INVALID_PCR to clear the PCR.

◆ getStreamType()

uint8_t ts::PESPacket::getStreamType ( ) const
inline

Get the stream type, as specified in the PMT (optional).

Returns
The stream type.

◆ setStreamType()

void ts::PESPacket::setStreamType ( uint8_t type)
inline

Set the stream type, as specified in the PMT.

Parameters
[in]typeThe stream type.

◆ getCodec()

CodecType ts::PESPacket::getCodec ( ) const
inline

Get the codec type, as specified by the user (optional).

Returns
The codec type.

◆ setCodec()

void ts::PESPacket::setCodec ( CodecType codec)
inline

Set the codec type (informational only).

Parameters
[in]codecThe codec type.

◆ setDefaultCodec()

void ts::PESPacket::setDefaultCodec ( CodecType default_codec)

Set a default codec type. If the codec is not already known and if the data in the PES packet looks compatible with codec, then this codec type is set.

Parameters
[in]default_codecThe default codec type.

◆ getStreamId()

uint8_t ts::PESPacket::getStreamId ( ) const

Stream id of the PES packet.

Returns
The stream id of the PES packet.

◆ setStreamId()

void ts::PESPacket::setStreamId ( uint8_t sid)

Set the stream id of the PES packet.

Parameters
[in]sidThe stream id of the PES packet.

◆ hasLongHeader()

bool ts::PESPacket::hasLongHeader ( ) const

Check if the packet has a long header.

Returns
True if the packet has a long header.

◆ header()

const uint8_t * ts::PESPacket::header ( ) const
inline

Access to the PES header of the packet.

Returns
Address of the PES header of the packet.

◆ headerSize()

size_t ts::PESPacket::headerSize ( ) const
inline

Size of the PES header of the packet.

Returns
Size of the PES header of the packet.

◆ payload()

const uint8_t * ts::PESPacket::payload ( ) const
inline

Access to the payload of the packet.

Returns
Address of the payload of the packet.

◆ payloadSize()

size_t ts::PESPacket::payloadSize ( ) const
inline

Size of the payload of the packet.

Returns
Size of the payload of the packet.

◆ spuriousDataSize()

size_t ts::PESPacket::spuriousDataSize ( ) const
inline

Number of spurious data bytes after the packet.

Returns
Size of the spurious data bytes after the packet.

◆ isMPEG2Video()

bool ts::PESPacket::isMPEG2Video ( ) const

Check if the PES packet contains MPEG-2 video. Also applies to MPEG-1 video.

Returns
True if the PES packet contains MPEG-2 video.

◆ isAVC()

bool ts::PESPacket::isAVC ( ) const

Check if the PES packet contains AVC / H.264 video.

Returns
True if the PES packet contains AVC / H.264 video.

◆ isHEVC()

bool ts::PESPacket::isHEVC ( ) const

Check if the PES packet contains HEVC / H.265 video.

Returns
True if the PES packet contains HEVC / H.265 video.

◆ isVVC()

bool ts::PESPacket::isVVC ( ) const

Check if the PES packet contains VVC / H.266 video.

Returns
True if the PES packet contains VVC / H.266 video.

◆ isAC3()

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.

Returns
True if the PES packet contains AC-3 or Enhanced-AC-3 audio.

◆ findIntraImage()

size_t ts::PESPacket::findIntraImage ( ) const

Check if the PES packet contains an intra-coded image. The stream type and/or codec type must have been set.

Returns
If the PES packet contains the start of an intra-coded image, return the offset inside the PES packet where the intra-image starts. This value is informational only, the exact semantics depends on the video codec. Return NPOS if no intra-image was found.

◆ HeaderSize()

size_t ts::PESPacket::HeaderSize ( const uint8_t * data,
size_t size )
static

Get the header size of the start of a PES packet.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
Returns
The PES header size in bytes, if one is found, or 0 on error.

◆ IsMPEG2Video()

bool ts::PESPacket::IsMPEG2Video ( const uint8_t * data,
size_t size,
uint8_t stream_type = ST_NULL )
static

Check if a truncated PES packet may contain MPEG-2 or MPEG-1 video.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
[in]stream_typeOptional stream type, as found in the PMT. Used as a hint.
Returns
True if the PES data may contain MPEG-2 or MPEG-1 video.

◆ IsAVC()

bool ts::PESPacket::IsAVC ( const uint8_t * data,
size_t size,
uint8_t stream_type = ST_NULL )
inlinestatic

Check if a truncated PES packet may contain AVC / H.264 video.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
[in]stream_typeOptional stream type, as found in the PMT. Used as a hint.
Returns
True if the PES data may contain AVC / H.264 video.

◆ IsHEVC()

bool ts::PESPacket::IsHEVC ( const uint8_t * data,
size_t size,
uint8_t stream_type = ST_NULL )
inlinestatic

Check if a truncated PES packet may contain HEVC / H.265 video.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
[in]stream_typeOptional stream type, as found in the PMT. Used as a hint.
Returns
True if the PES data may contain HEVC / H.265 video.

◆ IsVVC()

bool ts::PESPacket::IsVVC ( const uint8_t * data,
size_t size,
uint8_t stream_type = ST_NULL )
inlinestatic

Check if a truncated PES packet may contain VVC / H.266 video.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
[in]stream_typeOptional stream type, as found in the PMT. Used as a hint.
Returns
True if the PES data may contain VVC / H.266 video.

◆ IsAC3()

bool ts::PESPacket::IsAC3 ( const uint8_t * data,
size_t size,
uint8_t stream_type = ST_NULL )
static

Check if a truncated PES packet may contain AC-3 or Enhanced-AC-3 audio.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
[in]stream_typeOptional stream type, as found in the PMT. Used as a hint.
Returns
True if the PES data may contain AC-3 or Enhanced-AC-3 audio.

◆ HasCommonVideoHeader()

bool ts::PESPacket::HasCommonVideoHeader ( const uint8_t * data,
size_t size )
static

Check if a truncated PES packet starts with 00 00 00 [00...] 01, common header for AVC, HEVC and VVC.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
Returns
True if the PES data starts with a common header.

◆ FindIntraImage()

size_t ts::PESPacket::FindIntraImage ( const uint8_t * data,
size_t size,
uint8_t stream_type = ST_NULL,
CodecType default_format = CodecType::UNDEFINED )
static

Check if a truncated PES packet may contain the start of an intra-coded image.

Parameters
[in]dataAddress of data to check, typically the start of a PES packet.
[in]sizeData size in bytes.
[in]stream_typeOptional stream type, as found in the PMT. Used as a hint.
[in]default_formatDefault encoding format if it cannot be determined from stream_type. If stream_type and default_format are both unspecified, intra-image cannot be detected.
Returns
If the PES data may contain the start of an intra-coded image, return the offset inside data where the intra-image starts. This value is informational only, the exact semantics depends on the video codec. Return NPOS if no intra-image was found. If the data is not sufficient to determine the presence of an intra-image, return NPOS, even though a larger piece of information may contain one.

◆ reload() [4/6]

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
void ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::reload ( const void * content,
size_t content_size )
inherited

Reload from full binary content.

Parameters
[in]contentAddress of the binary packet data.
[in]content_sizeSize in bytes of the packet.

◆ reload() [5/6]

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
void ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::reload ( const ByteBlock & content)
inherited

Reload from full binary content.

Parameters
[in]contentBinary packet data. The content is copied into a new byte block.

◆ reload() [6/6]

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
void ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::reload ( const ByteBlockPtr & content_ptr)
inherited

Reload from full binary content.

Parameters
[in]content_ptrSafe pointer to the binary packet data. The content is referenced, and thus shared. Do not modify the referenced ByteBlock from outside the DataBlock.

◆ copy() [2/3]

DemuxedData & ts::DemuxedData::copy ( const DemuxedData & other)
inherited

Duplication. Similar to assignment but the data are duplicated.

Parameters
[in]otherOther data to duplicate into this object.
Returns
A reference to this object.

◆ copy() [3/3]

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
DataBlock & ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::copy ( const DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED > & other)
inherited

Duplication. Similar to assignment but the data are duplicated.

Parameters
[in]otherOther data to duplicate into this object.
Returns
A reference to this object.

◆ operator==() [2/3]

bool ts::DemuxedData::operator== ( const DemuxedData & other) const
inherited

Equality operator. The source PID's are ignored, only the data contents are compared.

Parameters
[in]otherOther packet to compare.
Returns
True if the two packets are identical. False otherwise.

◆ operator==() [3/3]

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
bool ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::operator== ( const DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED > & other) const
inherited

Equality operator. The source PID's are ignored, only the data contents are compared.

Parameters
[in]otherOther packet to compare.
Returns
True if the two packets are identical. False otherwise.

◆ sourcePID()

PID ts::DemuxedData::sourcePID ( ) const
inlineinherited

Get the source PID.

Returns
The source PID.

◆ setSourcePID()

void ts::DemuxedData::setSourcePID ( PID pid)
inlineinherited

Set the source PID.

Parameters
[in]pidThe source PID.

◆ firstTSPacketIndex()

PacketCounter ts::DemuxedData::firstTSPacketIndex ( ) const
inlineinherited

Index of first TS packet of the data in the demultiplexed stream. Usually valid only if the data were extracted by a demux.

Returns
The first TS packet of the data in the demultiplexed stream.

◆ lastTSPacketIndex()

PacketCounter ts::DemuxedData::lastTSPacketIndex ( ) const
inlineinherited

Index of last TS packet of the data in the demultiplexed stream. Usually valid only if the data were extracted by a demux.

Returns
The last TS packet of the data in the demultiplexed stream.

◆ setFirstTSPacketIndex()

void ts::DemuxedData::setFirstTSPacketIndex ( PacketCounter i)
inlineinherited

Set the first TS packet of the data in the demultiplexed stream.

Parameters
[in]iThe first TS packet of the data in the demultiplexed stream.

◆ setLastTSPacketIndex()

void ts::DemuxedData::setLastTSPacketIndex ( PacketCounter i)
inlineinherited

Set the last TS packet of the data in the demultiplexed stream.

Parameters
[in]iThe last TS packet of the data in the demultiplexed stream.

◆ setAttribute()

void ts::DemuxedData::setAttribute ( const UString & attr)
inlineinherited

Set a generic user-defined string as "attribute" of the object. The semantics of this attribute string is not defined. It is used by the application. The attribute string can be found in the <metadata> structure of the XML representation of a table.

Parameters
[in]attrGeneric string to set as attribute.

◆ attribute()

const UString & ts::DemuxedData::attribute ( ) const
inlineinherited

Get the generic user-defined "attribute" string of the object.

Returns
A constant reference to the attribute string in the object.
See also
setAttribute()

◆ content()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
virtual const uint8_t * ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::content ( ) const
virtualinherited

Access to the full binary content of the data. Do not modify content.

Returns
Address of the full binary content of the data. May be invalidated after modification.

◆ rawDataSize()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
size_t ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::rawDataSize ( ) const
inlineinherited

Size of the complete binary raw data containing the logical structure. Non-virtual method, always return the same result.

Returns
Size of the complete binary raw data.
See also
size()

◆ matchContent()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
bool ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::matchContent ( const ByteBlock & pattern,
const ByteBlock & mask = ByteBlock() ) const
inherited

Check if the start of the data matches a given pattern.

Parameters
[in]patternA byte block to compare with the start of the data.
[in]maskOptional mask to select meaningful bits in pattern.
Returns
Size of the binary content of the data.

◆ GetLengthField()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
size_t ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::GetLengthField ( const void * content,
size_t content_size )
staticinherited

Static method to extract the content of the length field.

Parameters
[in]contentAddress of the binary data. Can be the null pointer.
[in]content_sizeSize in bytes of the data.
Returns
The extracted length field or NPOS if the data structure does not contain a length field or if the length is "unbounded" (when allowed).

◆ ValidateLengthField()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
bool ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::ValidateLengthField ( const void * content,
size_t content_size,
bool allow_extra_data )
staticinherited

Static method to validate the content of the length field.

Parameters
[in]contentAddress of the binary data. Can be the null pointer.
[in]content_sizeSize in bytes of the data.
[in]allow_extra_dataIf true, additional data are allowed after the declared length.
Returns
True if the length field is valid, or the length field does not exist, or the length field is "unbounded" (when allowed).

◆ rwContent()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
uint8_t * ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::rwContent ( )
inlineprotectedinherited

Read/write access to the full binary content of the data for subclasses.

Returns
Address of the full binary content of the data.

◆ rwResize()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
void ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::rwResize ( size_t s)
protectedinherited

Resize the full binary content of the data for subclasses.

Parameters
[in]sNew size in bytes of the full binary content of the data.

◆ rwAppend()

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
void ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::rwAppend ( const void * data,
size_t dsize )
protectedinherited

Append raw data to the full binary content of the data for subclasses.

Parameters
[in]dataAddress of the new area to append.
[in]dsizeSize of the area to append.

Member Data Documentation

◆ LEN_BIT_OFFSET

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
size_t ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::LEN_BIT_OFFSET = LEN_SIZE == 0 ? 0 : LEN_OFFSET
staticconstexprinherited

Offset in bits of the length field from the beginning of the structure.

◆ LEN_BIT_SIZE

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
size_t ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::LEN_BIT_SIZE = LEN_SIZE
staticconstexprinherited

Size in bits of the length field. If zero, there is no length field.

◆ AFTER_LEN_BYTE_OFFSET

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
size_t ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::AFTER_LEN_BYTE_OFFSET = LEN_SIZE == 0 ? 0 : (LEN_OFFSET + LEN_SIZE + 7) / 8
staticconstexprinherited

Offset in bytes of the next byte after the length field. Zero if there is no length field.

◆ UNBOUNDED_IS_ALLOWED

template<const size_t LEN_OFFSET = 0, const size_t LEN_SIZE = 0, const bool UNBOUNDED_ALLOWED = false>
bool ts::DataBlock< LEN_OFFSET, LEN_SIZE, UNBOUNDED_ALLOWED >::UNBOUNDED_IS_ALLOWED = UNBOUNDED_ALLOWED
staticconstexprinherited

If true, the length field allows zero as an "unbounded" value.


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