From 710ccb7b483da9be9543ea40a99dee7fd6f8fa98 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 25 Oct 2006 10:17:57 +0000 Subject: [PATCH] ifdef all the tagcache code, allows rombox to be compiled again, Thanks Austin Appel git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11338 a1c6a512-1295-4272-9138-f99709370657 --- apps/SOURCES | 4 ++ apps/debug_menu.c | 6 +++ apps/main.c | 11 ++++- apps/main_menu.c | 7 +--- apps/misc.c | 2 + apps/onplay.c | 6 ++- apps/playback.c | 2 + apps/screens.c | 2 + apps/settings.c | 9 ++++- apps/settings.h | 2 + apps/settings_menu.c | 13 ++++++ apps/tagcache.h | 2 + apps/tagdb/album.c | 2 + apps/tagdb/album.h | 2 + apps/tagdb/array_buffer.c | 3 +- apps/tagdb/array_buffer.h | 2 + apps/tagdb/artist.c | 2 + apps/tagdb/artist.h | 2 + apps/tagdb/config.h | 2 + apps/tagdb/db.c | 2 + apps/tagdb/db.h | 2 + apps/tagdb/file.c | 2 + apps/tagdb/file.h | 2 + apps/tagdb/header.c | 3 +- apps/tagdb/header.h | 2 + apps/tagdb/main.c | 2 + apps/tagdb/malloc.c | 2 + apps/tagdb/malloc.h | 2 + apps/tagdb/parser.c | 2 + apps/tagdb/song.c | 2 + apps/tagdb/song.h | 2 + apps/tagdb/tag_dummy.c | 2 + apps/tagdb/tag_dummy.h | 2 + apps/tagdb/unique.c | 2 + apps/tagdb/unique.h | 2 + apps/tagtree.h | 2 + apps/tree.c | 63 ++++++++++++++++++++++++++--- docs/CREDITS | 1 + firmware/export/config-e200.h | 3 ++ firmware/export/config-fmrecorder.h | 3 ++ firmware/export/config-gigabeat.h | 3 ++ firmware/export/config-gmini120.h | 3 ++ firmware/export/config-gminisp.h | 3 ++ firmware/export/config-h10.h | 3 ++ firmware/export/config-h100.h | 3 ++ firmware/export/config-h10_5gb.h | 2 + firmware/export/config-h120.h | 3 ++ firmware/export/config-h300.h | 3 ++ firmware/export/config-iaudiox5.h | 3 ++ firmware/export/config-ifp7xx.h | 3 ++ firmware/export/config-ipod3g.h | 3 ++ firmware/export/config-ipod4g.h | 3 ++ firmware/export/config-ipodcolor.h | 3 ++ firmware/export/config-ipodmini.h | 3 ++ firmware/export/config-ipodmini2g.h | 3 ++ firmware/export/config-ipodnano.h | 3 ++ firmware/export/config-ipodvideo.h | 3 ++ firmware/export/config-ondiofm.h | 3 ++ firmware/export/config-ondiosp.h | 3 ++ firmware/export/config-player.h | 3 ++ firmware/export/config-recorder.h | 3 ++ firmware/export/config-recorderv2.h | 3 ++ firmware/export/config.h | 2 + 63 files changed, 237 insertions(+), 16 deletions(-) diff --git a/apps/SOURCES b/apps/SOURCES index d759e49a6f..570ec6e24a 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -27,7 +27,9 @@ status.c talk.c #endif tree.c +#ifdef HAVE_TAGCACHE tagtree.c +#endif filetree.c scrobbler.c @@ -82,7 +84,9 @@ eq_arm.S eq_menu.c #endif metadata.c +#ifdef HAVE_TAGCACHE tagcache.c +#endif #if (CONFIG_KEYPAD == IRIVER_H100_PAD) \ || (CONFIG_KEYPAD == IRIVER_H300_PAD) keymaps/keymap-h1x0_h3x0.c diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 5243519c2c..806744b404 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -41,7 +41,9 @@ #include "misc.h" #include "splash.h" #include "dircache.h" +#ifdef HAVE_TAGCACHE #include "tagcache.h" +#endif #include "lcd-remote.h" #include "crc32.h" #include "logf.h" @@ -1917,6 +1919,7 @@ static bool dbg_dircache_info(void) #endif /* HAVE_DIRCACHE */ #ifdef HAVE_LCD_BITMAP +#ifdef HAVE_TAGCACHE static bool dbg_tagcache_info(void) { bool done = false; @@ -1960,6 +1963,7 @@ static bool dbg_tagcache_info(void) return false; } #endif +#endif #if CONFIG_CPU == SH7034 bool dbg_save_roms(void) @@ -2193,7 +2197,9 @@ bool debug_menu(void) { "View dircache info", dbg_dircache_info }, #endif #ifdef HAVE_LCD_BITMAP +#ifdef HAVE_TAGCACHE { "View tagcache info", dbg_tagcache_info }, +#endif #if CONFIG_CODEC == SWCODEC || !defined(SIMULATOR) { "View audio thread", dbg_audio_thread }, #endif diff --git a/apps/main.c b/apps/main.c index 838a4859d2..4249fd0b8b 100644 --- a/apps/main.c +++ b/apps/main.c @@ -60,8 +60,10 @@ #include "misc.h" #include "database.h" #include "dircache.h" +#ifdef HAVE_TAGCACHE #include "tagcache.h" #include "tagtree.h" +#endif #include "lang.h" #include "string.h" #include "splash.h" @@ -169,6 +171,7 @@ int init_dircache(bool preinit) #endif } +#ifdef HAVE_TAGCACHE void init_tagcache(void) { bool clear = false; @@ -204,6 +207,7 @@ void init_tagcache(void) show_logo(); } } +#endif #ifdef SIMULATOR @@ -230,7 +234,9 @@ void init(void) settings_apply(); init_dircache(true); init_dircache(false); +#ifdef HAVE_TAGCACHE init_tagcache(); +#endif sleep(HZ/2); tree_init(); playlist_init(); @@ -436,16 +442,19 @@ void init(void) #endif settings_load(SETTINGS_ALL); - if (init_dircache(true) < 0) { +#ifdef HAVE_TAGCACHE remove(TAGCACHE_STATEFILE); +#endif } gui_sync_wps_init(); settings_apply(); init_dircache(false); +#ifdef HAVE_TAGCACHE init_tagcache(); +#endif #ifdef HAVE_EEPROM_SETTINGS if (firmware_settings.initialized) diff --git a/apps/main_menu.c b/apps/main_menu.c index bc9934bf83..0ac4d94753 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c @@ -370,12 +370,7 @@ bool info_menu(void) #ifdef HAVE_LCD_CHARCELLS static bool do_shutdown(void) { -#ifndef SIMULATOR - if (charger_inserted()) - charging_splash(); - else -#endif - sys_poweroff(); + sys_poweroff(); return false; } #endif diff --git a/apps/misc.c b/apps/misc.c index 0936e85569..c36d61914b 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -543,12 +543,14 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter) #ifdef X5_BACKLIGHT_SHUTDOWN x5_backlight_shutdown(); #endif +#ifdef HAVE_TAGCACHE if (!tagcache_prepare_shutdown()) { cancel_shutdown(); gui_syncsplash(HZ, true, str(LANG_TAGCACHE_BUSY)); return false; } +#endif gui_syncsplash(0, true, str(LANG_SHUTTINGDOWN)); diff --git a/apps/onplay.c b/apps/onplay.c index 4fd9d41056..60a737938f 100644 --- a/apps/onplay.c +++ b/apps/onplay.c @@ -64,7 +64,9 @@ #endif #include "playlist_menu.h" #include "playlist_catalog.h" +#ifdef HAVE_TAGCACHE #include "tagtree.h" +#endif static int context; static char* selected_file = NULL; @@ -181,11 +183,13 @@ static bool add_to_playlist(int position, bool queue) if (position == PLAYLIST_INSERT_SHUFFLED) srand(current_tick); +#ifdef HAVE_TAGCACHE if (context == CONTEXT_ID3DB) { tagtree_insert_selection_playlist(position, queue); } else +#endif { if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) playlist_insert_track(NULL, selected_file, position, queue, true); @@ -207,7 +211,7 @@ static bool add_to_playlist(int position, bool queue) else if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U) playlist_insert_playlist(NULL, selected_file, position, queue); } - + if (new_playlist && (playlist_amount() > 0)) { /* nothing is currently playing so begin playing what we just diff --git a/apps/playback.c b/apps/playback.c index b68a8b81f1..7b952e6919 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -59,7 +59,9 @@ #include "buffer.h" #include "dsp.h" #include "abrepeat.h" +#ifdef HAVE_TAGCACHE #include "tagcache.h" +#endif #ifdef HAVE_LCD_BITMAP #include "icons.h" #include "peakmeter.h" diff --git a/apps/screens.c b/apps/screens.c index 7836a8eecb..9787e682bc 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -574,7 +574,9 @@ bool quick_screen_quick(int button_enter) [SHOW_SUPPORTED]={ STR(LANG_SYSFONT_FILTER_SUPPORTED) }, [SHOW_MUSIC]={ STR(LANG_SYSFONT_FILTER_MUSIC) }, [SHOW_PLAYLIST]={ STR(LANG_SYSFONT_FILTER_PLAYLIST) }, +#ifdef HAVE_TAGCACHE [SHOW_ID3DB]={ STR(LANG_SYSFONT_FILTER_ID3DB) } +#endif }; static const struct opt_items right_items[] = { [REPEAT_OFF]={ STR(LANG_SYSFONT_OFF) }, diff --git a/apps/settings.c b/apps/settings.c index 1795f78cf7..9d618ebcb8 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -419,7 +419,11 @@ static const struct bit_entry hd_bits[] = /* browser */ {3, S_O(dirfilter), SHOW_SUPPORTED, - "show files", "all,supported,music,playlists,id3 database" }, + "show files", "all,supported,music,playlists" +#ifdef HAVE_TAGCACHE + ",id3 database" +#endif + }, {1, S_O(sort_case), false, "sort case", off_on }, {1, S_O(browse_current), false, "follow playlist", off_on }, /* playlist */ @@ -593,10 +597,13 @@ static const struct bit_entry hd_bits[] = {1, S_O(dircache), false, "dircache", off_on }, {22, S_O(dircache_size), 0, NULL, NULL }, #endif + +#ifdef HAVE_TAGCACHE #ifdef HAVE_TC_RAMCACHE {1, S_O(tagcache_ram), 0, "tagcache_ram", off_on }, #endif {1, S_O(tagcache_autoupdate), 0, "tagcache_autoupdate", off_on }, +#endif {4, S_O(default_codepage), 0, "default codepage", "iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256,iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8,cp1256" }, diff --git a/apps/settings.h b/apps/settings.h index 5fc8c7e5f5..0dca11432c 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -389,10 +389,12 @@ struct user_settings bool dircache; /* enable directory cache */ int dircache_size; /* directory cache structure last size, 22 bits */ #endif +#ifdef HAVE_TAGCACHE #ifdef HAVE_TC_RAMCACHE bool tagcache_ram; /* load tagcache to ram? */ #endif bool tagcache_autoupdate; /* automatically keep tagcache in sync? */ +#endif int default_codepage; /* set default codepage for tag conversion */ #ifdef HAVE_REMOTE_LCD unsigned char rwps_file[MAX_FILENAME+1]; /* last remote-wps */ diff --git a/apps/settings_menu.c b/apps/settings_menu.c index b66104220f..0cbe5344fb 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -49,8 +49,10 @@ #include "database.h" #include "dir.h" #include "dircache.h" +#ifdef HAVE_TAGCACHE #include "tagcache.h" #include "tagtree.h" +#endif #include "rbunicode.h" #include "splash.h" #include "yesno.h" @@ -749,10 +751,17 @@ static bool dir_filter(void) { STR(LANG_FILTER_SUPPORTED) }, { STR(LANG_FILTER_MUSIC) }, { STR(LANG_FILTER_PLAYLIST) }, +#ifdef HAVE_TAGCACHE { STR(LANG_FILTER_ID3DB) } +#endif }; +#ifdef HAVE_TAGCACHE return set_option( str(LANG_FILTER), &global_settings.dirfilter, INT, names, 5, NULL ); +#else + return set_option( str(LANG_FILTER), &global_settings.dirfilter, INT, + names, 4, NULL ); +#endif } static bool sort_case(void) @@ -1632,6 +1641,7 @@ static bool dircache(void) } #endif /* HAVE_DIRCACHE */ +#ifdef HAVE_TAGCACHE #ifdef HAVE_TC_RAMCACHE static bool tagcache_ram(void) { @@ -1688,6 +1698,7 @@ static bool tagcache_settings_menu(void) menu_exit(m); return result; } +#endif #ifdef HAVE_HEADPHONE_DETECTION static bool unplug_mode(void) @@ -1853,7 +1864,9 @@ static bool fileview_settings_menu(void) { ID2P(LANG_FOLLOW), browse_current }, { ID2P(LANG_SHOW_ICONS), show_icons }, { ID2P(LANG_SHOW_PATH), show_path }, +#ifdef HAVE_TAGCACHE { ID2P(LANG_TAGCACHE), tagcache_settings_menu}, +#endif }; m=menu_init( items, sizeof(items) / sizeof(*items), NULL, diff --git a/apps/tagcache.h b/apps/tagcache.h index cdd4722b79..26c500ef88 100644 --- a/apps/tagcache.h +++ b/apps/tagcache.h @@ -16,6 +16,7 @@ * KIND, either express or implied. * ****************************************************************************/ +#ifdef HAVE_TAGCACHE #ifndef _TAGCACHE_H #define _TAGCACHE_H @@ -178,3 +179,4 @@ bool tagcache_update(void); bool tagcache_rebuild(void); #endif +#endif diff --git a/apps/tagdb/album.c b/apps/tagdb/album.c index 53b3660c90..0c06329fa5 100644 --- a/apps/tagdb/album.c +++ b/apps/tagdb/album.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "malloc.h" // realloc() and free() #include // strncasecmp() #include // strlen() @@ -452,3 +453,4 @@ int album_entry_add_song_file(FILE *fd, struct album_entry *e, struct album_size return ERR_NO_INPLACE_UPDATE; } +#endif diff --git a/apps/tagdb/album.h b/apps/tagdb/album.h index 08995a2940..3f4eacd754 100644 --- a/apps/tagdb/album.h +++ b/apps/tagdb/album.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __ALBUM_H__ #define __ALBUM_H__ @@ -101,3 +102,4 @@ int album_entry_add_song_file(FILE *fd, struct album_entry *e, struct album_size */ #endif +#endif diff --git a/apps/tagdb/array_buffer.c b/apps/tagdb/array_buffer.c index 24772d6bc9..2b8b017802 100644 --- a/apps/tagdb/array_buffer.c +++ b/apps/tagdb/array_buffer.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "malloc.h" // malloc() and free() #include "array_buffer.h" @@ -664,4 +665,4 @@ int array_buffer_write(FILE *fd, struct array_buffer *b) { return ERR_NONE; } - +#endif diff --git a/apps/tagdb/array_buffer.h b/apps/tagdb/array_buffer.h index 6dccefe917..d098c7a0fa 100644 --- a/apps/tagdb/array_buffer.h +++ b/apps/tagdb/array_buffer.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __ARRAY_BUFFER_H__ #define __ARRAY_BUFFER_H__ @@ -157,3 +158,4 @@ int array_buffer_write(FILE *fd, struct array_buffer *b); */ #endif +#endif diff --git a/apps/tagdb/artist.c b/apps/tagdb/artist.c index 82db81df2f..36ce560bee 100644 --- a/apps/tagdb/artist.c +++ b/apps/tagdb/artist.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "malloc.h" // realloc() and free() #include // strncasecmp() @@ -368,3 +369,4 @@ int artist_entry_add_album_file(FILE *fd, struct artist_entry *e, struct artist_ return ERR_NO_INPLACE_UPDATE; } +#endif diff --git a/apps/tagdb/artist.h b/apps/tagdb/artist.h index c741594936..102e2879a7 100644 --- a/apps/tagdb/artist.h +++ b/apps/tagdb/artist.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __ARTIST_H__ #define __ARTIST_H__ @@ -98,3 +99,4 @@ int artist_entry_add_album_file(FILE *fd, struct artist_entry *e, struct artist_ */ #endif +#endif diff --git a/apps/tagdb/config.h b/apps/tagdb/config.h index 86461349e3..5e5e870248 100644 --- a/apps/tagdb/config.h +++ b/apps/tagdb/config.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __CONFIG_H // Include me only once #define __CONFIG_H @@ -37,3 +38,4 @@ #include #endif +#endif diff --git a/apps/tagdb/db.c b/apps/tagdb/db.c index 1c84b2b75c..4dfeb4708f 100644 --- a/apps/tagdb/db.c +++ b/apps/tagdb/db.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include // strlen() strcpy() strcat() #include "malloc.h" @@ -601,3 +602,4 @@ int tag_info_destruct(struct tag_info *t) { return ERR_NONE; } +#endif diff --git a/apps/tagdb/db.h b/apps/tagdb/db.h index be29581a09..709bf1fc9f 100644 --- a/apps/tagdb/db.h +++ b/apps/tagdb/db.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __DB_H__ #define __DB_H__ @@ -35,3 +36,4 @@ struct tag_info* new_tag_info(); int tag_info_destruct(struct tag_info *t); #endif +#endif diff --git a/apps/tagdb/file.c b/apps/tagdb/file.c index de641fec38..762f0088d5 100644 --- a/apps/tagdb/file.c +++ b/apps/tagdb/file.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "malloc.h" // realloc() and free() #include // strncasecmp() @@ -266,3 +267,4 @@ int file_size_destruct(struct file_size *s) { free(s); return ERR_NONE; } +#endif diff --git a/apps/tagdb/file.h b/apps/tagdb/file.h index d2538a7569..103a601abf 100644 --- a/apps/tagdb/file.h +++ b/apps/tagdb/file.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __FILE_H__ #define __FILE_H__ @@ -82,3 +83,4 @@ int file_size_destruct(struct file_size *s); */ #endif +#ifdef HAVE_TAGCACHE diff --git a/apps/tagdb/header.c b/apps/tagdb/header.c index 01f973824b..524c5b7e84 100644 --- a/apps/tagdb/header.c +++ b/apps/tagdb/header.c @@ -1,4 +1,4 @@ - +#ifdef HAVE_TAGCACHE #include #include "header.h" @@ -119,3 +119,4 @@ int header_write(FILE *fd, const struct header *h) { return ERR_NONE; } +#endif diff --git a/apps/tagdb/header.h b/apps/tagdb/header.h index 08a563ec72..28a28d3fd9 100644 --- a/apps/tagdb/header.h +++ b/apps/tagdb/header.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __HEADER_H__ #define __HEADER_H__ @@ -37,3 +38,4 @@ struct header { int header_write(FILE *fd, const struct header *header); #endif +#endif diff --git a/apps/tagdb/main.c b/apps/tagdb/main.c index 61a0330c81..ce695e6ca2 100644 --- a/apps/tagdb/main.c +++ b/apps/tagdb/main.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "config.h" #include @@ -113,3 +114,4 @@ int main(int argc, char* argv[]) { return 0; } +#endif diff --git a/apps/tagdb/malloc.c b/apps/tagdb/malloc.c index 78d24f9d4e..dbc2c5b048 100644 --- a/apps/tagdb/malloc.c +++ b/apps/tagdb/malloc.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "config.h" #include "malloc.h" @@ -129,3 +130,4 @@ void malloc_stats() { printf(" Maximum amount of allocated memory: %dbytes\n", max_total); printf(" Current amount of allocated memory: %dbytes\n", total); } +#endif diff --git a/apps/tagdb/malloc.h b/apps/tagdb/malloc.h index c8c885bf6f..c09649bdad 100644 --- a/apps/tagdb/malloc.h +++ b/apps/tagdb/malloc.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __MALLOC_H__ #define __MALLOC_H__ @@ -14,3 +15,4 @@ void *do_realloc(void *ptr, size_t size); void malloc_stats(); #endif +#endif diff --git a/apps/tagdb/parser.c b/apps/tagdb/parser.c index 6eec3bad1c..6e2eeff5b0 100644 --- a/apps/tagdb/parser.c +++ b/apps/tagdb/parser.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include #include #include @@ -215,3 +216,4 @@ int main(int argc, char *argv[]) { return 0; } +#endif diff --git a/apps/tagdb/song.c b/apps/tagdb/song.c index 16ae385eda..f62ecad5d8 100644 --- a/apps/tagdb/song.c +++ b/apps/tagdb/song.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "malloc.h" // realloc() and free() #include // strncasecmp() @@ -448,3 +449,4 @@ int song_size_destruct(struct song_size *s) { free(s); return ERR_NONE; } +#endif diff --git a/apps/tagdb/song.h b/apps/tagdb/song.h index 1be81ccf0a..ac155b42f4 100644 --- a/apps/tagdb/song.h +++ b/apps/tagdb/song.h @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #ifndef __SONG_H__ #define __SONG_H__ @@ -91,3 +92,4 @@ int song_size_destruct(struct song_size *s); */ #endif +#endif diff --git a/apps/tagdb/tag_dummy.c b/apps/tagdb/tag_dummy.c index f0125f32ea..4318724ac4 100644 --- a/apps/tagdb/tag_dummy.c +++ b/apps/tagdb/tag_dummy.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "config.h" #include "malloc.h" @@ -9,3 +10,4 @@ int tag_dummy(char *file, struct tag_info *t) { strcpy(t->song, file); return ERR_NONE; } +#endif diff --git a/apps/tagdb/tag_dummy.h b/apps/tagdb/tag_dummy.h index 856a0a5a2e..e05595a9a1 100644 --- a/apps/tagdb/tag_dummy.h +++ b/apps/tagdb/tag_dummy.h @@ -1,3 +1,5 @@ +#ifdef HAVE_TAGCACHE #include "db.h" int tag_dummy(char *file, struct tag_info *t); +#endif diff --git a/apps/tagdb/unique.c b/apps/tagdb/unique.c index 471f59e67f..3fd4359aea 100644 --- a/apps/tagdb/unique.c +++ b/apps/tagdb/unique.c @@ -1,3 +1,4 @@ +#ifdef HAVE_TAGCACHE #include "unique.h" #include @@ -14,3 +15,4 @@ char *create_unique_name(char *buffer, const char *prefix, const char *suffix, i return buffer; } +#endif diff --git a/apps/tagdb/unique.h b/apps/tagdb/unique.h index 03dc261141..bd5ebd8770 100644 --- a/apps/tagdb/unique.h +++ b/apps/tagdb/unique.h @@ -1,6 +1,8 @@ +#ifdef #ifndef __UNIQUE_H__ #define __UNIQUE_H__ char *create_unique_name(char *buffer, const char *prefix, const char *suffix, int digits); #endif +#endif diff --git a/apps/tagtree.h b/apps/tagtree.h index 2c85bf90e1..ccb71c4470 100644 --- a/apps/tagtree.h +++ b/apps/tagtree.h @@ -16,6 +16,7 @@ * KIND, either express or implied. * ****************************************************************************/ +#ifdef HAVE_TAGCACHE #ifndef _TAGTREE_H #define _TAGTREE_H @@ -53,3 +54,4 @@ int tagtree_get_icon(struct tree_context* c); int tagtree_get_filename(struct tree_context* c, char *buf, int buflen); #endif +#endif diff --git a/apps/tree.c b/apps/tree.c index bfb6412bfe..772e2351bb 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -61,7 +61,9 @@ #include "recorder/recording.h" #include "rtc.h" #include "dircache.h" +#ifdef HAVE_TAGCACHE #include "tagcache.h" +#endif #include "yesno.h" #include "gwps-common.h" #include "eeprom_settings.h" @@ -177,6 +179,7 @@ char * tree_get_filename(int selected_item, void * data, char *buffer) struct tree_context * local_tc=(struct tree_context *)data; char *name; int attr=0; +#ifdef HAVE_TAGCACHE bool id3db = *(local_tc->dirfilter) == SHOW_ID3DB; if (id3db) @@ -184,6 +187,7 @@ char * tree_get_filename(int selected_item, void * data, char *buffer) return tagtree_get_entry(&tc, selected_item)->name; } else +#endif { struct entry* dc = local_tc->dircache; struct entry* e = &dc[selected_item]; @@ -205,11 +209,14 @@ char * tree_get_filename(int selected_item, void * data, char *buffer) void tree_get_fileicon(int selected_item, void * data, ICON * icon) { struct tree_context * local_tc=(struct tree_context *)data; +#ifdef HAVE_TAGCACHE bool id3db = *(local_tc->dirfilter) == SHOW_ID3DB; if (id3db) { *icon = (ICON)tagtree_get_icon(&tc); } - else { + else +#endif + { struct entry* dc = local_tc->dircache; struct entry* e = &dc[selected_item]; *icon = (ICON)filetype_get_icon(e->attr); @@ -304,8 +311,9 @@ int tree_get_file_position(char * filename) */ static int update_dir(void) { + bool changed = false; +#ifdef HAVE_TAGCACHE bool id3db = *tc.dirfilter == SHOW_ID3DB; - bool changed = false; /* Checks for changes */ if (id3db) { if (tc.currtable != lasttable || @@ -322,7 +330,9 @@ static int update_dir(void) changed = true; } } - else { + else +#endif + { /* if the tc.currdir has been changed, reload it ...*/ if (strncmp(tc.currdir, lastdir, sizeof(lastdir)) || reload_dir) { @@ -345,12 +355,17 @@ static int update_dir(void) } if (changed) { - if(!id3db && (tc.dirfull || + if( +#ifdef HAVE_TAGCACHE + !id3db && +#endif + (tc.dirfull || tc.filesindir == global_settings.max_files_in_dir) ) { gui_syncsplash(HZ, true, str(LANG_SHOWDIR_BUFFER_FULL)); } } +#ifdef HAVE_TAGCACHE if (id3db) { if (global_settings.show_path_in_browser == SHOW_PATH_FULL @@ -366,6 +381,7 @@ static int update_dir(void) } } else +#endif { if (global_settings.show_path_in_browser == SHOW_PATH_FULL) { @@ -417,7 +433,9 @@ static int update_dir(void) /* load tracks from specified directory to resume play */ void resume_directory(const char *dir) { +#ifdef HAVE_TAGCACHE bool id3db = *tc.dirfilter == SHOW_ID3DB; +#endif if (ft_load(&tc, dir) < 0) return; @@ -425,8 +443,10 @@ void resume_directory(const char *dir) ft_build_playlist(&tc, 0); +#ifdef HAVE_TAGCACHE if (id3db) tagtree_load(&tc); +#endif } /* Returns the current working directory and also writes cwd to buf if @@ -504,10 +524,12 @@ void set_current_file(char *path) char *name; int i; +#ifdef HAVE_TAGCACHE /* in ID3DB mode it is a bad idea to call this function */ /* (only happens with `follow playlist') */ if( *tc.dirfilter == SHOW_ID3DB ) return; +#endif /* separate directory from filename */ /* gets the directory's name and put it into tc.currdir */ @@ -552,6 +574,7 @@ void set_current_file(char *path) } } +#ifdef HAVE_TAGCACHE static bool check_changed_id3mode(bool currmode) { if (currmode != (global_settings.dirfilter == SHOW_ID3DB)) { @@ -571,6 +594,8 @@ static bool check_changed_id3mode(bool currmode) } return currmode; } +#endif + /* main loop, handles key events */ static bool dirbrowse(void) { @@ -586,11 +611,13 @@ static bool dirbrowse(void) long thumbnail_time = -1; /* for delaying a thumbnail */ char* currdir = tc.currdir; /* just a shortcut */ +#ifdef HAVE_TAGCACHE bool id3db = *tc.dirfilter == SHOW_ID3DB; if (id3db) curr_context=CONTEXT_ID3DB; else +#endif curr_context=CONTEXT_TREE; tc.selected_item = 0; tc.dirlevel=0; @@ -659,7 +686,11 @@ static bool dirbrowse(void) if ( numentries == 0 ) break; +#ifdef HAVE_TAGCACHE switch (id3db?tagtree_enter(&tc):ft_enter(&tc)) +#else + switch (ft_enter(&tc)) +#endif { case 1: reload_dir = true; break; case 2: start_wps = true; break; @@ -677,10 +708,12 @@ static bool dirbrowse(void) /* if we are in /, nothing to do */ if (tc.dirlevel == 0 && !strcmp(currdir,"/")) break; - + +#ifdef HAVE_TAGCACHE if (id3db) tagtree_exit(&tc); else +#endif if (ft_exit(&tc) == 3) exit_func = true; @@ -737,9 +770,11 @@ static bool dirbrowse(void) reload_dir = true; restore = true; +#ifdef HAVE_TAGCACHE id3db = check_changed_id3mode(id3db); if(id3db) reload_dir = true; +#endif } else /* use it as a quick exit instead */ exit_func = true; @@ -769,8 +804,10 @@ static bool dirbrowse(void) reload_dir = true; restore = true; +#ifdef HAVE_TAGCACHE id3db = check_changed_id3mode(id3db); reload_dir = true; +#endif } break; #endif @@ -794,6 +831,7 @@ static bool dirbrowse(void) if(!numentries) onplay_result = onplay(NULL, 0, curr_context); else { +#ifdef HAVE_TAGCACHE if (id3db) { if (tagtree_get_attr(&tc) == TREE_ATTR_MPA) @@ -805,6 +843,7 @@ static bool dirbrowse(void) attr = ATTR_DIRECTORY; } else +#endif { attr = dircache[tc.selected_item].attr; @@ -843,12 +882,14 @@ static bool dirbrowse(void) int attr; char* name; +#ifdef HAVE_TAGCACHE if (id3db) { attr = tagtree_get_attr(&tc); name = tagtree_get_entry(&tc, lasti)->name; } else +#endif { attr = dircache[lasti].attr; name = dircache[lasti].name; @@ -880,7 +921,9 @@ static bool dirbrowse(void) #ifdef HAVE_HOTSWAP case SYS_FS_CHANGED: +#ifdef HAVE_TAGCACHE if (!id3db) +#endif reload_dir = true; /* The 'dir no longer valid' situation will be caught later * by checking the showdir() result. */ @@ -916,13 +959,17 @@ static bool dirbrowse(void) reload_dir = true; #ifdef HAVE_HOTSWAP else +#ifdef HAVE_TAGCACHE if (!id3db) /* Try reload to catch 'no longer valid' case. */ +#endif reload_dir = true; #endif #ifdef HAVE_LCD_COLOR show_main_backdrop(); #endif +#ifdef HAVE_TAGCACHE id3db = check_changed_id3mode(id3db); +#endif restore = true; start_wps=false; } @@ -985,12 +1032,14 @@ static bool dirbrowse(void) thumbnail_time = -1; /* Cancel whatever we were about to say */ +#ifdef HAVE_TAGCACHE if (id3db) { attr = tagtree_get_attr(&tc); name = tagtree_get_entry(&tc, tc.selected_item)->name; } else +#endif { attr = dircache[tc.selected_item].attr; name = dircache[tc.selected_item].name; @@ -1380,7 +1429,9 @@ void ft_play_filename(char *dir, char *file) void tree_flush(void) { scrobbler_shutdown(); +#ifdef HAVE_TAGCACHE tagcache_shutdown(); +#endif playlist_shutdown(); #ifdef HAVE_TC_RAMCACHE @@ -1440,6 +1491,8 @@ void tree_restore(void) } } #endif +#ifdef HAVE_TAGCACHE tagcache_start_scan(); +#endif scrobbler_init(); } diff --git a/docs/CREDITS b/docs/CREDITS index b39c9c6009..abac76db52 100644 --- a/docs/CREDITS +++ b/docs/CREDITS @@ -244,3 +244,4 @@ David Quesada Jared Stafford Martin Hensel Stéphane Doyen +Austin Appel diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index 3793a716ec..e0c245725a 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h @@ -18,6 +18,9 @@ /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 176 #define LCD_HEIGHT 220 diff --git a/firmware/export/config-fmrecorder.h b/firmware/export/config-fmrecorder.h index 995ca3658b..d9377bc6f9 100644 --- a/firmware/export/config-fmrecorder.h +++ b/firmware/export/config-fmrecorder.h @@ -15,6 +15,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 112 #define LCD_HEIGHT 64 diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index fee2b79b2e..ea72c348ea 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -14,6 +14,9 @@ /* define this if you have a colour LCD */ #define HAVE_LCD_COLOR 1 +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 240 #define LCD_HEIGHT 320 diff --git a/firmware/export/config-gmini120.h b/firmware/export/config-gmini120.h index 5aed9a5f7d..a393b17a8a 100644 --- a/firmware/export/config-gmini120.h +++ b/firmware/export/config-gmini120.h @@ -16,6 +16,9 @@ /* define this if you have RTC RAM available for settings */ #define HAVE_RTC_RAM 1 +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 128 #define LCD_HEIGHT 64 diff --git a/firmware/export/config-gminisp.h b/firmware/export/config-gminisp.h index b309c173a9..1c1f299afa 100644 --- a/firmware/export/config-gminisp.h +++ b/firmware/export/config-gminisp.h @@ -7,6 +7,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 128 #define LCD_HEIGHT 64 diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index dbb7583304..8cea98d2bf 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 160 #define LCD_HEIGHT 128 diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 71baa83100..12f1066d3a 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -24,6 +24,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 160 #define LCD_HEIGHT 128 diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index 6fcc0f29f0..26042e8042 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h @@ -22,6 +22,8 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE /* LCD dimensions */ #define LCD_WIDTH 128 diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index d8038f21af..21451dcdac 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -20,6 +20,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 160 #define LCD_HEIGHT 128 diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index c42965d082..c9aad436f1 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -20,6 +20,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 220 #define LCD_HEIGHT 176 diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 83f0767723..df24850892 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -24,6 +24,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 160 #define LCD_HEIGHT 128 diff --git a/firmware/export/config-ifp7xx.h b/firmware/export/config-ifp7xx.h index cebb319a13..9b8693a659 100644 --- a/firmware/export/config-ifp7xx.h +++ b/firmware/export/config-ifp7xx.h @@ -15,6 +15,9 @@ /* define this if you have a colour LCD */ /* #define HAVE_LCD_COLOR 1 */ +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 128 #define LCD_HEIGHT 64 diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 446f56be8e..1cb4f883f7 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 160 #define LCD_HEIGHT 128 diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index cbaa1504f5..065c653fab 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 160 #define LCD_HEIGHT 128 diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index 1c583e98ca..efc57265a0 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 220 #define LCD_HEIGHT 176 diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 09ce7d6868..2e5da2e447 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 138 #define LCD_HEIGHT 110 diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 5020ac6952..8f1fc1ad9f 100755 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 138 #define LCD_HEIGHT 110 diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index e4a2b80d6f..db85fa8ee8 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 176 #define LCD_HEIGHT 132 diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index 113bcc229a..543bfbfe65 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h @@ -22,6 +22,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 320 #define LCD_HEIGHT 240 diff --git a/firmware/export/config-ondiofm.h b/firmware/export/config-ondiofm.h index 745b1ba782..0ccba0de20 100644 --- a/firmware/export/config-ondiofm.h +++ b/firmware/export/config-ondiofm.h @@ -10,6 +10,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 112 #define LCD_HEIGHT 64 diff --git a/firmware/export/config-ondiosp.h b/firmware/export/config-ondiosp.h index 19c59c3aca..a535e47905 100644 --- a/firmware/export/config-ondiosp.h +++ b/firmware/export/config-ondiosp.h @@ -7,6 +7,9 @@ /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 112 #define LCD_HEIGHT 64 diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h index 3dfdb0e727..76f3415db3 100644 --- a/firmware/export/config-player.h +++ b/firmware/export/config-player.h @@ -1,6 +1,9 @@ /* define this if you have a charcell LCD display */ #define HAVE_LCD_CHARCELLS 1 +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions (for the simulator) */ #define LCD_WIDTH 132 /* Display width in pixels */ #define LCD_HEIGHT 64 /* Display height in pixels */ diff --git a/firmware/export/config-recorder.h b/firmware/export/config-recorder.h index a3ba43ee7f..4b79e0b3ae 100644 --- a/firmware/export/config-recorder.h +++ b/firmware/export/config-recorder.h @@ -15,6 +15,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 112 #define LCD_HEIGHT 64 diff --git a/firmware/export/config-recorderv2.h b/firmware/export/config-recorderv2.h index 58a0b78ebe..38ca974761 100644 --- a/firmware/export/config-recorderv2.h +++ b/firmware/export/config-recorderv2.h @@ -15,6 +15,9 @@ /* define this if you have access to the pitchscreen */ #define HAVE_PITCHSCREEN +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + /* LCD dimensions */ #define LCD_WIDTH 112 #define LCD_HEIGHT 64 diff --git a/firmware/export/config.h b/firmware/export/config.h index 6a3091de30..6f6d253fe9 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -217,8 +217,10 @@ * plenty of RAM. Both features can be enabled independently. */ #if (MEMORYSIZE > 8 || MEM > 8) && !defined(BOOTLOADER) #define HAVE_DIRCACHE +#ifdef HAVE_TAGCACHE #define HAVE_TC_RAMCACHE #endif +#endif #if (CONFIG_CODEC == SWCODEC) && !defined(SIMULATOR) && !defined(BOOTLOADER) #define HAVE_PRIORITY_SCHEDULING