TSDuck v3.38-3699
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::CRC32 Class Reference

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

#include <tsCRC32.h>

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.
 
void add (const void *data, size_t size)
 Continue the computation of a data area, following a previous CRC32.
 
 operator uint32_t () const
 Convert to a 32-bit integer.
 
bool operator== (const CRC32 &c) const
 Comparison operator with another CRC32 instance.
 
void reset ()
 Reset the CRC32 computation, restart a new computation.
 
uint32_t value () const
 Get the value of the CRC32 as computed so far.
 

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

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

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.

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