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

Iterator for common AVC/HEVC/VVC video access units. More...

#include <tsAccessUnitIterator.h>

Public Member Functions

 AccessUnitIterator (const uint8_t *data, size_t size, uint8_t stream_type=ST_NULL, CodecType default_format=CodecType::UNDEFINED)
 Constructor.
 
bool atEnd () const
 Check if the last access unit was passed.
 
const uint8_t * currentAccessUnit () const
 Get the address of the current access unit.
 
size_t currentAccessUnitHeaderSize () const
 Get the size of the header of the current access unit.
 
size_t currentAccessUnitIndex () const
 Get the index of the current access unit.
 
bool currentAccessUnitIsSEI () const
 Check if the current access unit is a Supplemental Enhancement Information (SEI).
 
size_t currentAccessUnitOffset () const
 Get the offset of the current access unit inside the data area.
 
size_t currentAccessUnitSize () const
 Get the size of the current access unit.
 
uint8_t currentAccessUnitType () const
 Get the current access unit type.
 
bool isValid () const
 Check if the video format is valid.
 
bool next ()
 Iterate to the next access unit.
 
void reset ()
 Reset the exploration of the data area at the beginning.
 
CodecType videoFormat () const
 Get the video format.
 

Detailed Description

Iterator for common AVC/HEVC/VVC video access units.

Some H.26x video coding formats use a common access unit bitstream format. This class is an iterator over the payload of a PES packet (possibly truncated) to locate each access unit.

This class can be used with:

  • AVC, Advanced Video Coding, ISO 14496-10, ITU-T Rec. H.264.
  • HEVC, High Efficiency Video Coding, ITU-T Rec. H.265.
  • VVC, Versatile Video Coding, ITU-T Rec. H.266.

Constructor & Destructor Documentation

◆ AccessUnitIterator()

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

Constructor.

The current access unit is set to the first one.

Parameters
[in]dataAddress of data to explore, typically a PES packet payload or the start of one. This data area must not be modified during the lifetime of this object.
[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, access unit types values cannot be extracted.

Member Function Documentation

◆ isValid()

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

Check if the video format is valid.

Returns
True if the video format is valid. False if stream_type and default_format were both unspecified and no usual NALunit header is found.

◆ videoFormat()

CodecType ts::AccessUnitIterator::videoFormat ( ) const
inline

Get the video format.

Returns
The video format.

◆ currentAccessUnit()

const uint8_t * ts::AccessUnitIterator::currentAccessUnit ( ) const
inline

Get the address of the current access unit.

Returns
The address of the current access unit or a null pointer on error or end of data.

◆ currentAccessUnitOffset()

size_t ts::AccessUnitIterator::currentAccessUnitOffset ( ) const
inline

Get the offset of the current access unit inside the data area.

Returns
The offset of the current access unit inside the data area.

◆ currentAccessUnitSize()

size_t ts::AccessUnitIterator::currentAccessUnitSize ( ) const
inline

Get the size of the current access unit.

Returns
The size in bytes of the current access unit.

◆ currentAccessUnitHeaderSize()

size_t ts::AccessUnitIterator::currentAccessUnitHeaderSize ( ) const
inline

Get the size of the header of the current access unit.

Returns
The size in bytes of the header of the current access unit. This is usually 1 or 2 byes, depending on the video codec.

◆ currentAccessUnitIndex()

size_t ts::AccessUnitIterator::currentAccessUnitIndex ( ) const
inline

Get the index of the current access unit.

Returns
The index of the current access unit. This is zero for first access unit and so on. When atEnd() is true, this is the number of access units which were found in the PES packet.

◆ currentAccessUnitType()

uint8_t ts::AccessUnitIterator::currentAccessUnitType ( ) const
inline

Get the current access unit type.

Returns
The current access unit. Return AVC_AUT_INVALID if the video format is undefined.

◆ currentAccessUnitIsSEI()

bool ts::AccessUnitIterator::currentAccessUnitIsSEI ( ) const

Check if the current access unit is a Supplemental Enhancement Information (SEI).

The syntax of the SEI access unit is common between AVC, HEVC and VVC but the access unit type is different. This method checks if the current access unit is an SEI for the current video format.

Returns
True if the current access unit is an SEI.

◆ next()

bool ts::AccessUnitIterator::next ( )

Iterate to the next access unit.

Returns
True on success, false when the end of the data area is reached.

◆ atEnd()

bool ts::AccessUnitIterator::atEnd ( ) const
inline

Check if the last access unit was passed.

Returns
True if the last access unit was passed.

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