TSDuck Version 3.29-2595 (TSDuck - The MPEG Transport Stream Toolkit)
ts::CRC32 Class Reference

Cyclic Redundancy Check as used in MPEG sections. More...

Public Types

enum  Validation {
  IGNORE = 0,
  CHECK = 1,
  COMPUTE = 2
}
 What to do with a CRC32. More...
 

Public Member Functions

 CRC32 ()
 Default constructor.
 
 CRC32 (const void *data, size_t size)
 Constructor, compute the CRC32 of a data area. More...
 
void add (const void *data, size_t size)
 Continue the computation of a data area, following a previous CRC32. More...
 
 operator uint32_t () const
 Convert to a 32-bit integer. More...
 
bool operator!= (const CRC32 &c) const
 Comparison operator with another CRC32 instance. More...
 
bool operator!= (uint32_t c) const
 Comparison operator with a 32-bit integer. More...
 
bool operator== (const CRC32 &c) const
 Comparison operator with another CRC32 instance. More...
 
bool operator== (uint32_t c) const
 Comparison operator with a 32-bit integer. More...
 
void reset ()
 Reset the CRC32 computation, restart a new computation.
 
uint32_t value () const
 Get the value of the CRC32 as computed so far. More...
 

Detailed Description

Cyclic Redundancy Check as used in MPEG sections.

Member Enumeration Documentation

◆ Validation

What to do with a CRC32.

Used when building MPEG sections.

Enumerator
IGNORE 

Ignore the section CRC32.

CHECK 

Check that the value of the CRC32 of the section is correct and fail if it isn't.

COMPUTE 

Recompute a fresh new CRC32 value based on the content of the section.

Constructor & Destructor Documentation

◆ CRC32()

ts::CRC32::CRC32 ( const void *  data,
size_t  size 
)
inline

Constructor, compute the CRC32 of a data area.

Parameters
[in]dataAddress of area to analyze.
[in]sizeSize in bytes of area to analyze.

Member Function Documentation

◆ add()

void ts::CRC32::add ( const void *  data,
size_t  size 
)

Continue the computation of a data area, following a previous CRC32.

Parameters
[in]dataAddress of area to analyze.
[in]sizeSize in bytes of area to analyze.

◆ value()

uint32_t ts::CRC32::value ( ) const
inline

Get the value of the CRC32 as computed so far.

Returns
The value of the CRC32 as computed so far.

◆ operator uint32_t()

ts::CRC32::operator uint32_t ( ) const
inline

Convert to a 32-bit integer.

Same as value() method.

Returns
The value of the CRC32 as computed so far.

◆ operator==() [1/2]

bool ts::CRC32::operator== ( const CRC32 c) const
inline

Comparison operator with another CRC32 instance.

Parameters
[in]cOther instance to compare.
Returns
True if the two CRC32 are identical, false otherwise.

◆ operator!=() [1/2]

bool ts::CRC32::operator!= ( const CRC32 c) const
inline

Comparison operator with another CRC32 instance.

Parameters
[in]cOther instance to compare.
Returns
True if the two CRC32 are different, false otherwise.

◆ operator==() [2/2]

bool ts::CRC32::operator== ( uint32_t  c) const
inline

Comparison operator with a 32-bit integer.

Parameters
[in]cA CRC32 value to compare.
Returns
True if the two CRC32 are identical, false otherwise.

◆ operator!=() [2/2]

bool ts::CRC32::operator!= ( uint32_t  c) const
inline

Comparison operator with a 32-bit integer.

Parameters
[in]cA CRC32 value to compare.
Returns
True if the two CRC32 are different, false otherwise.

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