From 13160830827734e623ff27d355c23915482d01ac Mon Sep 17 00:00:00 2001 From: zagor Date: Sat, 22 May 2004 01:38:41 +0000 Subject: [PATCH] Moved genre list and access function to id3.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4692 a1c6a512-1295-4272-9138-f99709370657 --- apps/wps-display.c | 38 +------------------------------------- apps/wps.c | 4 ++-- firmware/export/id3.h | 1 + firmware/id3.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 39 deletions(-) diff --git a/apps/wps-display.c b/apps/wps-display.c index 8cbf7db75..44955d054 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c @@ -85,42 +85,6 @@ static int ff_rewind_count; bool wps_time_countup = true; static bool wps_loaded = false; -static const char* const genres[] = { - "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", - "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", - "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", - "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", - "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", - "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", - "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", - "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", - "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", - "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", - "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", - "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", - "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", - - /* winamp extensions */ - "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", - "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", - "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", - "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", - "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", - "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", - "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", - "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall" -}; - -char* wps_get_genre(struct mp3entry* id3) -{ - if( id3->genre_string ) - return id3->genre_string ; - - if (id3->genre < sizeof(genres)/sizeof(char*)) - return (char*)genres[id3->genre]; - return NULL; -} - /* Set format string to use for WPS, splitting it into lines */ static void wps_format(char* fmt) { @@ -396,7 +360,7 @@ static char* get_tag(struct mp3entry* cid3, return NULL; case 'g': /* genre */ - return wps_get_genre(id3); + return id3_get_genre(id3); case 'v': /* id3 version */ switch (id3->id3version) { diff --git a/apps/wps.c b/apps/wps.c index bc09ec550..f1b0e214a 100644 --- a/apps/wps.c +++ b/apps/wps.c @@ -204,8 +204,8 @@ bool browse_id3(void) case 4: lcd_puts(0, 0, str(LANG_ID3_GENRE)); lcd_puts_scroll(0, 1, - wps_get_genre(id3) ? - wps_get_genre(id3) : + id3_get_genre(id3) ? + id3_get_genre(id3) : (char*)str(LANG_ID3_NO_INFO)); break; diff --git a/firmware/export/id3.h b/firmware/export/id3.h index 48a56f231..6e53e4c66 100644 --- a/firmware/export/id3.h +++ b/firmware/export/id3.h @@ -75,5 +75,6 @@ enum { }; bool mp3info(struct mp3entry *entry, char *filename); +char* id3_get_genre(struct mp3entry* id3); #endif diff --git a/firmware/id3.c b/firmware/id3.c index 131eeda82..d2d2a2d9f 100644 --- a/firmware/id3.c +++ b/firmware/id3.c @@ -51,6 +51,42 @@ ((b2 & 0xFF) << (1*8)) | \ ((b3 & 0xFF) << (0*8))) +static const char* const genres[] = { + "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", + "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", + "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", + "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", + "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", + "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", + "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", + "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", + "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", + "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", + "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", + "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", + "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", + + /* winamp extensions */ + "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", + "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", + "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", + "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", + "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", + "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", + "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", + "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall" +}; + +char* id3_get_genre(struct mp3entry* id3) +{ + if( id3->genre_string ) + return id3->genre_string ; + + if (id3->genre < sizeof(genres)/sizeof(char*)) + return (char*)genres[id3->genre]; + return NULL; +} + /* HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS Code and comments by Thomas Paul Diffenbach -- 2.11.4.GIT