shithub: libtags

Download patch

ref: 17e82bf4cde80c08cf38d331bf0715d38e50971d
parent: ff132dfac2ed09e1351ba9ca46ed96bed2698530
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu Dec 19 14:49:30 EST 2019

id3v2: add a note for possibly reading TOC in the future

--- a/id3v2.c
+++ b/id3v2.c
@@ -299,7 +299,7 @@
 	uint x;
 	int xversion, xlayer, xbitrate;
 
-	if(ctx->read(ctx, ctx->buf, 64) != 64)
+	if(ctx->read(ctx, ctx->buf, 256) != 256)
 		return;
 
 	x = beuint((uchar*)ctx->buf);
@@ -325,9 +325,14 @@
 				ctx->duration = n * samplespf * 1000 / ctx->samplerate;
 			}
 
-			if(ctx->duration == 0 && (x & 2) != 0 && framelen > 0){ /* file size is set */
-				n = beuint(b);
-				ctx->duration = n * samplespf * 1000 / framelen / ctx->samplerate;
+			if((x & 2) != 0){ /* file size is set */
+				n = beuint(b); b += 4;
+				if(ctx->duration == 0 && framelen > 0)
+					ctx->duration = n * samplespf * 1000 / framelen / ctx->samplerate;
+
+				if((x & 4) != 0){ /* TOC is set */
+					/* not doing anything yet */
+				}
 			}
 		}else if(memcmp(&ctx->buf[0x24], "VBRI", 4) == 0){
 			n = beuint((uchar*)&ctx->buf[0x32]);