diff options
-rw-r--r-- | firmware/export/id3.h | 2 | ||||
-rw-r--r-- | firmware/id3.c | 34 |
2 files changed, 36 insertions, 0 deletions
diff --git a/firmware/export/id3.h b/firmware/export/id3.h index 38494044fa..cc0d422e7a 100644 --- a/firmware/export/id3.h +++ b/firmware/export/id3.h | |||
@@ -138,5 +138,7 @@ bool mp3info(struct mp3entry *entry, const char *filename, bool v1first); | |||
138 | char* id3_get_genre(const struct mp3entry* id3); | 138 | char* id3_get_genre(const struct mp3entry* id3); |
139 | char* id3_get_codec(const struct mp3entry* id3); | 139 | char* id3_get_codec(const struct mp3entry* id3); |
140 | int getid3v2len(int fd); | 140 | int getid3v2len(int fd); |
141 | void adjust_mp3entry(struct mp3entry *entry, void *dest, void *orig); | ||
142 | void copy_mp3entry(struct mp3entry *dest, struct mp3entry *orig); | ||
141 | 143 | ||
142 | #endif | 144 | #endif |
diff --git a/firmware/id3.c b/firmware/id3.c index aa370e836e..1188da9fd6 100644 --- a/firmware/id3.c +++ b/firmware/id3.c | |||
@@ -1013,6 +1013,40 @@ bool mp3info(struct mp3entry *entry, const char *filename, bool v1first) | |||
1013 | return false; | 1013 | return false; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | void adjust_mp3entry(struct mp3entry *entry, void *dest, void *orig) | ||
1017 | { | ||
1018 | long offset; | ||
1019 | if (orig > dest) | ||
1020 | offset = - ((size_t)orig - (size_t)dest); | ||
1021 | else | ||
1022 | offset = (size_t)dest - (size_t)orig; | ||
1023 | |||
1024 | if (entry->title) | ||
1025 | entry->title += offset; | ||
1026 | if (entry->artist) | ||
1027 | entry->artist += offset; | ||
1028 | if (entry->album) | ||
1029 | entry->album += offset; | ||
1030 | if (entry->genre_string) | ||
1031 | entry->genre_string += offset; | ||
1032 | if (entry->track_string) | ||
1033 | entry->track_string += offset; | ||
1034 | if (entry->year_string) | ||
1035 | entry->year_string += offset; | ||
1036 | if (entry->composer) | ||
1037 | entry->composer += offset; | ||
1038 | if (entry->track_gain_string) | ||
1039 | entry->track_gain_string += offset; | ||
1040 | if (entry->album_gain_string) | ||
1041 | entry->album_gain_string += offset; | ||
1042 | } | ||
1043 | |||
1044 | void copy_mp3entry(struct mp3entry *dest, struct mp3entry *orig) | ||
1045 | { | ||
1046 | memcpy(dest, orig, sizeof(struct mp3entry)); | ||
1047 | adjust_mp3entry(dest, dest, orig); | ||
1048 | } | ||
1049 | |||
1016 | #ifdef DEBUG_STANDALONE | 1050 | #ifdef DEBUG_STANDALONE |
1017 | 1051 | ||
1018 | char *secs2str(int ms) | 1052 | char *secs2str(int ms) |