From e0d8202599cdf79b1b07aceb561e34418b02c067 Mon Sep 17 00:00:00 2001 From: Mohamed Tarek Date: Sun, 25 Oct 2009 18:11:55 +0000 Subject: Revert r23339 and use setid3v1title() from metadata/mp3.c instead. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23349 a1c6a512-1295-4272-9138-f99709370657 --- apps/metadata/metadata_parsers.h | 1 + apps/metadata/mp3.c | 2 +- apps/metadata/rm.c | 50 ++-------------------------------------- 3 files changed, 4 insertions(+), 49 deletions(-) diff --git a/apps/metadata/metadata_parsers.h b/apps/metadata/metadata_parsers.h index 20a71c90b9..e8f1832b87 100644 --- a/apps/metadata/metadata_parsers.h +++ b/apps/metadata/metadata_parsers.h @@ -21,6 +21,7 @@ char* id3_get_num_genre(unsigned int genre_num); int getid3v2len(int fd); +bool setid3v1title(int fd, struct mp3entry *entry); bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename); bool get_adx_metadata(int fd, struct mp3entry* id3); diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c index d9d6212f47..84c565b8be 100644 --- a/apps/metadata/mp3.c +++ b/apps/metadata/mp3.c @@ -555,7 +555,7 @@ static int unicode_munge(char* string, char* utf8buf, int *len) { * * Returns: true if a title was found and created, else false */ -static bool setid3v1title(int fd, struct mp3entry *entry) +bool setid3v1title(int fd, struct mp3entry *entry) { unsigned char buffer[128]; static const char offsets[] = {3, 33, 63, 97, 93, 125, 127}; diff --git a/apps/metadata/rm.c b/apps/metadata/rm.c index c9afa1efab..f89f36f556 100644 --- a/apps/metadata/rm.c +++ b/apps/metadata/rm.c @@ -88,52 +88,6 @@ static char* fourcc2str(uint32_t f) } #endif -static inline int real_read_id3v1_tags(int fd, struct mp3entry *id3) -{ - /* ID3v1 Standard : http://id3.org/id3v1.html */ - char temp[31]; - char *buf = &id3->id3v1buf[0][0]; - long buf_remaining = sizeof(id3->id3v1buf); - - lseek(fd, ID3V1_OFFSET, SEEK_END); - read(fd, temp, 3); - temp[3] = '\0'; - if(!strcmp(temp, "TAG")) - { - read_string(fd, temp, sizeof(temp), -1, 30); - parse_tag("title", temp, id3, buf, buf_remaining, 0); - buf += 30; - buf_remaining -= 30; - - read_string(fd, temp, sizeof(temp), -1, 30); - parse_tag("artist", temp, id3, buf, buf_remaining, 0); - buf += 30; - buf_remaining -= 30; - - read_string(fd, temp, sizeof(temp), -1, 30); - parse_tag("album", temp, id3, buf, buf_remaining, 0); - buf += 30; - buf_remaining -= 30; - - read_string(fd, temp, sizeof(temp), -1, 4); - parse_tag("year", temp, id3, buf, buf_remaining, 0); - buf += 4; - buf_remaining -= 4; - - read_string(fd, temp, sizeof(temp), -1, 30); - parse_tag("comment", temp, id3, buf, buf_remaining, 0); - buf += 30; - buf_remaining -= 30; - - read_string(fd, temp, sizeof(temp), -1, 1); - parse_tag("genre", temp, id3, buf, buf_remaining, 0); - - return 0; - } - - return -1; -} - static inline int real_read_audio_stream_info(int fd, RMContext *rmctx) { int skipped = 0; @@ -457,8 +411,8 @@ bool get_rm_metadata(int fd, struct mp3entry* id3) memset(rmctx,0,sizeof(RMContext)); if(rm_parse_header(fd, rmctx, id3) < 0) return false; - - if(real_read_id3v1_tags(fd, id3)) { + + if (!setid3v1title(fd, id3)) { /* file has no id3v1 tags, use the tags from CONT chunk */ id3->title = id3->id3v1buf[0]; id3->artist = id3->id3v1buf[1]; -- cgit v1.2.3