ref: f4bd018e6acf92993397223e2d2fffff1dd1dbdb
parent: 5f03152c619d5b15ffb100fc325ff8046593d606
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Mar 11 09:20:43 EST 2021
dumb s3m tags parser
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@
| WAV | yes | no | yes |
| IT | yes | no | ??? |
| XM | yes | no | ??? |
+| S3M | yes | no | ??? |
| replay gain | yes | no | ??? |
| size | tiny | bloated | more bloated |
| license | MIT | LGPL | LGPL/MPL |
--- a/mkfile
+++ b/mkfile
@@ -10,6 +10,7 @@
it.$O\
m4a.$O\
opus.$O\
+ s3m.$O\
tags.$O\
utf16.$O\
vorbis.$O\
--- /dev/null
+++ b/s3m.c
@@ -1,0 +1,16 @@
+#include "tagspriv.h"
+
+int
+tags3m(Tagctx *ctx)
+{
+ char d[28+1+1], *s;
+
+ if(ctx->read(ctx, d, 28+1+1) != 28+1+1 || (d[28] != 0x1a && d[28] != 0) || d[29] != 0x10)
+ return -1;
+ d[28] = 0;
+ for(s = d+27; s != d-1 && (*s == ' ' || *s == 0); s--);
+ s[1] = 0;
+ txtcb(ctx, Ttitle, "", d);
+
+ return 0;
+}
--- a/tags.c
+++ b/tags.c
@@ -8,13 +8,14 @@
int format;
};
-extern int tagvorbis(Tagctx *ctx);
extern int tagflac(Tagctx *ctx);
-extern int tagid3v2(Tagctx *ctx);
extern int tagid3v1(Tagctx *ctx);
+extern int tagid3v2(Tagctx *ctx);
extern int tagit(Tagctx *ctx);
extern int tagm4a(Tagctx *ctx);
extern int tagopus(Tagctx *ctx);
+extern int tags3m(Tagctx *ctx);
+extern int tagvorbis(Tagctx *ctx);
extern int tagwav(Tagctx *ctx);
extern int tagxm(Tagctx *ctx);
@@ -29,6 +30,7 @@
{tagwav, Fwav},
{tagit, Fit},
{tagxm, Fxm},
+ {tags3m, Fs3m},
};
void
--- a/tags.h
+++ b/tags.h
@@ -34,6 +34,7 @@
Fwav,
Fit,
Fxm,
+ Fs3m,
Fmax,
};