TSDuck Version 3.15-964 (TSDuck - The MPEG Transport Stream Toolkit)
ts::AVCParser Class Reference

Parser for Advanced Video Coding data. More...

Public Member Functions

 AVCParser (const void *data, size_t size_in_bytes)
 Constructor. More...
 
bool byteAligned () const
 Check if the current bit pointer is on a byte boundary. More...
 
bool endOfStream () const
 Check end of stream. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_signed< INT >::value >::type * = nullptr>
bool i (INT &val, size_t n)
 Read the next signed integer using n bits and advance the bitstream pointer. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool nextBits (INT &val, size_t n)
 Provide the next n bits without advancing the bitstream pointer. More...
 
bool rbspTrailingBits ()
 Skip an rbsp_trailing_bits() as defined by ISO/EIC 14496-10 7.3.2.11. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool readBits (INT &val, size_t n)
 Read the next n bits and advance the bitstream pointer. More...
 
size_t remainingBits () const
 Get number of remaining bits. More...
 
size_t remainingBytes () const
 Get number of remaining bytes (rounded down). More...
 
void reset (const void *data, size_t size_in_bytes)
 Reset with a new memory area. More...
 
void reset (size_t byte_offset=0, size_t bit_offset=0)
 Reset parsing at the specified point. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_signed< INT >::value >::type * = nullptr>
bool se (INT &val)
 Read the next Exp-Golomb-coded signed integer and advance the bitstream pointer. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_unsigned< INT >::value >::type * = nullptr>
bool u (INT &val, size_t n)
 Read the next unsigned integer using n bits and advance the bitstream pointer. More...
 
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_unsigned< INT >::value >::type * = nullptr>
bool ue (INT &val)
 Read the next Exp-Golomb-coded unsigned integer and advance the bitstream pointer. More...
 

Detailed Description

Parser for Advanced Video Coding data.

Advanced Video Coding is AVC, ISO/IEC 14496-10, ITU H.264.

The naming of methods such as readBits(), i(), u(), etc. is directly transposed from ISO/IEC 14496-10.

Constructor & Destructor Documentation

◆ AVCParser()

ts::AVCParser::AVCParser ( const void *  data,
size_t  size_in_bytes 
)

Constructor.

Parameters
[in]dataAddress of a memory area to parse. It must remain valid as long as the AVCParser object is used.
[in]size_in_bytesSize in bytes of the memory area to parse.

Member Function Documentation

◆ reset() [1/2]

void ts::AVCParser::reset ( const void *  data,
size_t  size_in_bytes 
)

Reset with a new memory area.

Parameters
[in]dataAddress of a memory area to parse. It must remain valid as long as the AVCParser object is used.
[in]size_in_bytesSize in bytes of the memory area to parse.

◆ reset() [2/2]

void ts::AVCParser::reset ( size_t  byte_offset = 0,
size_t  bit_offset = 0 
)

Reset parsing at the specified point.

Parameters
[in]byte_offsetOffset of first byte to analyze.
[in]bit_offsetOffset of first bit in first byte. The bit offset zero is the most significant bit.

◆ remainingBytes()

size_t ts::AVCParser::remainingBytes ( ) const

Get number of remaining bytes (rounded down).

Returns
The number of remaining bytes (rounded down).

◆ remainingBits()

size_t ts::AVCParser::remainingBits ( ) const

Get number of remaining bits.

Returns
The number of remaining bits.

◆ endOfStream()

bool ts::AVCParser::endOfStream ( ) const
inline

Check end of stream.

Returns
True if at end of stream.

◆ byteAligned()

bool ts::AVCParser::byteAligned ( ) const
inline

Check if the current bit pointer is on a byte boundary.

Returns
True if the current bit pointer is on a byte boundary.

◆ rbspTrailingBits()

bool ts::AVCParser::rbspTrailingBits ( )

Skip an rbsp_trailing_bits() as defined by ISO/EIC 14496-10 7.3.2.11.

Returns
True if one was found and skipped.

◆ nextBits()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool ts::AVCParser::nextBits ( INT val,
size_t  n 
)

Provide the next n bits without advancing the bitstream pointer.

Template Parameters
INTAn integer type for the returned data.
Parameters
[out]valReturned integer value.
[in]nNumber of bits to read.
Returns
True on success, false on error.

◆ readBits()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr>
bool ts::AVCParser::readBits ( INT val,
size_t  n 
)

Read the next n bits and advance the bitstream pointer.

Template Parameters
INTAn integer type for the returned data.
Parameters
[out]valReturned integer value.
[in]nNumber of bits to read.
Returns
True on success, false on error.

◆ u()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_unsigned< INT >::value >::type * = nullptr>
bool ts::AVCParser::u ( INT val,
size_t  n 
)
inline

Read the next unsigned integer using n bits and advance the bitstream pointer.

Template Parameters
INTAn integer type for the returned data.
Parameters
[out]valReturned integer value.
[in]nNumber of bits to read.
Returns
True on success, false on error.

◆ i()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_signed< INT >::value >::type * = nullptr>
bool ts::AVCParser::i ( INT val,
size_t  n 
)
inline

Read the next signed integer using n bits and advance the bitstream pointer.

Template Parameters
INTAn integer type for the returned data.
Parameters
[out]valReturned integer value.
[in]nNumber of bits to read.
Returns
True on success, false on error.

◆ ue()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_unsigned< INT >::value >::type * = nullptr>
bool ts::AVCParser::ue ( INT val)
inline

Read the next Exp-Golomb-coded unsigned integer and advance the bitstream pointer.

Template Parameters
INTAn integer type for the returned data.
Parameters
[out]valReturned integer value.
Returns
True on success, false on error.

◆ se()

template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr, typename std::enable_if< std::is_signed< INT >::value >::type * = nullptr>
bool ts::AVCParser::se ( INT val)

Read the next Exp-Golomb-coded signed integer and advance the bitstream pointer.

Template Parameters
INTAn integer type for the returned data.
Parameters
[out]valReturned integer value.
Returns
True on success, false on error.

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