VLC 4.0.0-dev
Timestamps, error-free

These functions support generating timestamps without long term rounding errors due to sample rate conversions. More...

Collaboration diagram for Timestamps, error-free:

Data Structures

struct  date_t
 Timestamps without long-term rounding errors. More...
 

Functions

void date_Init (date_t *restrict date, uint32_t num, uint32_t den)
 Initializes a date_t. More...
 
void date_Change (date_t *restrict date, uint32_t num, uint32_t den)
 Changes the rate of a date_t. More...
 
static void date_Set (date_t *restrict date, vlc_tick_t value)
 Sets the exact timestamp of a date_t. More...
 
static vlc_tick_t date_Get (const date_t *restrict date)
 Gets the current timestamp from a date_t. More...
 
vlc_tick_t date_Increment (date_t *restrict date, uint32_t count)
 Increments a date. More...
 
vlc_tick_t date_Decrement (date_t *restrict date, uint32_t count)
 Decrements a date. More...
 

Detailed Description

These functions support generating timestamps without long term rounding errors due to sample rate conversions.

Function Documentation

◆ date_Change()

void date_Change ( date_t *restrict  date,
uint32_t  num,
uint32_t  den 
)

Changes the rate of a date_t.

Parameters
datedate to change
numdivider (sample rate) numerator
dendivider (sample rate) denominator

◆ date_Decrement()

vlc_tick_t date_Decrement ( date_t *restrict  date,
uint32_t  count 
)

Decrements a date.

Moves the date_t timestamp backward by a given number of samples.

Parameters
datedate to move backward
countnumber of samples
Returns
date value

◆ date_Get()

static vlc_tick_t date_Get ( const date_t *restrict  date)
inlinestatic

Gets the current timestamp from a date_t.

Parameters
datedate to fetch the timestamp from
Returns
date value

◆ date_Increment()

vlc_tick_t date_Increment ( date_t *restrict  date,
uint32_t  count 
)

Increments a date.

Moves the date_t timestamp forward by a given number of samples.

Parameters
datedate to move forward
countnumber of samples
Returns
timestamp value after incrementing

◆ date_Init()

void date_Init ( date_t *restrict  date,
uint32_t  num,
uint32_t  den 
)

Initializes a date_t.

Parameters
datedate to initialize [OUT]
numdivider (sample rate) numerator
dendivider (sample rate) denominator

◆ date_Set()

static void date_Set ( date_t *restrict  date,
vlc_tick_t  value 
)
inlinestatic

Sets the exact timestamp of a date_t.

Parameters
datedate to set the timestamp into
valuedate value