libtags, zuke: add *.mod support (thanks kemal)
This commit is contained in:
parent
83277da309
commit
b0e2ea4e5f
5 changed files with 55 additions and 1 deletions
|
@ -9,6 +9,7 @@ OFILES=\
|
|||
id3v2.$O\
|
||||
it.$O\
|
||||
m4a.$O\
|
||||
mod.$O\
|
||||
opus.$O\
|
||||
s3m.$O\
|
||||
tags.$O\
|
||||
|
|
46
sys/src/cmd/audio/libtags/mod.c
Normal file
46
sys/src/cmd/audio/libtags/mod.c
Normal file
|
@ -0,0 +1,46 @@
|
|||
#include "tagspriv.h"
|
||||
|
||||
/* insane. */
|
||||
static char* variants[] =
|
||||
{
|
||||
"M.K.",
|
||||
"M!K!",
|
||||
"M&K!",
|
||||
"N.T.",
|
||||
"NSMS",
|
||||
"FLT4",
|
||||
"M\0\0\0",
|
||||
"8\0\0\0",
|
||||
"FEST",
|
||||
"FLT8",
|
||||
"CD81",
|
||||
"OCTA",
|
||||
"OKTA",
|
||||
"16CN",
|
||||
"32CN",
|
||||
nil,
|
||||
};
|
||||
|
||||
int
|
||||
tagmod(Tagctx *ctx)
|
||||
{
|
||||
char d[20+1];
|
||||
int i;
|
||||
|
||||
if (ctx->seek(ctx, 1080, 0) != 1080)
|
||||
return -1;
|
||||
if (ctx->read(ctx, d, 4) != 4)
|
||||
return -1;
|
||||
for (i = 0; ; i++)
|
||||
if (variants[i] == nil)
|
||||
return -1;
|
||||
else if (memcmp(d, variants[i], 4) == 0)
|
||||
break;
|
||||
memset(d, 0, sizeof d);
|
||||
if (ctx->seek(ctx, 0, 0) != 0)
|
||||
return -1;
|
||||
if (ctx->read(ctx, d, 20) != 20)
|
||||
return -1;
|
||||
txtcb(ctx, Ttitle, "", d);
|
||||
return 0;
|
||||
}
|
|
@ -18,6 +18,7 @@ extern int tags3m(Tagctx *ctx);
|
|||
extern int tagvorbis(Tagctx *ctx);
|
||||
extern int tagwav(Tagctx *ctx);
|
||||
extern int tagxm(Tagctx *ctx);
|
||||
extern int tagmod(Tagctx *ctx);
|
||||
|
||||
static const Getter g[] =
|
||||
{
|
||||
|
@ -31,6 +32,7 @@ static const Getter g[] =
|
|||
{tagit, Fit},
|
||||
{tagxm, Fxm},
|
||||
{tags3m, Fs3m},
|
||||
{tagmod, Fmod},
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
@ -33,6 +33,7 @@ enum
|
|||
Fit,
|
||||
Fxm,
|
||||
Fs3m,
|
||||
Fmod,
|
||||
|
||||
Fmax,
|
||||
};
|
||||
|
|
|
@ -31,6 +31,7 @@ static char *fmts[] =
|
|||
[Fit] = "mod",
|
||||
[Fxm] = "mod",
|
||||
[Fs3m] = "mod",
|
||||
[Fmod] = "mod",
|
||||
};
|
||||
|
||||
static Meta *
|
||||
|
@ -196,7 +197,10 @@ scanfile(char *path)
|
|||
}
|
||||
|
||||
if(ctx.duration == 0){
|
||||
if(ctx.format == Fit || ctx.format == Fxm || ctx.format == Fs3m)
|
||||
if(ctx.format == Fit ||
|
||||
ctx.format == Fxm ||
|
||||
ctx.format == Fs3m ||
|
||||
ctx.format == Fmod)
|
||||
ctx.duration = modduration(path);
|
||||
if(ctx.duration == 0)
|
||||
fprint(2, "%s: no duration\n", path);
|
||||
|
|
Loading…
Reference in a new issue