summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMohamed Tarek <mt@rockbox.org>2009-10-25 18:11:55 +0000
committerMohamed Tarek <mt@rockbox.org>2009-10-25 18:11:55 +0000
commite0d8202599cdf79b1b07aceb561e34418b02c067 (patch)
tree5768def7e599901ff6f808f049617a4ecff25ae2 /apps
parent1e4c2fd9d25e6831dd2a605071c48203db4b2929 (diff)
downloadrockbox-e0d8202599cdf79b1b07aceb561e34418b02c067.zip
rockbox-e0d8202599cdf79b1b07aceb561e34418b02c067.tar.gz
rockbox-e0d8202599cdf79b1b07aceb561e34418b02c067.tar.bz2
rockbox-e0d8202599cdf79b1b07aceb561e34418b02c067.tar.xz
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
Diffstat (limited to 'apps')
-rw-r--r--apps/metadata/metadata_parsers.h1
-rw-r--r--apps/metadata/mp3.c2
-rw-r--r--apps/metadata/rm.c50
3 files changed, 4 insertions, 49 deletions
diff --git a/apps/metadata/metadata_parsers.h b/apps/metadata/metadata_parsers.h
index 20a71c9..e8f1832 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 d9d6212..84c565b 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 c9afa1e..f89f36f 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];