diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-02 03:58:54 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2003-03-02 03:58:54 +0000 |
| commit | cc136c5c606556a59fcf6ca15ed76e2c1ce2c085 (patch) | |
| tree | 615dc6d3c5809dadecf22adf080d51eb78080e4c | |
| parent | 2d42f9e4e32415537faff3150de3251edd4143c3 (diff) | |
| download | rockbox-cc136c5c606556a59fcf6ca15ed76e2c1ce2c085.zip rockbox-cc136c5c606556a59fcf6ca15ed76e2c1ce2c085.tar.gz rockbox-cc136c5c606556a59fcf6ca15ed76e2c1ce2c085.tar.bz2 rockbox-cc136c5c606556a59fcf6ca15ed76e2c1ce2c085.tar.xz | |
Now correctly skips ID3V1 tags to avoid gaps between tracks
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3365 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/mpeg.c | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index b0f1835..47b93bf 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -1717,18 +1717,40 @@ static void mpeg_thread(void) t2 = current_tick; DEBUGF("time: %d\n", t2 - t1); DEBUGF("R: %x\n", len); - - /* Make sure that the write pointer is at a word - boundary when we reach the end of the file */ - if (len < amount_to_read) { - /* Skip id3v1 tag */ - DEBUGF("Skipping ID3v1 tag\n"); - len -= id3tags[tag_read_idx]->id3.id3v1len; - /* The very rare case when the buffer wrapped - inside the tag must be taken care of */ - if(len < 0) - len = 0; - } + + /* Now make sure that we don't feed the MAS with ID3V1 + data */ + if (len < amount_to_read) + { + int tagptr = mp3buf_write + len - 128; + int i; + char *tag = "TAG"; + int taglen = 128; + + for(i = 0;i < 3;i++) + { + if(tagptr >= mp3buflen) + tagptr -= mp3buflen; + + if(mp3buf[tagptr] != tag[i]) + taglen = 0; + + tagptr++; + } + + if(taglen) + { + /* Skip id3v1 tag */ + DEBUGF("Skipping ID3v1 tag\n"); + len -= taglen; + + /* The very rare case when the entire tag + wasn't read in this read() call must be + taken care of */ + if(len < 0) + len = 0; + } + } mp3buf_write += len; |