diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2009-05-30 14:24:16 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2009-05-30 14:24:16 +0000 |
commit | 0b495f0a189db12131bd049e26d6695564495806 (patch) | |
tree | ed4da79f4ce98db0b3649772e80d2cc1bab66fd9 /apps/metadata/ogg.c | |
parent | 31c279e8802938cde7b1fda619701aaf25db7fbf (diff) | |
download | rockbox-0b495f0a189db12131bd049e26d6695564495806.tar.gz rockbox-0b495f0a189db12131bd049e26d6695564495806.zip |
Improved Vorbis comment reader. The tags no longer need to fit in the first Ogg page to be fully read (album art can make the tags not fit).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21134 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata/ogg.c')
-rw-r--r-- | apps/metadata/ogg.c | 59 |
1 files changed, 1 insertions, 58 deletions
diff --git a/apps/metadata/ogg.c b/apps/metadata/ogg.c index cd4c85f46e..3a3cb29998 100644 --- a/apps/metadata/ogg.c +++ b/apps/metadata/ogg.c @@ -115,64 +115,7 @@ bool get_ogg_metadata(int fd, struct mp3entry* id3) * one from the last page (since we only support a single bitstream). */ serial = get_long_le(&buf[14]); - - /* Minimum header length for Ogg pages is 27. */ - if (read(fd, buf, 27) < 27) - { - return false; - } - - if (memcmp(buf, "OggS", 4) !=0 ) - { - return false; - } - - segments = buf[26]; - - /* read in segment table */ - if (read(fd, buf, segments) < segments) - { - return false; - } - - /* The second packet in a vorbis stream is the comment packet. It *may* - * extend beyond the second page, but usually does not. Here we find the - * length of the comment packet (or the rest of the page if the comment - * packet extends to the third page). - */ - for (i = 0; i < segments; i++) - { - remaining += buf[i]; - - /* The last segment of a packet is always < 255 bytes */ - if (buf[i] < 255) - { - break; - } - } - - comment_size = remaining; - - if (id3->codectype == AFMT_OGG_VORBIS) { - /* Now read in packet header (type and id string) */ - if (read(fd, buf, 7) < 7) - { - return false; - } - - remaining -= 7; - - /* The first byte of a packet is the packet type; comment packets are - * type 3. - */ - if (buf[0] != 3) - { - return false; - } - } - - /* Failure to read the tags isn't fatal. */ - read_vorbis_tags(fd, id3, remaining); + comment_size = read_vorbis_tags(fd, id3, remaining); /* We now need to search for the last page in the file - identified by * by ('O','g','g','S',0) and retrieve totalsamples. |