TSDuck v3.40-3963
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::Section Class Reference

Representation of MPEG PSI/SI sections. More...

#include <tsSection.h>

Inheritance diagram for ts::Section:
Collaboration diagram for ts::Section:

Public Types

using SuperClass = DemuxedData
 Explicit identification of super class.
 

Public Member Functions

 Section ()=default
 Default constructor.
 
 Section (const ByteBlock &content, PID source_pid=PID_NULL, CRC32::Validation crc_op=CRC32::Validation::IGNORE)
 Constructor from full binary content.
 
 Section (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL, CRC32::Validation crc_op=CRC32::Validation::IGNORE)
 Constructor from full binary content.
 
 Section (const Section &other, ShareMode mode)
 Copy constructor.
 
 Section (const void *content, size_t content_size, PID source_pid=PID_NULL, CRC32::Validation crc_op=CRC32::Validation::IGNORE)
 Constructor from full binary content.
 
 Section (TID tid, bool is_private_section, const void *payload, size_t payload_size, PID source_pid=PID_NULL)
 Constructor from a short section payload.
 
 Section (TID tid, bool is_private_section, uint16_t tid_ext, uint8_t version, bool is_current, uint8_t section_number, uint8_t last_section_number, const void *payload, size_t payload_size, PID source_pid=PID_NULL)
 Constructor from a long section payload.
 
void appendPayload (const ByteBlock &data, bool recompute_crc=true)
 Append binary data to the payload of the section.
 
void appendPayload (const void *data, size_t size, bool recompute_crc=true)
 Append binary data to the payload of the section.
 
const UStringattribute () const
 Get the generic user-defined "attribute" string of the object.
 
virtual void clear () override
 Clear data content.
 
virtual const uint8_t * content () const
 Access to the full binary content of the data.
 
DemuxedDatacopy (const DemuxedData &other)
 Duplication.
 
Sectioncopy (const Section &other)
 Duplication.
 
virtual Standards definingStandards () const override
 Get the list of standards which define this object.
 
std::ostream & dump (std::ostream &strm, int indent=0, uint16_t cas=CASID_NULL, bool no_header=false) const
 Hexa dump the section on an output stream without interpretation of the payload.
 
ETID etid () const
 Get the table id and id extension (long section only).
 
PacketCounter firstTSPacketIndex () const
 Index of first TS packet of the data in the demultiplexed stream.
 
bool hasDiversifiedPayload () const
 Check if the section has a "diversified" payload.
 
ByteBlock hash () const
 Get a hash of the section content.
 
size_t headerSize () const
 Size of the section header.
 
bool isCurrent () const
 Check if the section is "current", not "next" (long section only).
 
bool isLongSection () const
 Check if the section is a long one.
 
bool isNext () const
 Check if the section is "next", not "current" (long section only).
 
bool isPrivateSection () const
 Check if the section is a private one (ie.
 
bool isShortSection () const
 Check if the section is a short one.
 
bool isValid () const
 Check if the section has valid content.
 
uint8_t lastSectionNumber () const
 Get the number of the last section in the table (long section only).
 
PacketCounter lastTSPacketIndex () const
 Index of last TS packet of the data in the demultiplexed stream.
 
bool matchContent (const ByteBlock &pattern, const ByteBlock &mask=ByteBlock()) const
 Check if the start of the data matches a given pattern.
 
Sectionoperator= (const Section &&other) noexcept
 Move assignment operator.
 
Sectionoperator= (const Section &other)
 Assignment operator.
 
bool operator== (const DemuxedData &other) const
 Equality operator.
 
bool operator== (const Section &other) const
 Equality operator.
 
PacketCounter packetCount () const
 Minimum number of TS packets required to transport the section.
 
const uint8_t * payload () const
 Access to the payload of the section.
 
size_t payloadSize () const
 Get the size of the payload of the section.
 
size_t rawDataSize () const
 Size of the complete binary raw data containing the logical structure.
 
std::istream & read (std::istream &strm, CRC32::Validation crc_op=CRC32::Validation::IGNORE, Report &report=(ts::CerrReport::Instance()))
 Read a section from standard streams (binary mode).
 
void recomputeCRC ()
 This method recomputes and replaces the CRC32 of the section.
 
void reload (const ByteBlock &content, PID source_pid, CRC32::Validation crc_op)
 Reload from full binary content.
 
virtual void reload (const ByteBlock &content, PID source_pid=PID_NULL) override
 Reload from full binary content.
 
void reload (const ByteBlockPtr &content_ptr, PID source_pid, CRC32::Validation crc_op)
 Reload from full binary content.
 
virtual void reload (const ByteBlockPtr &content_ptr, PID source_pid=PID_NULL) override
 Reload from full binary content.
 
void reload (const void *content, size_t content_size, PID source_pid, CRC32::Validation crc_op)
 Reload from full binary content.
 
virtual void reload (const void *content, size_t content_size, PID source_pid=PID_NULL) override
 Reload from full binary content.
 
void reload (TID tid, bool is_private_section, const void *payload, size_t payload_size, PID source_pid=PID_NULL)
 Reload from a short section payload.
 
void reload (TID tid, bool is_private_section, uint16_t tid_ext, uint8_t version, bool is_current, uint8_t section_number, uint8_t last_section_number, const void *payload, size_t payload_size, PID source_pid=PID_NULL)
 Reload from a long section payload.
 
uint8_t sectionNumber () const
 Get the section number in the table (long section only).
 
void setAttribute (const UString &attr)
 Set a generic user-defined string as "attribute" of the object.
 
void setFirstTSPacketIndex (PacketCounter i)
 Set the first TS packet of the data in the demultiplexed stream.
 
void setIsCurrent (bool is_current, bool recompute_crc=true)
 Set the section current/next flag (long section only).
 
void setLastSectionNumber (uint8_t num, bool recompute_crc=true)
 Set the number of the last section in the table (long section only).
 
void setLastTSPacketIndex (PacketCounter i)
 Set the last TS packet of the data in the demultiplexed stream.
 
void setSectionNumber (uint8_t num, bool recompute_crc=true)
 Set the section number (long section only).
 
void setSourcePID (PID pid)
 Set the source PID.
 
void setTableId (uint8_t tid, bool recompute_crc=true)
 Set the table id.
 
void setTableIdExtension (uint16_t tid_ext, bool recompute_crc=true)
 Set the table id extension (long section only).
 
void setUInt16 (size_t offset, uint16_t value, bool recompute_crc=true)
 Set a 16-bit integer in the payload of the section.
 
void setUInt32 (size_t offset, uint32_t value, bool recompute_crc=true)
 Set a 32-bit integer in the payload of the section.
 
void setUInt8 (size_t offset, uint8_t value, bool recompute_crc=true)
 Set one byte in the payload of the section.
 
void setVersion (uint8_t version, bool recompute_crc=true)
 Set the section version number (long section only).
 
virtual size_t size () const
 Size of the logical binary content of the data.
 
PID sourcePID () const
 Get the source PID.
 
TID tableId () const
 Get the table id.
 
uint16_t tableIdExtension () const
 Get the table id extension (long section only).
 
void truncatePayload (size_t size, bool recompute_crc=true)
 Truncate the payload of the section.
 
uint8_t version () const
 Get the section version number (long section only).
 
std::ostream & write (std::ostream &strm, Report &report=(ts::CerrReport::Instance())) const
 Write a section to standard streams (binary mode).
 

Static Public Member Functions

template<class CONTAINER >
static PacketCounter PacketCount (const CONTAINER &container, bool pack=true)
 Static method to compute the minimum number of TS packets required to transport a set of sections.
 
static size_t SectionSize (const ByteBlock &content)
 Static method to compute a section size.
 
static size_t SectionSize (const void *content, size_t content_size)
 Static method to compute a section size.
 
static bool StartLongSection (const uint8_t *data, size_t size)
 This static method checks if a data area of at least 3 bytes can be the start of a long section.
 

Protected Member Functions

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

Detailed Description

Representation of MPEG PSI/SI sections.

What to do with the CRC32 when building a section depends on the parameter named crc_op:

  • IGNORE: Neither check nor compute.
  • CHECK: Validate the CRC from the section data. Mark the section as invalid if CRC is incorrect.
  • COMPUTE: Compute the CRC and store it in the section.

Typically, if the ByteBlock comes from the wire, use CHECK. If the ByteBlock is built by the application, use COMPUTE,

Constructor & Destructor Documentation

◆ Section() [1/7]

ts::Section::Section ( )
default

Default constructor.

Section is initially marked invalid.

◆ Section() [2/7]

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

Copy constructor.

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

◆ Section() [3/7]

ts::Section::Section ( const void *  content,
size_t  content_size,
PID  source_pid = PID_NULL,
CRC32::Validation  crc_op = CRC32::Validation::IGNORE 
)

Constructor from full binary content.

The content is copied into the section if valid.

Parameters
[in]contentAddress of the binary section data.
[in]content_sizeSize in bytes of the section.
[in]source_pidPID from which the section was read.
[in]crc_opHow to process the CRC32.

◆ Section() [4/7]

ts::Section::Section ( const ByteBlock content,
PID  source_pid = PID_NULL,
CRC32::Validation  crc_op = CRC32::Validation::IGNORE 
)

Constructor from full binary content.

The content is copied into the section if valid.

Parameters
[in]contentBinary section data.
[in]source_pidPID from which the section was read.
[in]crc_opHow to process the CRC32.

◆ Section() [5/7]

ts::Section::Section ( const ByteBlockPtr content_ptr,
PID  source_pid = PID_NULL,
CRC32::Validation  crc_op = CRC32::Validation::IGNORE 
)

Constructor from full binary content.

The content is copied into the section if valid.

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

◆ Section() [6/7]

ts::Section::Section ( TID  tid,
bool  is_private_section,
const void *  payload,
size_t  payload_size,
PID  source_pid = PID_NULL 
)

Constructor from a short section payload.

Parameters
[in]tidTable id.
[in]is_private_sectionIf true, this is a private section (ie. not MPEG-defined).
[in]payloadAddress of the payload data.
[in]payload_sizeSize in bytes of the payload data.
[in]source_pidPID from which the section was read.

◆ Section() [7/7]

ts::Section::Section ( TID  tid,
bool  is_private_section,
uint16_t  tid_ext,
uint8_t  version,
bool  is_current,
uint8_t  section_number,
uint8_t  last_section_number,
const void *  payload,
size_t  payload_size,
PID  source_pid = PID_NULL 
)

Constructor from a long section payload.

The provided payload does not contain the CRC32. The CRC32 is automatically computed.

Parameters
[in]tidTable id.
[in]is_private_sectionIf true, this is a private section (ie. not MPEG-defined).
[in]tid_extTable id extension.
[in]versionSection version number.
[in]is_currentIf true, this is a "current" section, not a "next" section.
[in]section_numberSection number.
[in]last_section_numberNumber of last section in the table.
[in]payloadAddress of the payload data.
[in]payload_sizeSize in bytes of the payload data.
[in]source_pidPID from which the section was read.

Member Function Documentation

◆ clear()

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

Clear data content.

Reimplemented from ts::DemuxedData.

◆ reload() [1/8]

virtual void ts::Section::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/8]

virtual void ts::Section::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/8]

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

◆ definingStandards()

virtual Standards ts::Section::definingStandards ( ) const
overridevirtual

Get the list of standards which define this object.

Returns
A bit mask of standards.

Implements ts::AbstractDefinedByStandards.

◆ reload() [4/8]

void ts::Section::reload ( const void *  content,
size_t  content_size,
PID  source_pid,
CRC32::Validation  crc_op 
)

Reload from full binary content.

The content is copied into the section if valid.

Parameters
[in]contentAddress of the binary section data.
[in]content_sizeSize in bytes of the section.
[in]source_pidPID from which the section was read.
[in]crc_opHow to process the CRC32.

◆ reload() [5/8]

void ts::Section::reload ( const ByteBlock content,
PID  source_pid,
CRC32::Validation  crc_op 
)

Reload from full binary content.

Parameters
[in]contentBinary section data.
[in]source_pidPID from which the section was read.
[in]crc_opHow to process the CRC32.

◆ reload() [6/8]

void ts::Section::reload ( const ByteBlockPtr content_ptr,
PID  source_pid,
CRC32::Validation  crc_op 
)

Reload from full binary content.

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

◆ reload() [7/8]

void ts::Section::reload ( TID  tid,
bool  is_private_section,
const void *  payload,
size_t  payload_size,
PID  source_pid = PID_NULL 
)

Reload from a short section payload.

Parameters
[in]tidTable id.
[in]is_private_sectionIf true, this is a private section (ie. not MPEG-defined).
[in]payloadAddress of the payload data.
[in]payload_sizeSize in bytes of the payload data.
[in]source_pidPID from which the section was read.

◆ reload() [8/8]

void ts::Section::reload ( TID  tid,
bool  is_private_section,
uint16_t  tid_ext,
uint8_t  version,
bool  is_current,
uint8_t  section_number,
uint8_t  last_section_number,
const void *  payload,
size_t  payload_size,
PID  source_pid = PID_NULL 
)

Reload from a long section payload.

The provided payload does not contain the CRC32. The CRC32 is automatically computed.

Parameters
[in]tidTable id.
[in]is_private_sectionIf true, this is a private section (ie. not MPEG-defined).
[in]tid_extTable id extension.
[in]versionSection version number.
[in]is_currentIf true, this is a "current" section, not a "next" section.
[in]section_numberSection number.
[in]last_section_numberNumber of last section in the table.
[in]payloadAddress of the payload data.
[in]payload_sizeSize in bytes of the payload data.
[in]source_pidPID from which the section was read.

◆ operator=() [1/2]

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

Assignment operator.

The sections contents are referenced, and thus shared between the two section objects.

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

◆ operator=() [2/2]

Section & ts::Section::operator= ( const Section &&  other)
noexcept

Move assignment operator.

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

◆ copy() [1/2]

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

Duplication.

Similar to assignment but the sections are duplicated.

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

◆ isValid()

bool ts::Section::isValid ( ) const
inline

Check if the section has valid content.

Returns
True if the section has valid content.

◆ operator==() [1/2]

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

Equality operator.

The source PID's are ignored, only the section contents are compared. Invalid sections are never identical.

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

◆ tableId()

TID ts::Section::tableId ( ) const
inline

Get the table id.

Returns
The table id or TID_NULL if the table is invalid.

◆ StartLongSection()

static bool ts::Section::StartLongSection ( const uint8_t *  data,
size_t  size 
)
static

This static method checks if a data area of at least 3 bytes can be the start of a long section.

Parameters
[in]dataAddress of the data area.
[in]sizeSize in bytes of the data area.
Returns
True if the section is a long one.

◆ isLongSection()

bool ts::Section::isLongSection ( ) const
inline

Check if the section is a long one.

Returns
True if the section is a long one.

◆ isShortSection()

bool ts::Section::isShortSection ( ) const
inline

Check if the section is a short one.

Returns
True if the section is a short one.

◆ isPrivateSection()

bool ts::Section::isPrivateSection ( ) const
inline

Check if the section is a private one (ie.

not MPEG-defined).

Returns
True if the section is a private one (ie. not MPEG-defined).

◆ tableIdExtension()

uint16_t ts::Section::tableIdExtension ( ) const
inline

Get the table id extension (long section only).

Returns
The table id extension.

◆ version()

uint8_t ts::Section::version ( ) const
inline

Get the section version number (long section only).

Returns
The section version number.

◆ isCurrent()

bool ts::Section::isCurrent ( ) const
inline

Check if the section is "current", not "next" (long section only).

Returns
True if the section is "current", false if it is "next".

◆ isNext()

bool ts::Section::isNext ( ) const
inline

Check if the section is "next", not "current" (long section only).

Returns
True if the section is "next", false if it is "current".

◆ sectionNumber()

uint8_t ts::Section::sectionNumber ( ) const
inline

Get the section number in the table (long section only).

Returns
The section number in the table.

◆ lastSectionNumber()

uint8_t ts::Section::lastSectionNumber ( ) const
inline

Get the number of the last section in the table (long section only).

Returns
The number of the last section in the table.

◆ etid()

ETID ts::Section::etid ( ) const
inline

Get the table id and id extension (long section only).

Returns
The table id and id extension as an ETID.

◆ headerSize()

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

Size of the section header.

Returns
Size of the section header.

◆ payload()

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

Access to the payload of the section.

For short sections, the payload starts after the private_section_length field. For long sections, the payload starts after the last_section_number field and ends before the CRC32 field. Do not modify payload content. May be invalidated after modification in section.

Returns
Address of the payload of the section.

◆ payloadSize()

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

Get the size of the payload of the section.

For long sections, the payload ends before the CRC32 field.

Returns
Size in bytes of the payload of the section.

◆ hash()

ByteBlock ts::Section::hash ( ) const

Get a hash of the section content.

Returns
SHA-1 value of the section content.

◆ packetCount()

PacketCounter ts::Section::packetCount ( ) const
inline

Minimum number of TS packets required to transport the section.

Returns
The minimum number of TS packets required to transport the section.

◆ setTableId()

void ts::Section::setTableId ( uint8_t  tid,
bool  recompute_crc = true 
)

Set the table id.

Parameters
[in]tidThe table id.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setTableIdExtension()

void ts::Section::setTableIdExtension ( uint16_t  tid_ext,
bool  recompute_crc = true 
)

Set the table id extension (long section only).

Parameters
[in]tid_extThe table id extension.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setVersion()

void ts::Section::setVersion ( uint8_t  version,
bool  recompute_crc = true 
)

Set the section version number (long section only).

Parameters
[in]versionThe section version number.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setIsCurrent()

void ts::Section::setIsCurrent ( bool  is_current,
bool  recompute_crc = true 
)

Set the section current/next flag (long section only).

Parameters
[in]is_currentTrue if the table is "current", false if it is "next".
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setSectionNumber()

void ts::Section::setSectionNumber ( uint8_t  num,
bool  recompute_crc = true 
)

Set the section number (long section only).

Parameters
[in]numThe section number.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setLastSectionNumber()

void ts::Section::setLastSectionNumber ( uint8_t  num,
bool  recompute_crc = true 
)

Set the number of the last section in the table (long section only).

Parameters
[in]numThe number of the last section in the table.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setUInt8()

void ts::Section::setUInt8 ( size_t  offset,
uint8_t  value,
bool  recompute_crc = true 
)

Set one byte in the payload of the section.

Parameters
[in]offsetByte offset in the payload.
[in]valueThe value to set in the payload.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setUInt16()

void ts::Section::setUInt16 ( size_t  offset,
uint16_t  value,
bool  recompute_crc = true 
)

Set a 16-bit integer in the payload of the section.

Parameters
[in]offsetByte offset in the payload.
[in]valueThe value to set in the payload.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ setUInt32()

void ts::Section::setUInt32 ( size_t  offset,
uint32_t  value,
bool  recompute_crc = true 
)

Set a 32-bit integer in the payload of the section.

Parameters
[in]offsetByte offset in the payload.
[in]valueThe value to set in the payload.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ appendPayload() [1/2]

void ts::Section::appendPayload ( const void *  data,
size_t  size,
bool  recompute_crc = true 
)

Append binary data to the payload of the section.

Parameters
[in]dataAddress of data to add to the payload.
[in]sizeSize in bytes of data to add to the payload.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ appendPayload() [2/2]

void ts::Section::appendPayload ( const ByteBlock data,
bool  recompute_crc = true 
)
inline

Append binary data to the payload of the section.

Parameters
[in]dataByte block to add to the payload.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ truncatePayload()

void ts::Section::truncatePayload ( size_t  size,
bool  recompute_crc = true 
)

Truncate the payload of the section.

Parameters
[in]sizeNew size in bytes of the payload. If larger than the current payload size, does nothing.
[in]recompute_crcIf true, immediately recompute the CRC32 of the section.

◆ hasDiversifiedPayload()

bool ts::Section::hasDiversifiedPayload ( ) const

Check if the section has a "diversified" payload.

A payload is "diversified" if its size is 2 bytes or more and if it contains at least 2 different byte values (not all 0x00 or not all 0xFF for instance).

Returns
True if the payload is diversified.

◆ read()

std::istream & ts::Section::read ( std::istream &  strm,
CRC32::Validation  crc_op = CRC32::Validation::IGNORE,
Report report = (ts::CerrReport::Instance()) 
)

Read a section from standard streams (binary mode).

Parameters
[in,out]strmA standard stream in input mode. If a section is invalid (eof before end of section, wrong crc), the failbit of the stream is set.
[in]crc_opHow to process the CRC32 of the input packet.
[in,out]reportWhere to report errors.
Returns
A reference to the strm object.

◆ write()

std::ostream & ts::Section::write ( std::ostream &  strm,
Report report = (ts::CerrReport::Instance()) 
) const

Write a section to standard streams (binary mode).

Parameters
[in,out]strmA standard stream in output mode.
[in,out]reportWhere to report errors.
Returns
A reference to the strm object.

◆ dump()

std::ostream & ts::Section::dump ( std::ostream &  strm,
int  indent = 0,
uint16_t  cas = CASID_NULL,
bool  no_header = false 
) const

Hexa dump the section on an output stream without interpretation of the payload.

Parameters
[in,out]strmA standard stream in output mode (text mode).
[in]indentIndicates the base indentation of lines.
[in]casCAS id, for CAS-specific information.
[in]no_headerIf true, do not display the section header.
Returns
A reference to the strm object.

◆ SectionSize() [1/2]

static size_t ts::Section::SectionSize ( const void *  content,
size_t  content_size 
)
static

Static method to compute a section size.

Parameters
[in]contentAddress of the binary section data.
[in]content_sizeSize in bytes of the buffer containing the section and possibly trailing additional data.
Returns
The total size in bytes of the section starting at content or zero on error.

◆ SectionSize() [2/2]

static size_t ts::Section::SectionSize ( const ByteBlock content)
inlinestatic

Static method to compute a section size.

Parameters
[in]contentBuffer containing the section and possibly trailing additional data.
Returns
The total size in bytes of the section starting in content or zero on error.

◆ PacketCount()

template<class CONTAINER >
static PacketCounter ts::Section::PacketCount ( const CONTAINER &  container,
bool  pack = true 
)
static

Static method to compute the minimum number of TS packets required to transport a set of sections.

Template Parameters
CONTAINERA container class of SectionPtr as defined by the C++ Standard Template Library (STL).
Parameters
[in]containerA container class of SectionPtr.
[in]packIf true, assume that sections are packed in TS packets. When false, assume that each section starts at the beginning of a TS packet and stuffing in applied at the end of each section.
Returns
The minimum number of TS packets required to transport the sections in container.

◆ copy() [2/2]

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.

◆ operator==() [2/2]

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.

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

virtual const uint8_t * ts::DemuxedData::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()

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

Size of the logical binary content of the data.

For subclasses of DemuxedData, this is the logical size of the data structure inside the DemuxedData blob.

Returns
Size of the logical binary content of the data.

Reimplemented in ts::PESPacket.

◆ rawDataSize()

size_t ts::DemuxedData::rawDataSize ( ) const
inherited

Size of the complete binary raw data containing the logical structure.

Returns
Size of the complete binary raw data.

◆ matchContent()

bool ts::DemuxedData::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.

◆ rwContent()

uint8_t * ts::DemuxedData::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()

void ts::DemuxedData::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()

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

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