diff --git a/cue_parser.y b/cue_parser.y index c648e04..3f03eb6 100644 --- a/cue_parser.y +++ b/cue_parser.y @@ -10,7 +10,7 @@ #include #include "cd.h" -#include "time.h" +#include "cue_time.h" #ifdef YY_BUF_SIZE #undef YY_BUF_SIZE diff --git a/time.h b/cue_time.h similarity index 79% rename from time.h rename to cue_time.h index 3c6bd51..c52e43f 100644 --- a/time.h +++ b/cue_time.h @@ -1,12 +1,12 @@ /* - * time.h -- time declarations + * cue_time.h -- time declarations * * Copyright (C) 2004, 2005, 2006, 2007 Svend Sorensen * For license terms, see the file COPYING in this distribution. */ -#ifndef TIME_H -#define TIME_H +#ifndef CUE_TIME_H +#define CUE_TIME_H long time_msf_to_frame(int m, int s, int f); void time_frame_to_msf(long frame, int *m, int *s, int *f); diff --git a/libcue.h b/libcue.h index e2c70f8..346e1b5 100644 --- a/libcue.h +++ b/libcue.h @@ -18,6 +18,9 @@ extern "C" { #define CUE_EXPORT __attribute__((visibility("default"))) #endif +/* Frames per second */ +#define CUE_FPS (75) + /* * disc modes * DATA FORM OF MAIN DATA (5.29.2.8) diff --git a/t/multiple_files.c b/t/multiple_files.c index 04017d9..9f7c5af 100644 --- a/t/multiple_files.c +++ b/t/multiple_files.c @@ -6,9 +6,7 @@ int tests_run; -/* Frames per second */ -#define FPS (75) -#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS) +#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS) static char cue[] = "FILE \"The Specials - Singles - 01 - Gangsters.wav\" WAVE\n" "TRACK 01 AUDIO\n" diff --git a/t/noncompliant.c b/t/noncompliant.c index fb1dcd4..68dbde7 100644 --- a/t/noncompliant.c +++ b/t/noncompliant.c @@ -6,9 +6,7 @@ int tests_run; -/* Frames per second */ -#define FPS (75) -#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS) +#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS) static char cue[] = "FILE \"The Specials - Singles - 01 - Gangsters.flac\" FLAC\n" diff --git a/t/single_idx_00.c b/t/single_idx_00.c index 6eab3d3..6553f1c 100644 --- a/t/single_idx_00.c +++ b/t/single_idx_00.c @@ -6,9 +6,7 @@ int tests_run; -/* Frames per second */ -#define FPS (75) -#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS) +#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS) static char cue[] = "PERFORMER \"Bloc Party\"\n" diff --git a/t/standard_cue.c b/t/standard_cue.c index 4177bf9..94b2536 100644 --- a/t/standard_cue.c +++ b/t/standard_cue.c @@ -6,9 +6,7 @@ int tests_run; -/* Frames per second */ -#define FPS (75) -#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS) +#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS) static char cue[] = "REM GENRE Alternative\n" "REM DATE 1991\n" diff --git a/time.c b/time.c index f442be2..f8175e5 100644 --- a/time.c +++ b/time.c @@ -5,23 +5,25 @@ * For license terms, see the file COPYING in this distribution. */ -#include "time.h" #include #include #include +#include "cue_time.h" +#include "libcue.h" + long time_msf_to_frame(int m, int s, int f) { - if (m < 0 || m > 99 || s < 0 || s >= 60 || f < 0 || f >= 75) { + if (m < 0 || m > 99 || s < 0 || s >= 60 || f < 0 || f >= CUE_FPS) { return -1; } - return (m * 60 + s) * 75 + f; + return (m * 60 + s) * CUE_FPS + f; } void time_frame_to_msf(long frame, int *m, int *s, int *f) { - *f = frame % 75; /* 0 <= frames <= 74 */ - frame /= 75; + *f = frame % CUE_FPS; /* 0 <= frames <= 74 */ + frame /= CUE_FPS; *s = frame % 60; /* 0 <= seconds <= 59 */ frame /= 60; *m = frame; /* 0 <= minutes */ @@ -33,7 +35,7 @@ char *time_frame_to_mmssff(long f) static char msf[9]; int minutes, seconds, frames; - if (f < 0 || f >= 75 * 60 * 100) { + if (f < 0 || f >= CUE_FPS * 60 * 100) { strcpy(msf, "00:00:00"); return msf; }