cannam@85
|
1 /*
|
cannam@85
|
2 * libmad - MPEG audio decoder library
|
cannam@85
|
3 * Copyright (C) 2000-2004 Underbit Technologies, Inc.
|
cannam@85
|
4 *
|
cannam@85
|
5 * This program is free software; you can redistribute it and/or modify
|
cannam@85
|
6 * it under the terms of the GNU General Public License as published by
|
cannam@85
|
7 * the Free Software Foundation; either version 2 of the License, or
|
cannam@85
|
8 * (at your option) any later version.
|
cannam@85
|
9 *
|
cannam@85
|
10 * This program is distributed in the hope that it will be useful,
|
cannam@85
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
cannam@85
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
cannam@85
|
13 * GNU General Public License for more details.
|
cannam@85
|
14 *
|
cannam@85
|
15 * You should have received a copy of the GNU General Public License
|
cannam@85
|
16 * along with this program; if not, write to the Free Software
|
cannam@85
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
cannam@85
|
18 *
|
cannam@85
|
19 * $Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp $
|
cannam@85
|
20 */
|
cannam@85
|
21
|
cannam@85
|
22 # ifndef LIBMAD_TIMER_H
|
cannam@85
|
23 # define LIBMAD_TIMER_H
|
cannam@85
|
24
|
cannam@85
|
25 typedef struct {
|
cannam@85
|
26 signed long seconds; /* whole seconds */
|
cannam@85
|
27 unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
|
cannam@85
|
28 } mad_timer_t;
|
cannam@85
|
29
|
cannam@85
|
30 extern mad_timer_t const mad_timer_zero;
|
cannam@85
|
31
|
cannam@85
|
32 # define MAD_TIMER_RESOLUTION 352800000UL
|
cannam@85
|
33
|
cannam@85
|
34 enum mad_units {
|
cannam@85
|
35 MAD_UNITS_HOURS = -2,
|
cannam@85
|
36 MAD_UNITS_MINUTES = -1,
|
cannam@85
|
37 MAD_UNITS_SECONDS = 0,
|
cannam@85
|
38
|
cannam@85
|
39 /* metric units */
|
cannam@85
|
40
|
cannam@85
|
41 MAD_UNITS_DECISECONDS = 10,
|
cannam@85
|
42 MAD_UNITS_CENTISECONDS = 100,
|
cannam@85
|
43 MAD_UNITS_MILLISECONDS = 1000,
|
cannam@85
|
44
|
cannam@85
|
45 /* audio sample units */
|
cannam@85
|
46
|
cannam@85
|
47 MAD_UNITS_8000_HZ = 8000,
|
cannam@85
|
48 MAD_UNITS_11025_HZ = 11025,
|
cannam@85
|
49 MAD_UNITS_12000_HZ = 12000,
|
cannam@85
|
50
|
cannam@85
|
51 MAD_UNITS_16000_HZ = 16000,
|
cannam@85
|
52 MAD_UNITS_22050_HZ = 22050,
|
cannam@85
|
53 MAD_UNITS_24000_HZ = 24000,
|
cannam@85
|
54
|
cannam@85
|
55 MAD_UNITS_32000_HZ = 32000,
|
cannam@85
|
56 MAD_UNITS_44100_HZ = 44100,
|
cannam@85
|
57 MAD_UNITS_48000_HZ = 48000,
|
cannam@85
|
58
|
cannam@85
|
59 /* video frame/field units */
|
cannam@85
|
60
|
cannam@85
|
61 MAD_UNITS_24_FPS = 24,
|
cannam@85
|
62 MAD_UNITS_25_FPS = 25,
|
cannam@85
|
63 MAD_UNITS_30_FPS = 30,
|
cannam@85
|
64 MAD_UNITS_48_FPS = 48,
|
cannam@85
|
65 MAD_UNITS_50_FPS = 50,
|
cannam@85
|
66 MAD_UNITS_60_FPS = 60,
|
cannam@85
|
67
|
cannam@85
|
68 /* CD audio frames */
|
cannam@85
|
69
|
cannam@85
|
70 MAD_UNITS_75_FPS = 75,
|
cannam@85
|
71
|
cannam@85
|
72 /* video drop-frame units */
|
cannam@85
|
73
|
cannam@85
|
74 MAD_UNITS_23_976_FPS = -24,
|
cannam@85
|
75 MAD_UNITS_24_975_FPS = -25,
|
cannam@85
|
76 MAD_UNITS_29_97_FPS = -30,
|
cannam@85
|
77 MAD_UNITS_47_952_FPS = -48,
|
cannam@85
|
78 MAD_UNITS_49_95_FPS = -50,
|
cannam@85
|
79 MAD_UNITS_59_94_FPS = -60
|
cannam@85
|
80 };
|
cannam@85
|
81
|
cannam@85
|
82 # define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
|
cannam@85
|
83
|
cannam@85
|
84 int mad_timer_compare(mad_timer_t, mad_timer_t);
|
cannam@85
|
85
|
cannam@85
|
86 # define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
|
cannam@85
|
87
|
cannam@85
|
88 void mad_timer_negate(mad_timer_t *);
|
cannam@85
|
89 mad_timer_t mad_timer_abs(mad_timer_t);
|
cannam@85
|
90
|
cannam@85
|
91 void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
|
cannam@85
|
92 void mad_timer_add(mad_timer_t *, mad_timer_t);
|
cannam@85
|
93 void mad_timer_multiply(mad_timer_t *, signed long);
|
cannam@85
|
94
|
cannam@85
|
95 signed long mad_timer_count(mad_timer_t, enum mad_units);
|
cannam@85
|
96 unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
|
cannam@85
|
97 void mad_timer_string(mad_timer_t, char *, char const *,
|
cannam@85
|
98 enum mad_units, enum mad_units, unsigned long);
|
cannam@85
|
99
|
cannam@85
|
100 # endif
|