summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/id3.h3
-rw-r--r--firmware/id3.c28
2 files changed, 31 insertions, 0 deletions
diff --git a/firmware/export/id3.h b/firmware/export/id3.h
index 3e4db0674f..da2faf1b12 100644
--- a/firmware/export/id3.h
+++ b/firmware/export/id3.h
@@ -223,6 +223,9 @@ struct mp3entry {
223 223
224 /* Cuesheet support */ 224 /* Cuesheet support */
225 int cuesheet_type; /* 0: none, 1: external, 2: embedded */ 225 int cuesheet_type; /* 0: none, 1: external, 2: embedded */
226
227 /* Musicbrainz Track ID */
228 char* mb_track_id;
226}; 229};
227 230
228enum { 231enum {
diff --git a/firmware/id3.c b/firmware/id3.c
index 3b7d165597..c1541e30df 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -486,6 +486,31 @@ static int parserva2( struct mp3entry* entry, char* tag, int bufferpos )
486} 486}
487#endif 487#endif
488 488
489static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos )
490{
491 char* value = NULL;
492 int desc_len = strlen(tag);
493 /*DEBUGF("MBID len: %d\n", desc_len);*/
494 int value_len = 0;
495
496 if ((tag - entry->id3v2buf + desc_len + 2) < bufferpos)
497 {
498 value = tag + desc_len + 1;
499
500 if (strcasecmp(tag, "http://musicbrainz.org") == 0)
501 {
502 /* Musicbrainz track IDs are always 36 chars long plus null */
503 value_len = 37;
504
505 entry->mb_track_id = value;
506
507 /*DEBUGF("ENTRY: %s LEN: %d\n", entry->mb_track_id, strlen(entry->mb_track_id));*/
508 }
509 }
510
511 return tag - entry->id3v2buf + value_len;
512}
513
489static const struct tag_resolver taglist[] = { 514static const struct tag_resolver taglist[] = {
490 { "TPE1", 4, offsetof(struct mp3entry, artist), NULL, false }, 515 { "TPE1", 4, offsetof(struct mp3entry, artist), NULL, false },
491 { "TP1", 3, offsetof(struct mp3entry, artist), NULL, false }, 516 { "TP1", 3, offsetof(struct mp3entry, artist), NULL, false },
@@ -511,6 +536,7 @@ static const struct tag_resolver taglist[] = {
511 { "TXXX", 4, 0, &parseuser, false }, 536 { "TXXX", 4, 0, &parseuser, false },
512 { "RVA2", 4, 0, &parserva2, true }, 537 { "RVA2", 4, 0, &parserva2, true },
513#endif 538#endif
539 { "UFID", 4, 0, &parsembtid, false },
514}; 540};
515 541
516#define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0]))) 542#define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0])))
@@ -1261,6 +1287,8 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig)
1261 if (entry->album_gain_string) 1287 if (entry->album_gain_string)
1262 entry->album_gain_string += offset; 1288 entry->album_gain_string += offset;
1263#endif 1289#endif
1290 if (entry->mb_track_id)
1291 entry->mb_track_id += offset;
1264} 1292}
1265 1293
1266void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig) 1294void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig)