M flac.c => flac.c +1 -1
@@ 25,7 25,7 @@ tagflac(Tagctx *ctx)
ctx->duration = g * 1000 / ctx->samplerate;
/* skip the rest of the stream info */
- if(ctx->seek(ctx, sz-18, 1) != 8+sz)
+ if(ctx->seek(ctx, sz-18, 1) != ctx->restart+8+sz)
return -1;
for(last = 0; !last;){
M id3v2.c => id3v2.c +4 -0
@@ 27,6 27,8 @@ v2cb(Tagctx *ctx, char *k, char *v)
txtcb(ctx, Tdate, k-1, v);
else if(strcmp(k, "RK") == 0 || strcmp(k, "RCK") == 0)
txtcb(ctx, Ttrack, k-1, v);
+ else if(strcmp(k, "LEN") == 0)
+ ctx->duration = atoi(v);
else if(strcmp(k, "CO") == 0 || strcmp(k, "CON") == 0){
for(; v[0]; v++){
if(v[0] == '(' && v[1] <= '9' && v[1] >= '0'){
@@ 388,6 390,8 @@ header:
if(ver == 2 && (d[5] & (1<<6)) != 0) /* compression */
return -1;
+ ctx->restart = sizeof(d)+sz;
+
if(ver > 2){
if((d[5] & (1<<4)) != 0) /* footer */
sz -= 10;
M tags.c => tags.c +2 -1
@@ 65,6 65,7 @@ tagsget(Tagctx *ctx)
ctx->channels = ctx->samplerate = ctx->bitrate = ctx->duration = 0;
ctx->found = 0;
ctx->format = Funknown;
+ ctx->restart = 0;
res = -1;
for(i = 0; i < nelem(g); i++){
ctx->num = 0;
@@ 72,7 73,7 @@ tagsget(Tagctx *ctx)
ctx->format = g[i].format;
res = 0;
}
- ctx->seek(ctx, 0, 0);
+ ctx->seek(ctx, ctx->restart, 0);
}
return res;
M tags.h => tags.h +1 -0
@@ 83,6 83,7 @@ struct Tagctx
/* Private, don't touch. */
int found;
int num;
+ int restart;
};
/* Parse the file using this function. Returns 0 on success. */