diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/id3.h | 2 | ||||
-rw-r--r-- | firmware/id3.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/firmware/export/id3.h b/firmware/export/id3.h index 3b69d50075..8c91456040 100644 --- a/firmware/export/id3.h +++ b/firmware/export/id3.h | |||
@@ -147,11 +147,13 @@ struct mp3entry { | |||
147 | char* artist; | 147 | char* artist; |
148 | char* album; | 148 | char* album; |
149 | char* genre_string; | 149 | char* genre_string; |
150 | char* disc_string; | ||
150 | char* track_string; | 151 | char* track_string; |
151 | char* year_string; | 152 | char* year_string; |
152 | char* composer; | 153 | char* composer; |
153 | char* comment; | 154 | char* comment; |
154 | char* albumartist; | 155 | char* albumartist; |
156 | int discnum; | ||
155 | int tracknum; | 157 | int tracknum; |
156 | int version; | 158 | int version; |
157 | int layer; | 159 | int layer; |
diff --git a/firmware/id3.c b/firmware/id3.c index 8e1d96462b..a66318b2fc 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -352,6 +352,13 @@ static int parsetracknum( struct mp3entry* entry, char* tag, int bufferpos ) | |||
352 | } | 352 | } |
353 | 353 | ||
354 | /* parse numeric value from string */ | 354 | /* parse numeric value from string */ |
355 | static int parsediscnum( struct mp3entry* entry, char* tag, int bufferpos ) | ||
356 | { | ||
357 | entry->discnum = atoi( tag ); | ||
358 | return bufferpos; | ||
359 | } | ||
360 | |||
361 | /* parse numeric value from string */ | ||
355 | static int parseyearnum( struct mp3entry* entry, char* tag, int bufferpos ) | 362 | static int parseyearnum( struct mp3entry* entry, char* tag, int bufferpos ) |
356 | { | 363 | { |
357 | entry->year = atoi( tag ); | 364 | entry->year = atoi( tag ); |
@@ -446,6 +453,7 @@ static const struct tag_resolver taglist[] = { | |||
446 | { "TALB", 4, offsetof(struct mp3entry, album), NULL, false }, | 453 | { "TALB", 4, offsetof(struct mp3entry, album), NULL, false }, |
447 | { "TAL", 3, offsetof(struct mp3entry, album), NULL, false }, | 454 | { "TAL", 3, offsetof(struct mp3entry, album), NULL, false }, |
448 | { "TRK", 3, offsetof(struct mp3entry, track_string), &parsetracknum, false }, | 455 | { "TRK", 3, offsetof(struct mp3entry, track_string), &parsetracknum, false }, |
456 | { "TPOS", 4, offsetof(struct mp3entry, disc_string), &parsediscnum, false }, | ||
449 | { "TRCK", 4, offsetof(struct mp3entry, track_string), &parsetracknum, false }, | 457 | { "TRCK", 4, offsetof(struct mp3entry, track_string), &parsetracknum, false }, |
450 | { "TDRC", 4, offsetof(struct mp3entry, year_string), &parseyearnum, false }, | 458 | { "TDRC", 4, offsetof(struct mp3entry, year_string), &parseyearnum, false }, |
451 | { "TYER", 4, offsetof(struct mp3entry, year_string), &parseyearnum, false }, | 459 | { "TYER", 4, offsetof(struct mp3entry, year_string), &parseyearnum, false }, |
@@ -693,7 +701,7 @@ static void setid3v2title(int fd, struct mp3entry *entry) | |||
693 | return; | 701 | return; |
694 | } | 702 | } |
695 | entry->id3version = version; | 703 | entry->id3version = version; |
696 | entry->tracknum = entry->year = 0; | 704 | entry->tracknum = entry->year = entry->discnum = 0; |
697 | entry->title = entry->artist = entry->album = NULL; /* FIXME incomplete */ | 705 | entry->title = entry->artist = entry->album = NULL; /* FIXME incomplete */ |
698 | 706 | ||
699 | global_flags = header[5]; | 707 | global_flags = header[5]; |
@@ -1112,6 +1120,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool | |||
1112 | entry->filesize = filesize(fd); | 1120 | entry->filesize = filesize(fd); |
1113 | entry->id3v2len = getid3v2len(fd); | 1121 | entry->id3v2len = getid3v2len(fd); |
1114 | entry->tracknum = 0; | 1122 | entry->tracknum = 0; |
1123 | entry->discnum = 0; | ||
1115 | 1124 | ||
1116 | if(v1first) | 1125 | if(v1first) |
1117 | v1found = setid3v1title(fd, entry); | 1126 | v1found = setid3v1title(fd, entry); |
@@ -1173,6 +1182,8 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, void *orig) | |||
1173 | entry->genre_string += offset; | 1182 | entry->genre_string += offset; |
1174 | if (entry->track_string) | 1183 | if (entry->track_string) |
1175 | entry->track_string += offset; | 1184 | entry->track_string += offset; |
1185 | if (entry->disc_string) | ||
1186 | entry->disc_string += offset; | ||
1176 | if (entry->year_string) | 1187 | if (entry->year_string) |
1177 | entry->year_string += offset; | 1188 | entry->year_string += offset; |
1178 | if (entry->composer) | 1189 | if (entry->composer) |