/* * http://en.wikipedia.org/wiki/ID3 * Space-padded strings are mentioned there. This is wrong and is a lie. */ #include "tagspriv.h" enum { Insz = 128, Outsz = 61, }; int tagid3v1(Tagctx *ctx) { uint8_t *in, *out; if(ctx->bufsz < Insz+Outsz) return -1; in = (uint8_t*)ctx->buf; out = in + Insz; if(ctx->seek(ctx, -Insz, 2) < 0) return -1; if(ctx->read(ctx, in, Insz) != Insz || memcmp(in, "TAG", 3) != 0) return -1; if((ctx->found & 1< 0) txtcb(ctx, Ttitle, "", out); if((ctx->found & 1< 0) txtcb(ctx, Tartist, "", out); if((ctx->found & 1< 0) txtcb(ctx, Talbum, "", out); in[93+4] = 0; if((ctx->found & 1<found & 1<found & 1< 0){ snprintf((char*)out, Outsz, "%d", in[126]); txtcb(ctx, Ttrack, "", out); } if((ctx->found & 1<