summaryrefslogtreecommitdiff
path: root/apps/metadata/rm.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/metadata/rm.c')
-rw-r--r--apps/metadata/rm.c50
1 files changed, 2 insertions, 48 deletions
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
91static 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
137static inline int real_read_audio_stream_info(int fd, RMContext *rmctx) 91static 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];