ref: b2fa9c0cbf6951af0a0b06a48e9ee2f8fbcb6bb5
parent: e02e61c6abc2a9c127dd69a4da8b9f486fd66838
author: Tevo <estevan.cps@gmail.com>
date: Sat Feb 13 20:36:46 EST 2021
Handle FLAGS properly
--- a/cue.c
+++ b/cue.c
@@ -155,6 +155,14 @@
}
void
+setflags(Cuesheet *c, int flags)
+{
+ if(c->curentry == nil)
+ parserfatal("flag outside of track");
+ c->curentry->flags = flags;
+}
+
+void
addfile(Cuesheet *c, char *name, int format)
{
AFile *new;
--- a/cue.y
+++ b/cue.y
@@ -22,6 +22,7 @@
%type <i> filetype
%type <time> timestamp
+%type <i> flag flags
%token CATALOG CDTEXTFILE FLAGS DCP CHAN4 PREEMPH SCMS INDEX
%token ISRC PERFORMER POSTGAP PREGAP SONGWRITER TITLE TRACK
@@ -39,6 +40,18 @@
| TRACK INTEGER AUDIO { addnewtrack(cursheet, $2); }
| INDEX INTEGER timestamp { settimestamp(cursheet, $2, $3); }
| CATALOG MCN { setmcn(cursheet, $2); }
+ | FLAGS flags { setflags(cursheet, $2); }
+ ;
+
+flags: { $$ = 0; }
+ | flags flag { $$ = $1 | $2; }
+ ;
+
+flag:
+ DCP { $$ = FLAG_DCP; }
+ | CHAN4 { $$ = FLAG_4CH; }
+ | PREEMPH { $$ = FLAG_PRE; }
+ | SCMS { $$ = FLAG_SCMS; }
;
filetype:
--- a/cuefs.h
+++ b/cuefs.h
@@ -36,6 +36,14 @@
AAC, FLAC, OGG, OPUS, UNKNOWN
};
+enum
+{
+ FLAG_DCP = (1<<0),
+ FLAG_4CH = (1<<1),
+ FLAG_PRE = (1<<2),
+ FLAG_SCMS = (1<<3),
+};
+
typedef struct Timestamp Timestamp;
typedef struct AFile AFile;
typedef struct Start Start;
@@ -66,7 +74,7 @@
Cuesheet *sheet;
Start *starts;
AFile *file;
- int index;
+ int index, flags;
char *title, *performer;
Entry *next;
};
@@ -87,6 +95,7 @@
Cuesheet* newsheet(void);
void freesheet(Cuesheet*);
+void setflags(Cuesheet*, int);
void setmcn(Cuesheet*, char*);
void setperformer(Cuesheet*, char*);
void settitle(Cuesheet*, char*);