Skip to content

Commit f35fd67

Browse files
ciros88lipnitsk
authored andcommitted
add CUE_FPS macro exposed to external consumers
1 parent fa4eb16 commit f35fd67

File tree

6 files changed

+13
-17
lines changed

6 files changed

+13
-17
lines changed

libcue.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ extern "C" {
1818
#define CUE_EXPORT __attribute__((visibility("default")))
1919
#endif
2020

21+
/* Frames per second */
22+
#define CUE_FPS (75)
23+
2124
/*
2225
* disc modes
2326
* DATA FORM OF MAIN DATA (5.29.2.8)

t/multiple_files.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
int tests_run;
88

9-
/* Frames per second */
10-
#define FPS (75)
11-
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS)
9+
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS)
1210

1311
static char cue[] = "FILE \"The Specials - Singles - 01 - Gangsters.wav\" WAVE\n"
1412
"TRACK 01 AUDIO\n"

t/noncompliant.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
int tests_run;
88

9-
/* Frames per second */
10-
#define FPS (75)
11-
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS)
9+
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS)
1210

1311
static char cue[] =
1412
"FILE \"The Specials - Singles - 01 - Gangsters.flac\" FLAC\n"

t/single_idx_00.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
int tests_run;
88

9-
/* Frames per second */
10-
#define FPS (75)
11-
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS)
9+
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS)
1210

1311
static char cue[] =
1412
"PERFORMER \"Bloc Party\"\n"

t/standard_cue.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66

77
int tests_run;
88

9-
/* Frames per second */
10-
#define FPS (75)
11-
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*FPS)
9+
#define MSF_TO_F(m,s,f) ((f) + ((m)*60 + (s))*CUE_FPS)
1210

1311
static char cue[] = "REM GENRE Alternative\n"
1412
"REM DATE 1991\n"

time.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,20 @@
1010
#include <string.h>
1111

1212
#include "cue_time.h"
13+
#include "libcue.h"
1314

1415
long time_msf_to_frame(int m, int s, int f)
1516
{
16-
if (m < 0 || m > 99 || s < 0 || s >= 60 || f < 0 || f >= 75) {
17+
if (m < 0 || m > 99 || s < 0 || s >= 60 || f < 0 || f >= CUE_FPS) {
1718
return -1;
1819
}
19-
return (m * 60 + s) * 75 + f;
20+
return (m * 60 + s) * CUE_FPS + f;
2021
}
2122

2223
void time_frame_to_msf(long frame, int *m, int *s, int *f)
2324
{
24-
*f = frame % 75; /* 0 <= frames <= 74 */
25-
frame /= 75;
25+
*f = frame % CUE_FPS; /* 0 <= frames <= 74 */
26+
frame /= CUE_FPS;
2627
*s = frame % 60; /* 0 <= seconds <= 59 */
2728
frame /= 60;
2829
*m = frame; /* 0 <= minutes */
@@ -34,7 +35,7 @@ char *time_frame_to_mmssff(long f)
3435
static char msf[9];
3536
int minutes, seconds, frames;
3637

37-
if (f < 0 || f >= 75 * 60 * 100) {
38+
if (f < 0 || f >= CUE_FPS * 60 * 100) {
3839
strcpy(msf, "00:00:00");
3940
return msf;
4041
}

0 commit comments

Comments
 (0)