timer.h

00001 /*
00002  * libmad - MPEG audio decoder library
00003  * Copyright (C) 2000-2003 Underbit Technologies, Inc.
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  *
00019  * $Id: timer.h,v 1.1 2003/08/31 19:00:17 gabest Exp $
00020  */
00021 
00022 # ifndef LIBMAD_TIMER_H
00023 # define LIBMAD_TIMER_H
00024 
00025 typedef struct {
00026   signed long seconds;          /* whole seconds */
00027   unsigned long fraction;       /* 1/MAD_TIMER_RESOLUTION seconds */
00028 } mad_timer_t;
00029 
00030 extern mad_timer_t const mad_timer_zero;
00031 
00032 # define MAD_TIMER_RESOLUTION   352800000UL
00033 
00034 enum mad_units {
00035   MAD_UNITS_HOURS        =    -2,
00036   MAD_UNITS_MINUTES      =    -1,
00037   MAD_UNITS_SECONDS      =     0,
00038 
00039   /* metric units */
00040 
00041   MAD_UNITS_DECISECONDS  =    10,
00042   MAD_UNITS_CENTISECONDS =   100,
00043   MAD_UNITS_MILLISECONDS =  1000,
00044 
00045   /* audio sample units */
00046 
00047   MAD_UNITS_8000_HZ      =  8000,
00048   MAD_UNITS_11025_HZ     = 11025,
00049   MAD_UNITS_12000_HZ     = 12000,
00050 
00051   MAD_UNITS_16000_HZ     = 16000,
00052   MAD_UNITS_22050_HZ     = 22050,
00053   MAD_UNITS_24000_HZ     = 24000,
00054 
00055   MAD_UNITS_32000_HZ     = 32000,
00056   MAD_UNITS_44100_HZ     = 44100,
00057   MAD_UNITS_48000_HZ     = 48000,
00058 
00059   /* video frame/field units */
00060 
00061   MAD_UNITS_24_FPS       =    24,
00062   MAD_UNITS_25_FPS       =    25,
00063   MAD_UNITS_30_FPS       =    30,
00064   MAD_UNITS_48_FPS       =    48,
00065   MAD_UNITS_50_FPS       =    50,
00066   MAD_UNITS_60_FPS       =    60,
00067 
00068   /* CD audio frames */
00069 
00070   MAD_UNITS_75_FPS       =    75,
00071 
00072   /* video drop-frame units */
00073 
00074   MAD_UNITS_23_976_FPS   =   -24,
00075   MAD_UNITS_24_975_FPS   =   -25,
00076   MAD_UNITS_29_97_FPS    =   -30,
00077   MAD_UNITS_47_952_FPS   =   -48,
00078   MAD_UNITS_49_95_FPS    =   -50,
00079   MAD_UNITS_59_94_FPS    =   -60
00080 };
00081 
00082 # define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
00083 
00084 int mad_timer_compare(mad_timer_t, mad_timer_t);
00085 
00086 # define mad_timer_sign(timer)  mad_timer_compare((timer), mad_timer_zero)
00087 
00088 void mad_timer_negate(mad_timer_t *);
00089 mad_timer_t mad_timer_abs(mad_timer_t);
00090 
00091 void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
00092 void mad_timer_add(mad_timer_t *, mad_timer_t);
00093 void mad_timer_multiply(mad_timer_t *, signed long);
00094 
00095 signed long mad_timer_count(mad_timer_t, enum mad_units);
00096 unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
00097 void mad_timer_string(mad_timer_t, char *, char const *,
00098                       enum mad_units, enum mad_units, unsigned long);
00099 
00100 # endif

Generated on Tue Dec 13 14:47:49 2005 for guliverkli by  doxygen 1.4.5