2 * libmad - MPEG audio decoder library
3 * Copyright (C) 2000-2003 Underbit Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # ifndef LIBMAD_TIMER_H
22 # define LIBMAD_TIMER_H
27 s32 seconds
; /* whole seconds */
28 u32 fraction
; /* 1/MAD_TIMER_RESOLUTION seconds */
31 extern mad_timer_t
const mad_timer_zero
;
33 # define MAD_TIMER_RESOLUTION 352800000UL
37 MAD_UNITS_MINUTES
= -1,
38 MAD_UNITS_SECONDS
= 0,
42 MAD_UNITS_DECISECONDS
= 10,
43 MAD_UNITS_CENTISECONDS
= 100,
44 MAD_UNITS_MILLISECONDS
= 1000,
46 /* audio sample units */
48 MAD_UNITS_8000_HZ
= 8000,
49 MAD_UNITS_11025_HZ
= 11025,
50 MAD_UNITS_12000_HZ
= 12000,
52 MAD_UNITS_16000_HZ
= 16000,
53 MAD_UNITS_22050_HZ
= 22050,
54 MAD_UNITS_24000_HZ
= 24000,
56 MAD_UNITS_32000_HZ
= 32000,
57 MAD_UNITS_44100_HZ
= 44100,
58 MAD_UNITS_48000_HZ
= 48000,
60 /* video frame/field units */
62 MAD_UNITS_24_FPS
= 24,
63 MAD_UNITS_25_FPS
= 25,
64 MAD_UNITS_30_FPS
= 30,
65 MAD_UNITS_48_FPS
= 48,
66 MAD_UNITS_50_FPS
= 50,
67 MAD_UNITS_60_FPS
= 60,
71 MAD_UNITS_75_FPS
= 75,
73 /* video drop-frame units */
75 MAD_UNITS_23_976_FPS
= -24,
76 MAD_UNITS_24_975_FPS
= -25,
77 MAD_UNITS_29_97_FPS
= -30,
78 MAD_UNITS_47_952_FPS
= -48,
79 MAD_UNITS_49_95_FPS
= -50,
80 MAD_UNITS_59_94_FPS
= -60
83 # define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
85 int mad_timer_compare(mad_timer_t
, mad_timer_t
);
87 # define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
89 void mad_timer_negate(mad_timer_t
*);
90 mad_timer_t
mad_timer_abs(mad_timer_t
);
92 void mad_timer_set(mad_timer_t
*, u32
, u32
, u32
);
93 void mad_timer_add(mad_timer_t
*, mad_timer_t
);
94 void mad_timer_multiply(mad_timer_t
*, s32
);
96 s32
mad_timer_count(mad_timer_t
, enum mad_units
);
97 u32
mad_timer_fraction(mad_timer_t
, u32
);
98 void mad_timer_string(mad_timer_t
, char *, char const *,
99 enum mad_units
, enum mad_units
, u32
);