From 501ab1a17f5570097ca75c93160ba5dfed337545 Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Sat, 13 Aug 2005 08:09:28 +0000 Subject: [PATCH] Support the LAME Info header too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7313 a1c6a512-1295-4272-9138-f99709370657 --- firmware/mp3data.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/firmware/mp3data.c b/firmware/mp3data.c index 41265f96ea..260412b68a 100644 --- a/firmware/mp3data.c +++ b/firmware/mp3data.c @@ -406,11 +406,12 @@ int get_mp3file_info(int fd, struct mp3info *info) vbrheader = frame + 17; } - if (!memcmp(vbrheader, "Xing", 4)) + if (!memcmp(vbrheader, "Xing", 4) + || !memcmp(vbrheader, "Info", 4)) { int i = 8; /* Where to start parsing info */ - DEBUGF("Xing header\n"); + DEBUGF("Xing/Info header\n"); /* Remember where in the file the Xing header is */ info->vbr_header_pos = lseek(fd, 0, SEEK_CUR) - info->frame_size; @@ -427,10 +428,9 @@ int get_mp3file_info(int fd, struct mp3info *info) if(!mp3headerinfo(info, header)) return -5; - /* Yes, it is a VBR file */ - info->is_vbr = true; - info->is_xing_vbr = true; - + /* Is it a VBR file? */ + info->is_vbr = info->is_xing_vbr = !memcmp(vbrheader, "Xing", 4); + if(vbrheader[7] & VBR_FRAMES_FLAG) /* Is the frame count there? */ { info->frame_count = BYTES2INT(vbrheader[i], vbrheader[i+1], @@ -533,13 +533,6 @@ int get_mp3file_info(int fd, struct mp3info *info) } } - /* Is it a LAME Info frame? */ - if (!memcmp(vbrheader, "Info", 4)) - { - /* Make sure we skip this frame in playback */ - bytecount += info->frame_size; - } - return bytecount; }