summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-09-19 10:40:55 +0000
committerThom Johansen <thomj@rockbox.org>2007-09-19 10:40:55 +0000
commit294ec1d110178f30894721d5cda14c246333954d (patch)
tree2e31dc287557007939b3b5abf4493fa02946b6c5 /firmware
parent547cffb90bffacc7f22e6661c61ccad830ce2c91 (diff)
downloadrockbox-294ec1d110178f30894721d5cda14c246333954d.tar.gz
rockbox-294ec1d110178f30894721d5cda14c246333954d.zip
Remove the ID3 tag version priority setting on the grounds of it being pretty pointless. ID3v2 tags are superior to ID3v1 tags, and needs less seeking around to find.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14750 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/id3.h4
-rw-r--r--firmware/export/mpeg.h1
-rw-r--r--firmware/id3.c18
-rw-r--r--firmware/mpeg.c15
4 files changed, 12 insertions, 26 deletions
diff --git a/firmware/export/id3.h b/firmware/export/id3.h
index 2751fde6f5..46b9b92f73 100644
--- a/firmware/export/id3.h
+++ b/firmware/export/id3.h
@@ -235,8 +235,8 @@ enum {
235 ID3_VER_2_4 235 ID3_VER_2_4
236}; 236};
237 237
238bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool v1first); 238bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename);
239bool mp3info(struct mp3entry *entry, const char *filename, bool v1first); 239bool mp3info(struct mp3entry *entry, const char *filename);
240char* id3_get_num_genre(const unsigned int genre_num); 240char* id3_get_num_genre(const unsigned int genre_num);
241char* id3_get_codec(const struct mp3entry* id3); 241char* id3_get_codec(const struct mp3entry* id3);
242int getid3v2len(int fd); 242int getid3v2len(int fd);
diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h
index b2dbc1ab53..9de8c499af 100644
--- a/firmware/export/mpeg.h
+++ b/firmware/export/mpeg.h
@@ -55,7 +55,6 @@ unsigned long mpeg_get_last_header(void);
55/* in order to keep the recording here, I have to expose this */ 55/* in order to keep the recording here, I have to expose this */
56void rec_tick(void); 56void rec_tick(void);
57void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */ 57void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
58void mpeg_id3_options(bool _v1first);
59 58
60void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3)); 59void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3));
61void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3, 60void audio_set_track_buffer_event(void (*handler)(struct mp3entry *id3,
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! */
1167bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool v1first) 1167bool 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! */
1212bool mp3info(struct mp3entry *entry, const char *filename, bool v1first) 1206bool 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
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index e412c36fe2..65fb024db3 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -127,8 +127,6 @@ static bool (*cuesheet_callback)(const char *filename) = NULL;
127static const char mpeg_thread_name[] = "mpeg"; 127static const char mpeg_thread_name[] = "mpeg";
128static unsigned int mpeg_errno; 128static unsigned int mpeg_errno;
129 129
130static bool v1first = false;
131
132static bool playing = false; /* We are playing an MP3 stream */ 130static bool playing = false; /* We are playing an MP3 stream */
133static bool is_playing = false; /* We are (attempting to) playing MP3 files */ 131static bool is_playing = false; /* We are (attempting to) playing MP3 files */
134static bool paused; /* playback is paused */ 132static bool paused; /* playback is paused */
@@ -922,7 +920,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename)
922 920
923 /* grab id3 tag of new file and 921 /* grab id3 tag of new file and
924 remember where in memory it starts */ 922 remember where in memory it starts */
925 if(mp3info(&track->id3, filename, v1first)) 923 if(mp3info(&track->id3, filename))
926 { 924 {
927 DEBUGF("Bad mp3\n"); 925 DEBUGF("Bad mp3\n");
928 return NULL; 926 return NULL;
@@ -2098,11 +2096,6 @@ static void mpeg_thread(void)
2098} 2096}
2099#endif /* !SIMULATOR */ 2097#endif /* !SIMULATOR */
2100 2098
2101void mpeg_id3_options(bool _v1first)
2102{
2103 v1first = _v1first;
2104}
2105
2106struct mp3entry* audio_current_track() 2099struct mp3entry* audio_current_track()
2107{ 2100{
2108#ifdef SIMULATOR 2101#ifdef SIMULATOR
@@ -2707,7 +2700,7 @@ void audio_play(long offset)
2707 trackname = playlist_peek( steps ); 2700 trackname = playlist_peek( steps );
2708 if (!trackname) 2701 if (!trackname)
2709 break; 2702 break;
2710 if(mp3info(&taginfo, trackname, v1first)) { 2703 if(mp3info(&taginfo, trackname)) {
2711 /* bad mp3, move on */ 2704 /* bad mp3, move on */
2712 if(++steps > playlist_amount()) 2705 if(++steps > playlist_amount())
2713 break; 2706 break;
@@ -2793,7 +2786,7 @@ void audio_next(void)
2793 file = playlist_peek(steps); 2786 file = playlist_peek(steps);
2794 if(!file) 2787 if(!file)
2795 break; 2788 break;
2796 if(mp3info(&taginfo, file, v1first)) { 2789 if(mp3info(&taginfo, file)) {
2797 if(++steps > playlist_amount()) 2790 if(++steps > playlist_amount())
2798 break; 2791 break;
2799 continue; 2792 continue;
@@ -2822,7 +2815,7 @@ void audio_prev(void)
2822 file = playlist_peek(steps); 2815 file = playlist_peek(steps);
2823 if(!file) 2816 if(!file)
2824 break; 2817 break;
2825 if(mp3info(&taginfo, file, v1first)) { 2818 if(mp3info(&taginfo, file)) {
2826 steps--; 2819 steps--;
2827 continue; 2820 continue;
2828 } 2821 }