diff options
Diffstat (limited to 'firmware/id3.c')
-rw-r--r-- | firmware/id3.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/firmware/id3.c b/firmware/id3.c index 2fd7894de8..a3d6297c14 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -1164,10 +1164,8 @@ static int getsonglength(int fd, struct mp3entry *entry) | |||
1164 | * about an MP3 file and updates it's entry accordingly. | 1164 | * about an MP3 file and updates it's entry accordingly. |
1165 | * | 1165 | * |
1166 | Note, that this returns true for successful, false for error! */ | 1166 | Note, that this returns true for successful, false for error! */ |
1167 | bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool v1first) | 1167 | bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename) |
1168 | { | 1168 | { |
1169 | int v1found = false; | ||
1170 | |||
1171 | #if CONFIG_CODEC != SWCODEC | 1169 | #if CONFIG_CODEC != SWCODEC |
1172 | memset(entry, 0, sizeof(struct mp3entry)); | 1170 | memset(entry, 0, sizeof(struct mp3entry)); |
1173 | #endif | 1171 | #endif |
@@ -1180,10 +1178,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool | |||
1180 | entry->tracknum = 0; | 1178 | entry->tracknum = 0; |
1181 | entry->discnum = 0; | 1179 | entry->discnum = 0; |
1182 | 1180 | ||
1183 | if(v1first) | 1181 | if (entry->id3v2len) |
1184 | v1found = setid3v1title(fd, entry); | ||
1185 | |||
1186 | if (!v1found && entry->id3v2len) | ||
1187 | setid3v2title(fd, entry); | 1182 | setid3v2title(fd, entry); |
1188 | int len = getsonglength(fd, entry); | 1183 | int len = getsonglength(fd, entry); |
1189 | if (len < 0) | 1184 | if (len < 0) |
@@ -1194,9 +1189,8 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool | |||
1194 | the true size of the MP3 stream */ | 1189 | the true size of the MP3 stream */ |
1195 | entry->filesize -= entry->first_frame_offset; | 1190 | entry->filesize -= entry->first_frame_offset; |
1196 | 1191 | ||
1197 | /* only seek to end of file if no id3v2 tags were found, | 1192 | /* only seek to end of file if no id3v2 tags were found */ |
1198 | and we already haven't looked for a v1 tag */ | 1193 | if (!entry->id3v2len) { |
1199 | if (!v1first && !entry->id3v2len) { | ||
1200 | setid3v1title(fd, entry); | 1194 | setid3v1title(fd, entry); |
1201 | } | 1195 | } |
1202 | 1196 | ||
@@ -1209,7 +1203,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool | |||
1209 | } | 1203 | } |
1210 | 1204 | ||
1211 | /* Note, that this returns false for successful, true for error! */ | 1205 | /* Note, that this returns false for successful, true for error! */ |
1212 | bool mp3info(struct mp3entry *entry, const char *filename, bool v1first) | 1206 | bool mp3info(struct mp3entry *entry, const char *filename) |
1213 | { | 1207 | { |
1214 | int fd; | 1208 | int fd; |
1215 | bool result; | 1209 | bool result; |
@@ -1218,7 +1212,7 @@ bool mp3info(struct mp3entry *entry, const char *filename, bool v1first) | |||
1218 | if (fd < 0) | 1212 | if (fd < 0) |
1219 | return true; | 1213 | return true; |
1220 | 1214 | ||
1221 | result = !get_mp3_metadata(fd, entry, filename, v1first); | 1215 | result = !get_mp3_metadata(fd, entry, filename); |
1222 | 1216 | ||
1223 | close(fd); | 1217 | close(fd); |
1224 | 1218 | ||