diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2005-07-07 09:53:02 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2005-07-07 09:53:02 +0000 |
| commit | df80798a301a1023f59c0a7a4f221dcf504ec3cc (patch) | |
| tree | 27f208559363e658c5b90119d2ca16f6090eefec /apps | |
| parent | 2cc64c4572ead2b90e2e3999e31847d18286715b (diff) | |
| download | rockbox-df80798a301a1023f59c0a7a4f221dcf504ec3cc.zip rockbox-df80798a301a1023f59c0a7a4f221dcf504ec3cc.tar.gz rockbox-df80798a301a1023f59c0a7a4f221dcf504ec3cc.tar.bz2 rockbox-df80798a301a1023f59c0a7a4f221dcf504ec3cc.tar.xz | |
Lame hack to strip ID3v1 tags from MP3 playback, so they can play back without gaps
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7054 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/playback.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/apps/playback.c b/apps/playback.c index f9caff1..c053bc1 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -626,6 +626,45 @@ void yield_codecs(void) yield(); } +/* FIXME: This code should be made more generic and move to metadata.c */ +void strip_id3v1_tag(void) +{ + int i; + static const unsigned char tag[] = "TAG"; + int tagptr; + bool found = true; + + if (codecbufused >= 128) + { + tagptr = buf_widx - 128; + if (tagptr < 0) + tagptr += codecbuflen; + + for(i = 0;i < 3;i++) + { + if(tagptr >= codecbuflen) + tagptr -= codecbuflen; + + if(codecbuf[tagptr] != tag[i]) + { + found = false; + break; + } + + tagptr++; + } + + if(found) + { + /* Skip id3v1 tag */ + logf("Skipping ID3v1 tag\n"); + buf_widx -= 128; + tracks[track_widx].available -= 128; + codecbufused -= 128; + } + } +} + void audio_fill_file_buffer(void) { long i, size; @@ -651,6 +690,7 @@ void audio_fill_file_buffer(void) rc = read(current_fd, &codecbuf[buf_widx], rc); if (rc <= 0) { tracks[track_widx].filerem = 0; + strip_id3v1_tag(); break ; } @@ -965,6 +1005,9 @@ bool audio_load_track(int offset, bool start_play, int peek_offset) } else { logf("Completely buf."); close(fd); + + strip_id3v1_tag(); + if (++track_widx >= MAX_TRACK) { track_widx = 0; } |