diff options
author | Mohamed Tarek <mt@rockbox.org> | 2009-10-25 18:11:55 +0000 |
---|---|---|
committer | Mohamed Tarek <mt@rockbox.org> | 2009-10-25 18:11:55 +0000 |
commit | e0d8202599cdf79b1b07aceb561e34418b02c067 (patch) | |
tree | 5768def7e599901ff6f808f049617a4ecff25ae2 | |
parent | 1e4c2fd9d25e6831dd2a605071c48203db4b2929 (diff) | |
download | rockbox-e0d8202599cdf79b1b07aceb561e34418b02c067.tar.gz rockbox-e0d8202599cdf79b1b07aceb561e34418b02c067.zip |
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
-rw-r--r-- | apps/metadata/metadata_parsers.h | 1 | ||||
-rw-r--r-- | apps/metadata/mp3.c | 2 | ||||
-rw-r--r-- | 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 @@ | |||
21 | 21 | ||
22 | char* id3_get_num_genre(unsigned int genre_num); | 22 | char* id3_get_num_genre(unsigned int genre_num); |
23 | int getid3v2len(int fd); | 23 | int getid3v2len(int fd); |
24 | bool setid3v1title(int fd, struct mp3entry *entry); | ||
24 | bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename); | 25 | bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename); |
25 | 26 | ||
26 | bool get_adx_metadata(int fd, struct mp3entry* id3); | 27 | 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) { | |||
555 | * | 555 | * |
556 | * Returns: true if a title was found and created, else false | 556 | * Returns: true if a title was found and created, else false |
557 | */ | 557 | */ |
558 | static bool setid3v1title(int fd, struct mp3entry *entry) | 558 | bool setid3v1title(int fd, struct mp3entry *entry) |
559 | { | 559 | { |
560 | unsigned char buffer[128]; | 560 | unsigned char buffer[128]; |
561 | static const char offsets[] = {3, 33, 63, 97, 93, 125, 127}; | 561 | 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) | |||
88 | } | 88 | } |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | static inline int real_read_id3v1_tags(int fd, struct mp3entry *id3) | ||
92 | { | ||
93 | /* ID3v1 Standard : http://id3.org/id3v1.html */ | ||
94 | char temp[31]; | ||
95 | char *buf = &id3->id3v1buf[0][0]; | ||
96 | long buf_remaining = sizeof(id3->id3v1buf); | ||
97 | |||
98 | lseek(fd, ID3V1_OFFSET, SEEK_END); | ||
99 | read(fd, temp, 3); | ||
100 | temp[3] = '\0'; | ||
101 | if(!strcmp(temp, "TAG")) | ||
102 | { | ||
103 | read_string(fd, temp, sizeof(temp), -1, 30); | ||
104 | parse_tag("title", temp, id3, buf, buf_remaining, 0); | ||
105 | buf += 30; | ||
106 | buf_remaining -= 30; | ||
107 | |||
108 | read_string(fd, temp, sizeof(temp), -1, 30); | ||
109 | parse_tag("artist", temp, id3, buf, buf_remaining, 0); | ||
110 | buf += 30; | ||
111 | buf_remaining -= 30; | ||
112 | |||
113 | read_string(fd, temp, sizeof(temp), -1, 30); | ||
114 | parse_tag("album", temp, id3, buf, buf_remaining, 0); | ||
115 | buf += 30; | ||
116 | buf_remaining -= 30; | ||
117 | |||
118 | read_string(fd, temp, sizeof(temp), -1, 4); | ||
119 | parse_tag("year", temp, id3, buf, buf_remaining, 0); | ||
120 | buf += 4; | ||
121 | buf_remaining -= 4; | ||
122 | |||
123 | read_string(fd, temp, sizeof(temp), -1, 30); | ||
124 | parse_tag("comment", temp, id3, buf, buf_remaining, 0); | ||
125 | buf += 30; | ||
126 | buf_remaining -= 30; | ||
127 | |||
128 | read_string(fd, temp, sizeof(temp), -1, 1); | ||
129 | parse_tag("genre", temp, id3, buf, buf_remaining, 0); | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | return -1; | ||
135 | } | ||
136 | |||
137 | static inline int real_read_audio_stream_info(int fd, RMContext *rmctx) | 91 | static inline int real_read_audio_stream_info(int fd, RMContext *rmctx) |
138 | { | 92 | { |
139 | int skipped = 0; | 93 | int skipped = 0; |
@@ -457,8 +411,8 @@ bool get_rm_metadata(int fd, struct mp3entry* id3) | |||
457 | memset(rmctx,0,sizeof(RMContext)); | 411 | memset(rmctx,0,sizeof(RMContext)); |
458 | if(rm_parse_header(fd, rmctx, id3) < 0) | 412 | if(rm_parse_header(fd, rmctx, id3) < 0) |
459 | return false; | 413 | return false; |
460 | 414 | ||
461 | if(real_read_id3v1_tags(fd, id3)) { | 415 | if (!setid3v1title(fd, id3)) { |
462 | /* file has no id3v1 tags, use the tags from CONT chunk */ | 416 | /* file has no id3v1 tags, use the tags from CONT chunk */ |
463 | id3->title = id3->id3v1buf[0]; | 417 | id3->title = id3->id3v1buf[0]; |
464 | id3->artist = id3->id3v1buf[1]; | 418 | id3->artist = id3->id3v1buf[1]; |