TSDuck Version 3.32-2769 (TSDuck - The MPEG Transport Stream Toolkit)
ts::DemuxedData Class Reference

Base class for all kinds of demuxed data. More...

Inheritance diagram for ts::DemuxedData:

Public Member Functions

 DemuxedData (const ByteBlock &content, PID source_pid=PID_NULL)
 Constructor from full binary content. More...
 
 DemuxedData (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL)
 Constructor from full binary content. More...
 
 DemuxedData (const DemuxedData &other, ShareMode mode)
 Copy constructor. More...
 
 DemuxedData (const void *content, size_t content_size, PID source_pid=PID_NULL)
 Constructor from full binary content. More...
 
 DemuxedData (DemuxedData &&other) noexcept
 Move constructor. More...
 
 DemuxedData (PID source_pid=PID_NULL)
 Default constructor. More...
 
virtual ~DemuxedData ()
 Virtual destructor.
 
virtual void clear ()
 Clear data content.
 
virtual const uint8_t * content () const
 Access to the full binary content of the data. More...
 
DemuxedDatacopy (const DemuxedData &other)
 Duplication. More...
 
PacketCounter firstTSPacketIndex () const
 Index of first TS packet of the data in the demultiplexed stream. More...
 
PacketCounter lastTSPacketIndex () const
 Index of last TS packet of the data in the demultiplexed stream. More...
 
bool matchContent (const ByteBlock &pattern, const ByteBlock &mask=ByteBlock()) const
 Check if the start of the data matches a given pattern. More...
 
bool operator!= (const DemuxedData &other) const
 Unequality operator. More...
 
DemuxedDataoperator= (const DemuxedData &other)
 Assignment operator. More...
 
DemuxedDataoperator= (DemuxedData &&other) noexcept
 Move assignment operator. More...
 
bool operator== (const DemuxedData &other) const
 Equality operator. More...
 
virtual void reload (const ByteBlock &content, PID source_pid=PID_NULL)
 Reload from full binary content. More...
 
virtual void reload (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL)
 Reload from full binary content. More...
 
virtual void reload (const void *content, size_t content_size, PID source_pid=PID_NULL)
 Reload from full binary content. More...
 
void setFirstTSPacketIndex (PacketCounter i)
 Set the first TS packet of the data in the demultiplexed stream. More...
 
void setLastTSPacketIndex (PacketCounter i)
 Set the last TS packet of the data in the demultiplexed stream. More...
 
void setSourcePID (PID pid)
 Set the source PID. More...
 
virtual size_t size () const
 Size of the binary content of the data. More...
 
PID sourcePID () const
 Get the source PID. More...
 

Protected Member Functions

void rwAppend (const void *data, size_t dsize)
 Append raw data to the full binary content of the data for subclasses. More...
 
uint8_t * rwContent ()
 Read/write access to the full binary content of the data for subclasses. More...
 
void rwResize (size_t s)
 Resize the full binary content of the data for subclasses. More...
 

Detailed Description

Base class for all kinds of demuxed data.

Constructor & Destructor Documentation

◆ DemuxedData() [1/6]

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

Default constructor.

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

◆ DemuxedData() [2/6]

ts::DemuxedData::DemuxedData ( const DemuxedData other,
ShareMode  mode 
)

Copy constructor.

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

◆ DemuxedData() [3/6]

ts::DemuxedData::DemuxedData ( DemuxedData &&  other)
noexcept

Move constructor.

Parameters
[in,out]otherAnother instance to move.

◆ DemuxedData() [4/6]

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

Constructor from full binary content.

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

◆ DemuxedData() [5/6]

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

Constructor from full binary content.

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

◆ DemuxedData() [6/6]

ts::DemuxedData::DemuxedData ( const ByteBlockPtr content_ptr,
PID  source_pid = PID_NULL 
)

Constructor from full binary content.

Parameters
[in]content_ptrSafe pointer to the binary 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.

Member Function Documentation

◆ reload() [1/3]

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

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 in ts::T2MIPacket, ts::Section, and ts::PESPacket.

◆ reload() [2/3]

virtual void ts::DemuxedData::reload ( const ByteBlock content,
PID  source_pid = PID_NULL 
)
virtual

Reload from full binary content.

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

Reimplemented in ts::T2MIPacket, ts::Section, and ts::PESPacket.

◆ reload() [3/3]

virtual void ts::DemuxedData::reload ( const ByteBlockPtr content_ptr,
PID  source_pid = PID_NULL 
)
virtual

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 in ts::T2MIPacket, ts::Section, and ts::PESPacket.

◆ operator=() [1/2]

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

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

Move assignment operator.

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

◆ copy()

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

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==()

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

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!=()

bool ts::DemuxedData::operator!= ( const DemuxedData other) const
inline

Unequality operator.

The source PID's are ignored, only the packet contents are compared.

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

◆ sourcePID()

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

Get the source PID.

Returns
The source PID.

◆ setSourcePID()

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

Set the source PID.

Parameters
[in]pidThe source PID.

◆ firstTSPacketIndex()

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

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
inline

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)
inline

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)
inline

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.

◆ content()

virtual const uint8_t* ts::DemuxedData::content ( ) const
virtual

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()

virtual size_t ts::DemuxedData::size ( ) const
virtual

Size of the binary content of the data.

Returns
Size of the binary content of the data.

Reimplemented in ts::PESPacket.

◆ matchContent()

bool ts::DemuxedData::matchContent ( const ByteBlock pattern,
const ByteBlock mask = ByteBlock() 
) const

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.

◆ rwContent()

uint8_t* ts::DemuxedData::rwContent ( )
inlineprotected

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

Returns
Address of the full binary content of the data.

◆ rwResize()

void ts::DemuxedData::rwResize ( size_t  s)
protected

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()

void ts::DemuxedData::rwAppend ( const void *  data,
size_t  dsize 
)
protected

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.

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