summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/timer.c
Side-by-side diff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/timer.c') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/timer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/libmad/timer.c b/core/multimedia/opieplayer/libmad/timer.c
index 299fe0b..fa377d0 100644
--- a/core/multimedia/opieplayer/libmad/timer.c
+++ b/core/multimedia/opieplayer/libmad/timer.c
@@ -1,15 +1,15 @@
/*
* libmad - MPEG audio decoder library
- * Copyright (C) 2000-2001 Robert Leslie
+ * Copyright (C) 2000-2004 Underbit Technologies, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
@@ -69,25 +69,25 @@ void mad_timer_negate(mad_timer_t *timer)
if (timer->fraction) {
timer->seconds -= 1;
timer->fraction = MAD_TIMER_RESOLUTION - timer->fraction;
}
}
/*
* NAME: timer->abs()
* DESCRIPTION: return the absolute value of a timer
*/
mad_timer_t mad_timer_abs(mad_timer_t timer)
{
- if (mad_timer_sign(timer) < 0)
+ if (timer.seconds < 0)
mad_timer_negate(&timer);
return timer;
}
/*
* NAME: reduce_timer()
* DESCRIPTION: carry timer fraction into seconds
*/
static
void reduce_timer(mad_timer_t *timer)
{
@@ -318,25 +318,26 @@ signed long mad_timer_count(mad_timer_t timer, enum mad_units units)
}
/*
* NAME: timer->fraction()
* DESCRIPTION: return fractional part of timer in arbitrary terms
*/
unsigned long mad_timer_fraction(mad_timer_t timer, unsigned long denom)
{
timer = mad_timer_abs(timer);
switch (denom) {
case 0:
- return MAD_TIMER_RESOLUTION / timer.fraction;
+ return timer.fraction ?
+ MAD_TIMER_RESOLUTION / timer.fraction : MAD_TIMER_RESOLUTION + 1;
case MAD_TIMER_RESOLUTION:
return timer.fraction;
default:
return scale_rational(timer.fraction, MAD_TIMER_RESOLUTION, denom);
}
}
/*
* NAME: timer->string()
* DESCRIPTION: write a string representation of a timer using a template