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

#include <tsT2MIPacket.h>

Inheritance diagram for ts::T2MIPacket:
Collaboration diagram for ts::T2MIPacket:

Public Types

using SuperClass = DemuxedData

Public Member Functions

 T2MIPacket ()=default
 T2MIPacket (const ByteBlock &content, PID source_pid=PID_NULL)
 T2MIPacket (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL)
 T2MIPacket (const T2MIPacket &other, ShareMode mode)
 T2MIPacket (const void *content, size_t content_size, PID source_pid=PID_NULL)
 T2MIPacket (T2MIPacket &&other) noexcept
const UString & attribute () const
const uint8_t * basebandFrame () const
size_t basebandFrameSize () const
virtual void clear () override
virtual const uint8_t * content () const
DataBlock & copy (const DataBlock &other)
DemuxedData & copy (const DemuxedData &other)
T2MIPacket & copy (const T2MIPacket &other)
uint8_t fefIndex () const
bool fefIndexValid () const
PacketCounter firstTSPacketIndex () const
uint8_t frameIndex () const
bool frameIndexValid () const
bool interleavingFrameStart () const
virtual bool isValid () const override
PacketCounter lastTSPacketIndex () const
bool matchContent (const ByteBlock &pattern, const ByteBlock &mask=ByteBlock()) const
T2MIPacket & operator= (const T2MIPacket &other)
T2MIPacket & operator= (T2MIPacket &&other) noexcept
bool operator== (const DataBlock &other) const
bool operator== (const DemuxedData &other) const
bool operator== (const T2MIPacket &other) const
uint8_t packetCount () const
T2MIPacketType packetType () const
const uint8_t * payload () const
size_t payloadSize () const
size_t payloadSizeInBits () const
uint8_t plp () const
bool plpValid () 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 setFirstTSPacketIndex (PacketCounter i)
void setLastTSPacketIndex (PacketCounter i)
void setSourcePID (PID pid)
virtual size_t size () const
PID sourcePID () const
uint8_t superframeIndex () const

Static Public Member Functions

static size_t GetLengthField (const void *content, size_t content_size)
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 a DVB T2-MI (DVB-T2 Modulator Interface) packet.

See also
ETSI TS 102 773 V1.4.1, section 5.1

Member Typedef Documentation

◆ SuperClass

Explicit identification of super class.

Constructor & Destructor Documentation

◆ T2MIPacket() [1/6]

ts::T2MIPacket::T2MIPacket ( )
default

Default constructor. The T2MIPacket is initially marked invalid.

◆ T2MIPacket() [2/6]

ts::T2MIPacket::T2MIPacket ( const T2MIPacket & 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).

◆ T2MIPacket() [3/6]

ts::T2MIPacket::T2MIPacket ( T2MIPacket && other)
noexcept

Move constructor.

Parameters
[in,out]otherAnother instance to move.

◆ T2MIPacket() [4/6]

ts::T2MIPacket::T2MIPacket ( 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.

◆ T2MIPacket() [5/6]

ts::T2MIPacket::T2MIPacket ( 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.

◆ T2MIPacket() [6/6]

ts::T2MIPacket::T2MIPacket ( 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 T2MIPacket.
[in]source_pidPID from which the packet was read.

Member Function Documentation

◆ clear()

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

Clear data content.

Reimplemented from ts::DemuxedData.

◆ reload() [1/6]

virtual void ts::T2MIPacket::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::T2MIPacket::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::T2MIPacket::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.

◆ operator=() [1/2]

T2MIPacket & ts::T2MIPacket::operator= ( const T2MIPacket & 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]

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

Move assignment operator.

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

◆ copy() [1/3]

T2MIPacket & ts::T2MIPacket::copy ( const T2MIPacket & 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::T2MIPacket::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::T2MIPacket::operator== ( const T2MIPacket & 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.

◆ payload()

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

Access to the payload of the packet.

Returns
Address of the payload of the packet.

◆ payloadSizeInBits()

size_t ts::T2MIPacket::payloadSizeInBits ( ) const
inline

Size of the payload of the packet in bits. A T2-MI packet may stop in the middle of a byte. The payload size in bytes is rounded to the next byte.

Returns
Size of the payload of the packet in bits.

◆ payloadSize()

size_t ts::T2MIPacket::payloadSize ( ) const

Size of the payload of the packet in bytes.

Returns
Size of the payload of the packet in bytes.

◆ packetType()

T2MIPacketType ts::T2MIPacket::packetType ( ) const
inline

Get the T2-MI packet type.

Returns
The T2-MI packet type or T2MI_INVALID_TYPE if the packet is invalid.

◆ packetCount()

uint8_t ts::T2MIPacket::packetCount ( ) const
inline

Get the T2-MI packet count (from the packet header).

Returns
The T2-MI packet count.

◆ superframeIndex()

uint8_t ts::T2MIPacket::superframeIndex ( ) const
inline

Get the T2-MI superframe index (from the packet header).

Returns
The T2-MI superframe index (4 bits).

◆ frameIndexValid()

bool ts::T2MIPacket::frameIndexValid ( ) const

Check if the packet has a frame index (frame_idx). This is the case of the packet types whose payload starts with frame_idx (see ETSI TS 102 773, section 5.2).

Returns
True if the packet has a frame index.

◆ frameIndex()

uint8_t ts::T2MIPacket::frameIndex ( ) const
inline

Get the T2-MI frame index. This is valid only for some packet types (see ETSI TS 102 773, section 5.2).

Returns
The T2-MI frame index or zero if the packet has no frame index.
See also
frameIndexValid()

◆ fefIndexValid()

bool ts::T2MIPacket::fefIndexValid ( ) const

Check if the packet has a FEF part index (fef_idx). This is the case of the FEF part and FEF sub-part packet types (see ETSI TS 102 773, sections 5.2.9 to 5.2.12).

Returns
True if the packet has a FEF part index.

◆ fefIndex()

uint8_t ts::T2MIPacket::fefIndex ( ) const
inline

Get the T2-MI FEF part index. This is valid only for FEF part and FEF sub-part packets.

Returns
The FEF part index or zero if the packet has no FEF part index.
See also
fefIndexValid()

◆ plpValid()

bool ts::T2MIPacket::plpValid ( ) const
inline

Check if the packet has a valid PLP (Physical Layer Pipe) identifier.

Returns
True if the packet has a valid PLP.

◆ plp()

uint8_t ts::T2MIPacket::plp ( ) const
inline

Get the PLP (Physical Layer Pipe) identifier. This is valid only for baseband frames (packet type T2MI_BASEBAND_FRAME).

Returns
The PLP identifier.

◆ interleavingFrameStart()

bool ts::T2MIPacket::interleavingFrameStart ( ) const

Get the interleaving frame start flag. This is valid only for baseband frames (packet type T2MI_BASEBAND_FRAME).

Returns
True if the T2-MI packet contains the first baseband frame of an interleaving frame for a particular PLP.

◆ basebandFrame()

const uint8_t * ts::T2MIPacket::basebandFrame ( ) const

Access to the baseband frame inside the packet. This is valid only for baseband frames (packet type T2MI_BASEBAND_FRAME).

Returns
Address of the baseband frame in the packet or zero if invalid.

◆ basebandFrameSize()

size_t ts::T2MIPacket::basebandFrameSize ( ) const

Size of the baseband frame in bytes. This is valid only for baseband frames (packet type T2MI_BASEBAND_FRAME).

Returns
Size of the baseband frame in bytes.

◆ 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.

◆ size()

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

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 in ts::PESPacket.

◆ 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: