timer.h File Reference

Declares mad_timer_t structure and methods, used when decoding header frames. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mad_timer_t

Defines

#define MAD_TIMER_RESOLUTION   352800000UL
#define mad_timer_reset(timer)   ((void) (*(timer) = mad_timer_zero))
#define mad_timer_sign(timer)   mad_timer_compare((timer), mad_timer_zero)

Enumerations

enum  mad_units {
  MAD_UNITS_HOURS = -2, MAD_UNITS_MINUTES = -1, MAD_UNITS_SECONDS = 0, MAD_UNITS_DECISECONDS = 10,
  MAD_UNITS_CENTISECONDS = 100, MAD_UNITS_MILLISECONDS = 1000, MAD_UNITS_8000_HZ = 8000, MAD_UNITS_11025_HZ = 11025,
  MAD_UNITS_12000_HZ = 12000, MAD_UNITS_16000_HZ = 16000, MAD_UNITS_22050_HZ = 22050, MAD_UNITS_24000_HZ = 24000,
  MAD_UNITS_32000_HZ = 32000, MAD_UNITS_44100_HZ = 44100, MAD_UNITS_48000_HZ = 48000, MAD_UNITS_24_FPS = 24,
  MAD_UNITS_25_FPS = 25, MAD_UNITS_30_FPS = 30, MAD_UNITS_48_FPS = 48, MAD_UNITS_50_FPS = 50,
  MAD_UNITS_60_FPS = 60, MAD_UNITS_75_FPS = 75, MAD_UNITS_23_976_FPS = -24, MAD_UNITS_24_975_FPS = -25,
  MAD_UNITS_29_97_FPS = -30, MAD_UNITS_47_952_FPS = -48, MAD_UNITS_49_95_FPS = -50, MAD_UNITS_59_94_FPS = -60
}

Functions

int mad_timer_compare (mad_timer_t, mad_timer_t)
 Indicates relative order of two timers.
void mad_timer_negate (mad_timer_t *)
 Inverts the sign of a timer.
mad_timer_t mad_timer_abs (mad_timer_t)
 Returns the absolute value of a timer.
void mad_timer_set (mad_timer_t *, unsigned long, unsigned long, unsigned long)
 Sets timer to specific (positive) value.
void mad_timer_add (mad_timer_t *, mad_timer_t)
 Adds one timer to another.
void mad_timer_multiply (mad_timer_t *, signed long)
 Multiplies a timer by a scalar value.
signed long mad_timer_count (mad_timer_t, enum mad_units)
 Returns timer value in selected units.
unsigned long mad_timer_fraction (mad_timer_t, unsigned long)
 Returns fractional part of timer in arbitrary terms.
void mad_timer_string (mad_timer_t, char *, char const *, enum mad_units, enum mad_units, unsigned long)
 Writes a string representation of a timer using a template.

Variables

mad_timer_t const mad_timer_zero


Detailed Description

Declares mad_timer_t structure and methods, used when decoding header frames.

Definition in file timer.h.


Define Documentation

#define mad_timer_reset ( timer   )     ((void) (*(timer) = mad_timer_zero))

Definition at line 84 of file timer.h.

#define MAD_TIMER_RESOLUTION   352800000UL

#define mad_timer_sign ( timer   )     mad_timer_compare((timer), mad_timer_zero)

Definition at line 88 of file timer.h.


Enumeration Type Documentation

enum mad_units

Enumerator:
MAD_UNITS_HOURS 
MAD_UNITS_MINUTES 
MAD_UNITS_SECONDS 
MAD_UNITS_DECISECONDS 
MAD_UNITS_CENTISECONDS 
MAD_UNITS_MILLISECONDS 
MAD_UNITS_8000_HZ 
MAD_UNITS_11025_HZ 
MAD_UNITS_12000_HZ 
MAD_UNITS_16000_HZ 
MAD_UNITS_22050_HZ 
MAD_UNITS_24000_HZ 
MAD_UNITS_32000_HZ 
MAD_UNITS_44100_HZ 
MAD_UNITS_48000_HZ 
MAD_UNITS_24_FPS 
MAD_UNITS_25_FPS 
MAD_UNITS_30_FPS 
MAD_UNITS_48_FPS 
MAD_UNITS_50_FPS 
MAD_UNITS_60_FPS 
MAD_UNITS_75_FPS 
MAD_UNITS_23_976_FPS 
MAD_UNITS_24_975_FPS 
MAD_UNITS_29_97_FPS 
MAD_UNITS_47_952_FPS 
MAD_UNITS_49_95_FPS 
MAD_UNITS_59_94_FPS 

Definition at line 36 of file timer.h.


Function Documentation

mad_timer_t mad_timer_abs ( mad_timer_t   ) 

Returns the absolute value of a timer.

Definition at line 79 of file timer.c.

References mad_timer_negate(), and mad_timer_t::seconds.

Referenced by mad_timer_fraction(), and mad_timer_string().

Here is the call graph for this function:

void mad_timer_add ( mad_timer_t ,
mad_timer_t   
)

Adds one timer to another.

Definition at line 224 of file timer.c.

References mad_timer_t::fraction, MAD_TIMER_RESOLUTION, reduce_timer(), and mad_timer_t::seconds.

Referenced by mad_timer_multiply().

Here is the call graph for this function:

int mad_timer_compare ( mad_timer_t  ,
mad_timer_t   
)

Indicates relative order of two timers.

Definition at line 44 of file timer.c.

References mad_timer_t::fraction, and mad_timer_t::seconds.

signed long mad_timer_count ( mad_timer_t  ,
enum  mad_units 
)

unsigned long mad_timer_fraction ( mad_timer_t  ,
unsigned  long 
)

Returns fractional part of timer in arbitrary terms.

Definition at line 315 of file timer.c.

References mad_timer_t::fraction, mad_timer_abs(), MAD_TIMER_RESOLUTION, and scale_rational().

Here is the call graph for this function:

void mad_timer_multiply ( mad_timer_t ,
signed  long 
)

Multiplies a timer by a scalar value.

Definition at line 236 of file timer.c.

References mad_timer_add(), and mad_timer_negate().

Here is the call graph for this function:

void mad_timer_negate ( mad_timer_t  ) 

Inverts the sign of a timer.

Definition at line 66 of file timer.c.

References mad_timer_t::fraction, MAD_TIMER_RESOLUTION, and mad_timer_t::seconds.

Referenced by mad_timer_abs(), and mad_timer_multiply().

void mad_timer_set ( mad_timer_t ,
unsigned  long,
unsigned  long,
unsigned  long 
)

Sets timer to specific (positive) value.

Definition at line 153 of file timer.c.

References mad_timer_t::fraction, MAD_TIMER_RESOLUTION, reduce_timer(), scale_rational(), and mad_timer_t::seconds.

Referenced by mad_header_decode().

Here is the call graph for this function:

void mad_timer_string ( mad_timer_t  ,
char *  ,
char const *  ,
enum  mad_units,
enum  mad_units,
unsigned  long 
)


Variable Documentation

Definition at line 39 of file timer.c.

Referenced by mad_header_init().


Generated on Tue Jun 10 12:14:18 2008 for libmad by  doxygen 1.5.5