Parse ID3v2.3 TLEN as a fallback for duration detection
authorFrançois Revol <revol@free.fr>
Mon, 23 Mar 2020 18:33:57 +0000 (19:33 +0100)
committerAntoine Jacquet <royale@zerezo.com>
Fri, 27 Mar 2020 17:09:27 +0000 (18:09 +0100)
Some files (VBR?) don't get the duration detected properly, so we use
this as a default value.

fapg.c

diff --git a/fapg.c b/fapg.c
index 745e6ae..bd2b3f0 100644 (file)
--- a/fapg.c
+++ b/fapg.c
@@ -768,6 +768,9 @@ void parse_mp3(unsigned char *file)
                     /* genre=atoi(&genrebuf[1]); */
                     genre = atoi(c + 12);
                 }
+                if(strncmp(c, "TLEN", 4) == 0) {
+                    duration = atoi(c + 11) / 1000;
+                }
                 c += size + 10;
             }
     }