summaryrefslogtreecommitdiff
path: root/apps/metadata/mp3.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/metadata/mp3.c')
-rw-r--r--apps/metadata/mp3.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c
index 2401e03a6c..0a4592be93 100644
--- a/apps/metadata/mp3.c
+++ b/apps/metadata/mp3.c
@@ -292,8 +292,9 @@ static int parsegenre( struct mp3entry* entry, char* tag, int bufferpos )
292 } 292 }
293} 293}
294 294
295#if CONFIG_CODEC == SWCODEC 295/* parse user defined text, looking for album artist and replaygain
296/* parse user defined text, looking for replaygain information. */ 296 * information.
297 */
297static int parseuser( struct mp3entry* entry, char* tag, int bufferpos ) 298static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
298{ 299{
299 char* value = NULL; 300 char* value = NULL;
@@ -305,13 +306,24 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
305 * parse it 306 * parse it
306 */ 307 */
307 value = tag + desc_len + 1; 308 value = tag + desc_len + 1;
308 value_len = parse_replaygain(tag, value, entry, tag, 309 value_len = bufferpos - (tag - entry->id3v2buf);
309 bufferpos - (tag - entry->id3v2buf)); 310
311 if (!strcasecmp(tag, "ALBUM ARTIST")) {
312 strncpy(tag, value, value_len);
313 tag[value_len - 1] = 0;
314 entry->albumartist = tag;
315#if CONFIG_CODEC == SWCODEC
316 } else {
317 value_len = parse_replaygain(tag, value, entry, tag,
318 value_len);
319#endif
320 }
310 } 321 }
311 322
312 return tag - entry->id3v2buf + value_len; 323 return tag - entry->id3v2buf + value_len;
313} 324}
314 325
326#if CONFIG_CODEC == SWCODEC
315/* parse RVA2 binary data and convert to replaygain information. */ 327/* parse RVA2 binary data and convert to replaygain information. */
316static int parserva2( struct mp3entry* entry, char* tag, int bufferpos ) 328static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
317{ 329{
@@ -427,8 +439,8 @@ static const struct tag_resolver taglist[] = {
427 { "COMM", 4, offsetof(struct mp3entry, comment), NULL, false }, 439 { "COMM", 4, offsetof(struct mp3entry, comment), NULL, false },
428 { "TCON", 4, offsetof(struct mp3entry, genre_string), &parsegenre, false }, 440 { "TCON", 4, offsetof(struct mp3entry, genre_string), &parsegenre, false },
429 { "TCO", 3, offsetof(struct mp3entry, genre_string), &parsegenre, false }, 441 { "TCO", 3, offsetof(struct mp3entry, genre_string), &parsegenre, false },
430#if CONFIG_CODEC == SWCODEC
431 { "TXXX", 4, 0, &parseuser, false }, 442 { "TXXX", 4, 0, &parseuser, false },
443#if CONFIG_CODEC == SWCODEC
432 { "RVA2", 4, 0, &parserva2, true }, 444 { "RVA2", 4, 0, &parserva2, true },
433#endif 445#endif
434 { "UFID", 4, 0, &parsembtid, false }, 446 { "UFID", 4, 0, &parsembtid, false },