From 294ec1d110178f30894721d5cda14c246333954d Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Wed, 19 Sep 2007 10:40:55 +0000 Subject: 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 --- firmware/export/id3.h | 4 ++-- firmware/export/mpeg.h | 1 - firmware/id3.c | 18 ++++++------------ firmware/mpeg.c | 15 ++++----------- 4 files changed, 12 insertions(+), 26 deletions(-) (limited to 'firmware') 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 { ID3_VER_2_4 }; -bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool v1first); -bool mp3info(struct mp3entry *entry, const char *filename, bool v1first); +bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename); +bool mp3info(struct mp3entry *entry, const char *filename); char* id3_get_num_genre(const unsigned int genre_num); char* id3_get_codec(const struct mp3entry* id3); int 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); /* in order to keep the recording here, I have to expose this */ void rec_tick(void); void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */ -void mpeg_id3_options(bool _v1first); void audio_set_track_changed_event(void (*handler)(struct mp3entry *id3)); void 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) * about an MP3 file and updates it's entry accordingly. * Note, that this returns true for successful, false for error! */ -bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool v1first) +bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename) { - int v1found = false; - #if CONFIG_CODEC != SWCODEC memset(entry, 0, sizeof(struct mp3entry)); #endif @@ -1180,10 +1178,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool entry->tracknum = 0; entry->discnum = 0; - if(v1first) - v1found = setid3v1title(fd, entry); - - if (!v1found && entry->id3v2len) + if (entry->id3v2len) setid3v2title(fd, entry); int len = getsonglength(fd, entry); if (len < 0) @@ -1194,9 +1189,8 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool the true size of the MP3 stream */ entry->filesize -= entry->first_frame_offset; - /* only seek to end of file if no id3v2 tags were found, - and we already haven't looked for a v1 tag */ - if (!v1first && !entry->id3v2len) { + /* only seek to end of file if no id3v2 tags were found */ + if (!entry->id3v2len) { setid3v1title(fd, entry); } @@ -1209,7 +1203,7 @@ bool get_mp3_metadata(int fd, struct mp3entry *entry, const char *filename, bool } /* Note, that this returns false for successful, true for error! */ -bool mp3info(struct mp3entry *entry, const char *filename, bool v1first) +bool mp3info(struct mp3entry *entry, const char *filename) { int fd; bool result; @@ -1218,7 +1212,7 @@ bool mp3info(struct mp3entry *entry, const char *filename, bool v1first) if (fd < 0) return true; - result = !get_mp3_metadata(fd, entry, filename, v1first); + result = !get_mp3_metadata(fd, entry, filename); close(fd); 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; static const char mpeg_thread_name[] = "mpeg"; static unsigned int mpeg_errno; -static bool v1first = false; - static bool playing = false; /* We are playing an MP3 stream */ static bool is_playing = false; /* We are (attempting to) playing MP3 files */ static bool paused; /* playback is paused */ @@ -922,7 +920,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename) /* grab id3 tag of new file and remember where in memory it starts */ - if(mp3info(&track->id3, filename, v1first)) + if(mp3info(&track->id3, filename)) { DEBUGF("Bad mp3\n"); return NULL; @@ -2098,11 +2096,6 @@ static void mpeg_thread(void) } #endif /* !SIMULATOR */ -void mpeg_id3_options(bool _v1first) -{ - v1first = _v1first; -} - struct mp3entry* audio_current_track() { #ifdef SIMULATOR @@ -2707,7 +2700,7 @@ void audio_play(long offset) trackname = playlist_peek( steps ); if (!trackname) break; - if(mp3info(&taginfo, trackname, v1first)) { + if(mp3info(&taginfo, trackname)) { /* bad mp3, move on */ if(++steps > playlist_amount()) break; @@ -2793,7 +2786,7 @@ void audio_next(void) file = playlist_peek(steps); if(!file) break; - if(mp3info(&taginfo, file, v1first)) { + if(mp3info(&taginfo, file)) { if(++steps > playlist_amount()) break; continue; @@ -2822,7 +2815,7 @@ void audio_prev(void) file = playlist_peek(steps); if(!file) break; - if(mp3info(&taginfo, file, v1first)) { + if(mp3info(&taginfo, file)) { steps--; continue; } -- cgit v1.2.3