diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/filetree.c | 62 | ||||
-rw-r--r-- | apps/filetypes.c | 74 | ||||
-rw-r--r-- | apps/filetypes.h | 31 | ||||
-rw-r--r-- | apps/gui/gwps.c | 4 | ||||
-rw-r--r-- | apps/onplay.c | 8 | ||||
-rw-r--r-- | apps/playlist.c | 5 | ||||
-rw-r--r-- | apps/playlist_catalog.c | 9 | ||||
-rw-r--r-- | apps/playlist_viewer.c | 4 | ||||
-rw-r--r-- | apps/tagtree.c | 8 | ||||
-rw-r--r-- | apps/tree.c | 81 | ||||
-rw-r--r-- | apps/tree.h | 28 |
11 files changed, 159 insertions, 155 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 4c48710797..088d68ac1e 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -63,7 +63,7 @@ int ft_build_playlist(struct tree_context* c, int start_index) | |||
63 | 63 | ||
64 | for(i = 0;i < c->filesindir;i++) | 64 | for(i = 0;i < c->filesindir;i++) |
65 | { | 65 | { |
66 | if((dircache[i].attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | 66 | if((dircache[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) |
67 | { | 67 | { |
68 | DEBUGF("Adding %s\n", dircache[i].name); | 68 | DEBUGF("Adding %s\n", dircache[i].name); |
69 | if (playlist_add(dircache[i].name) < 0) | 69 | if (playlist_add(dircache[i].name) < 0) |
@@ -101,11 +101,11 @@ static void check_file_thumbnails(struct tree_context* c) | |||
101 | &dircache[i].name[strlen(dircache[i].name) | 101 | &dircache[i].name[strlen(dircache[i].name) |
102 | - strlen(file_thumbnail_ext)])) | 102 | - strlen(file_thumbnail_ext)])) |
103 | { /* no .talk file */ | 103 | { /* no .talk file */ |
104 | dircache[i].attr &= ~TREE_ATTR_THUMBNAIL; /* clear */ | 104 | dircache[i].attr &= ~FILE_ATTR_THUMBNAIL; /* clear */ |
105 | } | 105 | } |
106 | else | 106 | else |
107 | { /* .talk file, we later let them speak themselves */ | 107 | { /* .talk file, we later let them speak themselves */ |
108 | dircache[i].attr |= TREE_ATTR_THUMBNAIL; /* set */ | 108 | dircache[i].attr |= FILE_ATTR_THUMBNAIL; /* set */ |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
@@ -130,7 +130,7 @@ static void check_file_thumbnails(struct tree_context* c) | |||
130 | { | 130 | { |
131 | if (!strcasecmp(dircache[i].name, (char *)entry->d_name)) | 131 | if (!strcasecmp(dircache[i].name, (char *)entry->d_name)) |
132 | { /* match */ | 132 | { /* match */ |
133 | dircache[i].attr |= TREE_ATTR_THUMBNAIL; /* set the flag */ | 133 | dircache[i].attr |= FILE_ATTR_THUMBNAIL; /* set the flag */ |
134 | break; /* exit search loop, because we found it */ | 134 | break; /* exit search loop, because we found it */ |
135 | } | 135 | } |
136 | } | 136 | } |
@@ -171,8 +171,8 @@ static int compare(const void* p1, const void* p2) | |||
171 | { | 171 | { |
172 | case 3: /* sort type */ | 172 | case 3: /* sort type */ |
173 | { | 173 | { |
174 | int t1 = e1->attr & TREE_ATTR_MASK; | 174 | int t1 = e1->attr & FILE_ATTR_MASK; |
175 | int t2 = e2->attr & TREE_ATTR_MASK; | 175 | int t2 = e2->attr & FILE_ATTR_MASK; |
176 | 176 | ||
177 | if (!t1) /* unknown type */ | 177 | if (!t1) /* unknown type */ |
178 | t1 = INT_MAX; /* gets a high number, to sort after known */ | 178 | t1 = INT_MAX; /* gets a high number, to sort after known */ |
@@ -262,23 +262,23 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
262 | /* filter out non-visible files */ | 262 | /* filter out non-visible files */ |
263 | if ((!(dptr->attr & ATTR_DIRECTORY) && ( | 263 | if ((!(dptr->attr & ATTR_DIRECTORY) && ( |
264 | (*c->dirfilter == SHOW_PLAYLIST && | 264 | (*c->dirfilter == SHOW_PLAYLIST && |
265 | (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_M3U) || | 265 | (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_M3U) || |
266 | ((*c->dirfilter == SHOW_MUSIC && | 266 | ((*c->dirfilter == SHOW_MUSIC && |
267 | (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_MPA) && | 267 | (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_AUDIO) && |
268 | (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_M3U) || | 268 | (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_M3U) || |
269 | (*c->dirfilter == SHOW_SUPPORTED && !filetype_supported(dptr->attr)))) || | 269 | (*c->dirfilter == SHOW_SUPPORTED && !filetype_supported(dptr->attr)))) || |
270 | (*c->dirfilter == SHOW_WPS && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_WPS) || | 270 | (*c->dirfilter == SHOW_WPS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_WPS) || |
271 | #ifdef HAVE_REMOTE_LCD | 271 | #ifdef HAVE_REMOTE_LCD |
272 | (*c->dirfilter == SHOW_RWPS && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_RWPS) || | 272 | (*c->dirfilter == SHOW_RWPS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_RWPS) || |
273 | #endif | 273 | #endif |
274 | #if CONFIG_TUNER | 274 | #if CONFIG_TUNER |
275 | (*c->dirfilter == SHOW_FMR && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_FMR) || | 275 | (*c->dirfilter == SHOW_FMR && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_FMR) || |
276 | #endif | 276 | #endif |
277 | (*c->dirfilter == SHOW_CFG && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_CFG) || | 277 | (*c->dirfilter == SHOW_CFG && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_CFG) || |
278 | (*c->dirfilter == SHOW_LNG && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_LNG) || | 278 | (*c->dirfilter == SHOW_LNG && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_LNG) || |
279 | (*c->dirfilter == SHOW_MOD && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_MOD) || | 279 | (*c->dirfilter == SHOW_MOD && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_MOD) || |
280 | (*c->dirfilter == SHOW_FONT && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_FONT) || | 280 | (*c->dirfilter == SHOW_FONT && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_FONT) || |
281 | (*c->dirfilter == SHOW_PLUGINS && (dptr->attr & TREE_ATTR_MASK) != TREE_ATTR_ROCK)) | 281 | (*c->dirfilter == SHOW_PLUGINS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_ROCK)) |
282 | { | 282 | { |
283 | i--; | 283 | i--; |
284 | continue; | 284 | continue; |
@@ -340,8 +340,8 @@ int ft_enter(struct tree_context* c) | |||
340 | bool play = false; | 340 | bool play = false; |
341 | int start_index=0; | 341 | int start_index=0; |
342 | 342 | ||
343 | switch ( file->attr & TREE_ATTR_MASK ) { | 343 | switch ( file->attr & FILE_ATTR_MASK ) { |
344 | case TREE_ATTR_M3U: | 344 | case FILE_ATTR_M3U: |
345 | if (global_settings.party_mode) { | 345 | if (global_settings.party_mode) { |
346 | gui_syncsplash(HZ, str(LANG_PARTY_MODE)); | 346 | gui_syncsplash(HZ, str(LANG_PARTY_MODE)); |
347 | break; | 347 | break; |
@@ -374,7 +374,7 @@ int ft_enter(struct tree_context* c) | |||
374 | } | 374 | } |
375 | break; | 375 | break; |
376 | 376 | ||
377 | case TREE_ATTR_MPA: | 377 | case FILE_ATTR_AUDIO: |
378 | if (bookmark_autoload(c->currdir)) | 378 | if (bookmark_autoload(c->currdir)) |
379 | break; | 379 | break; |
380 | 380 | ||
@@ -420,7 +420,7 @@ int ft_enter(struct tree_context* c) | |||
420 | 420 | ||
421 | #if CONFIG_TUNER | 421 | #if CONFIG_TUNER |
422 | /* fmr preset file */ | 422 | /* fmr preset file */ |
423 | case TREE_ATTR_FMR: | 423 | case FILE_ATTR_FMR: |
424 | 424 | ||
425 | gui_syncsplash(0, str(LANG_WAIT)); | 425 | gui_syncsplash(0, str(LANG_WAIT)); |
426 | 426 | ||
@@ -448,7 +448,7 @@ int ft_enter(struct tree_context* c) | |||
448 | 448 | ||
449 | 449 | ||
450 | /* wps config file */ | 450 | /* wps config file */ |
451 | case TREE_ATTR_WPS: | 451 | case FILE_ATTR_WPS: |
452 | gui_syncsplash(0, str(LANG_WAIT)); | 452 | gui_syncsplash(0, str(LANG_WAIT)); |
453 | #if LCD_DEPTH > 1 | 453 | #if LCD_DEPTH > 1 |
454 | unload_wps_backdrop(); | 454 | unload_wps_backdrop(); |
@@ -460,7 +460,7 @@ int ft_enter(struct tree_context* c) | |||
460 | 460 | ||
461 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) | 461 | #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) |
462 | /* remote-wps config file */ | 462 | /* remote-wps config file */ |
463 | case TREE_ATTR_RWPS: | 463 | case FILE_ATTR_RWPS: |
464 | gui_syncsplash(0, str(LANG_WAIT)); | 464 | gui_syncsplash(0, str(LANG_WAIT)); |
465 | wps_data_load(gui_wps[1].data, buf, true); | 465 | wps_data_load(gui_wps[1].data, buf, true); |
466 | set_file(buf, (char *)global_settings.rwps_file, | 466 | set_file(buf, (char *)global_settings.rwps_file, |
@@ -468,20 +468,20 @@ int ft_enter(struct tree_context* c) | |||
468 | break; | 468 | break; |
469 | #endif | 469 | #endif |
470 | 470 | ||
471 | case TREE_ATTR_CFG: | 471 | case FILE_ATTR_CFG: |
472 | gui_syncsplash(0, str(LANG_WAIT)); | 472 | gui_syncsplash(0, str(LANG_WAIT)); |
473 | if (!settings_load_config(buf,true)) | 473 | if (!settings_load_config(buf,true)) |
474 | break; | 474 | break; |
475 | gui_syncsplash(HZ, str(LANG_SETTINGS_LOADED)); | 475 | gui_syncsplash(HZ, str(LANG_SETTINGS_LOADED)); |
476 | break; | 476 | break; |
477 | 477 | ||
478 | case TREE_ATTR_BMARK: | 478 | case FILE_ATTR_BMARK: |
479 | gui_syncsplash(0, str(LANG_WAIT)); | 479 | gui_syncsplash(0, str(LANG_WAIT)); |
480 | bookmark_load(buf, false); | 480 | bookmark_load(buf, false); |
481 | reload_dir = true; | 481 | reload_dir = true; |
482 | break; | 482 | break; |
483 | 483 | ||
484 | case TREE_ATTR_LNG: | 484 | case FILE_ATTR_LNG: |
485 | gui_syncsplash(0, str(LANG_WAIT)); | 485 | gui_syncsplash(0, str(LANG_WAIT)); |
486 | if(!lang_load(buf)) { | 486 | if(!lang_load(buf)) { |
487 | set_file(buf, (char *)global_settings.lang_file, | 487 | set_file(buf, (char *)global_settings.lang_file, |
@@ -492,13 +492,13 @@ int ft_enter(struct tree_context* c) | |||
492 | break; | 492 | break; |
493 | 493 | ||
494 | #ifdef HAVE_LCD_BITMAP | 494 | #ifdef HAVE_LCD_BITMAP |
495 | case TREE_ATTR_FONT: | 495 | case FILE_ATTR_FONT: |
496 | gui_syncsplash(0, str(LANG_WAIT)); | 496 | gui_syncsplash(0, str(LANG_WAIT)); |
497 | font_load(buf); | 497 | font_load(buf); |
498 | set_file(buf, (char *)global_settings.font_file, MAX_FILENAME); | 498 | set_file(buf, (char *)global_settings.font_file, MAX_FILENAME); |
499 | break; | 499 | break; |
500 | 500 | ||
501 | case TREE_ATTR_KBD: | 501 | case FILE_ATTR_KBD: |
502 | gui_syncsplash(0, str(LANG_WAIT)); | 502 | gui_syncsplash(0, str(LANG_WAIT)); |
503 | if (!load_kbd(buf)) | 503 | if (!load_kbd(buf)) |
504 | gui_syncsplash(HZ, str(LANG_KEYBOARD_LOADED)); | 504 | gui_syncsplash(HZ, str(LANG_KEYBOARD_LOADED)); |
@@ -508,14 +508,14 @@ int ft_enter(struct tree_context* c) | |||
508 | 508 | ||
509 | #ifndef SIMULATOR | 509 | #ifndef SIMULATOR |
510 | /* firmware file */ | 510 | /* firmware file */ |
511 | case TREE_ATTR_MOD: | 511 | case FILE_ATTR_MOD: |
512 | gui_syncsplash(0, str(LANG_WAIT)); | 512 | gui_syncsplash(0, str(LANG_WAIT)); |
513 | rolo_load(buf); | 513 | rolo_load(buf); |
514 | break; | 514 | break; |
515 | #endif | 515 | #endif |
516 | 516 | ||
517 | /* plugin file */ | 517 | /* plugin file */ |
518 | case TREE_ATTR_ROCK: | 518 | case FILE_ATTR_ROCK: |
519 | if (global_settings.party_mode) { | 519 | if (global_settings.party_mode) { |
520 | gui_syncsplash(HZ, str(LANG_PARTY_MODE)); | 520 | gui_syncsplash(HZ, str(LANG_PARTY_MODE)); |
521 | break; | 521 | break; |
@@ -534,7 +534,7 @@ int ft_enter(struct tree_context* c) | |||
534 | } | 534 | } |
535 | break; | 535 | break; |
536 | 536 | ||
537 | case TREE_ATTR_CUE: | 537 | case FILE_ATTR_CUE: |
538 | display_cuesheet_content(buf); | 538 | display_cuesheet_content(buf); |
539 | break; | 539 | break; |
540 | 540 | ||
diff --git a/apps/filetypes.c b/apps/filetypes.c index a4eac70374..0daae1b617 100644 --- a/apps/filetypes.c +++ b/apps/filetypes.c | |||
@@ -48,8 +48,66 @@ | |||
48 | #define MAX_FILETYPES 48 | 48 | #define MAX_FILETYPES 48 |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | /* number of bytes for the binary icon */ | 51 | /* a table for the know file types */ |
52 | #define ICON_LENGTH 6 | 52 | const struct filetype inbuilt_filetypes[] = { |
53 | { "mp3", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
54 | { "mp2", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
55 | { "mpa", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
56 | #if CONFIG_CODEC == SWCODEC | ||
57 | /* Temporary hack to allow playlist creation */ | ||
58 | { "mp1", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
59 | { "ogg", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
60 | { "wma", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
61 | { "wav", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
62 | { "flac",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
63 | { "ac3", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
64 | { "a52", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
65 | { "mpc", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
66 | { "wv", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
67 | { "m4a", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
68 | { "m4b", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
69 | { "mp4", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
70 | { "shn", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
71 | { "aif", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
72 | { "aiff",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
73 | { "spx" ,FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
74 | { "sid", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
75 | { "adx", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
76 | { "nsf", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
77 | { "nsfe",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
78 | { "spc", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, | ||
79 | #endif | ||
80 | { "m3u", FILE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST }, | ||
81 | { "m3u8",FILE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST }, | ||
82 | { "cfg", FILE_ATTR_CFG, Icon_Config, VOICE_EXT_CFG }, | ||
83 | { "wps", FILE_ATTR_WPS, Icon_Wps, VOICE_EXT_WPS }, | ||
84 | #ifdef HAVE_REMOTE_LCD | ||
85 | { "rwps",FILE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS }, | ||
86 | #endif | ||
87 | #if LCD_DEPTH > 1 | ||
88 | { "bmp", FILE_ATTR_BMP, Icon_Wps, VOICE_EXT_WPS }, | ||
89 | #endif | ||
90 | #if CONFIG_TUNER | ||
91 | { "fmr", FILE_ATTR_FMR, Icon_Preset, LANG_FMR }, | ||
92 | #endif | ||
93 | { "lng", FILE_ATTR_LNG, Icon_Language, LANG_LANGUAGE }, | ||
94 | { "rock",FILE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK }, | ||
95 | #ifdef HAVE_LCD_BITMAP | ||
96 | { "fnt", FILE_ATTR_FONT,Icon_Font, VOICE_EXT_FONT }, | ||
97 | { "kbd", FILE_ATTR_KBD, Icon_Keyboard, VOICE_EXT_KBD }, | ||
98 | #endif | ||
99 | { "bmark",FILE_ATTR_BMARK, Icon_Bookmark, VOICE_EXT_BMARK }, | ||
100 | { "cue", FILE_ATTR_CUE, Icon_Bookmark, LANG_CUESHEET }, | ||
101 | #ifdef BOOTFILE_EXT | ||
102 | { BOOTFILE_EXT, FILE_ATTR_MOD, Icon_Firmware, VOICE_EXT_AJZ }, | ||
103 | #endif /* #ifndef SIMULATOR */ | ||
104 | }; | ||
105 | |||
106 | void tree_get_filetypes(const struct filetype** types, int* count) | ||
107 | { | ||
108 | *types = inbuilt_filetypes; | ||
109 | *count = sizeof(inbuilt_filetypes) / sizeof(*inbuilt_filetypes); | ||
110 | } | ||
53 | 111 | ||
54 | /* mask for dynamic filetype info in attribute */ | 112 | /* mask for dynamic filetype info in attribute */ |
55 | #define FILETYPES_MASK 0xFF00 | 113 | #define FILETYPES_MASK 0xFF00 |
@@ -155,17 +213,15 @@ static void rm_whitespaces(char* str) | |||
155 | 213 | ||
156 | static void read_builtin_types(void) | 214 | static void read_builtin_types(void) |
157 | { | 215 | { |
158 | const struct filetype *types; | 216 | int count = sizeof(inbuilt_filetypes)/sizeof(*inbuilt_filetypes), i; |
159 | int count, i; | ||
160 | tree_get_filetypes(&types, &count); | ||
161 | for(i=0; i<count && (filetype_count < MAX_FILETYPES); i++) | 217 | for(i=0; i<count && (filetype_count < MAX_FILETYPES); i++) |
162 | { | 218 | { |
163 | filetypes[filetype_count].extension = types[i].extension; | 219 | filetypes[filetype_count].extension = inbuilt_filetypes[i].extension; |
164 | filetypes[filetype_count].plugin = NULL; | 220 | filetypes[filetype_count].plugin = NULL; |
165 | filetypes[filetype_count].attr = types[i].tree_attr>>8; | 221 | filetypes[filetype_count].attr = inbuilt_filetypes[i].tree_attr>>8; |
166 | if (filetypes[filetype_count].attr > heighest_attr) | 222 | if (filetypes[filetype_count].attr > heighest_attr) |
167 | heighest_attr = filetypes[filetype_count].attr; | 223 | heighest_attr = filetypes[filetype_count].attr; |
168 | filetypes[filetype_count].icon = types[i].icon; | 224 | filetypes[filetype_count].icon = inbuilt_filetypes[i].icon; |
169 | filetype_count++; | 225 | filetype_count++; |
170 | } | 226 | } |
171 | } | 227 | } |
@@ -247,7 +303,7 @@ int filetype_get_attr(const char* file) | |||
247 | { | 303 | { |
248 | if (filetypes[i].extension && | 304 | if (filetypes[i].extension && |
249 | !strcasecmp(extension, filetypes[i].extension)) | 305 | !strcasecmp(extension, filetypes[i].extension)) |
250 | return (filetypes[i].attr<<8)&TREE_ATTR_MASK; | 306 | return (filetypes[i].attr<<8)&FILE_ATTR_MASK; |
251 | } | 307 | } |
252 | return 0; | 308 | return 0; |
253 | } | 309 | } |
diff --git a/apps/filetypes.h b/apps/filetypes.h index 182cb0da4e..a38b4bc000 100644 --- a/apps/filetypes.h +++ b/apps/filetypes.h | |||
@@ -21,13 +21,40 @@ | |||
21 | 21 | ||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include <tree.h> | 23 | #include <tree.h> |
24 | #include <menu.h> | 24 | |
25 | /* using attribute bits not used by FAT (FAT uses lower 7) */ | ||
26 | #define FILE_ATTR_THUMBNAIL 0x0080 /* corresponding .talk file exists */ | ||
27 | /* (this also reflects the sort order if by type) */ | ||
28 | #define FILE_ATTR_BMARK 0x0100 /* book mark file */ | ||
29 | #define FILE_ATTR_M3U 0x0200 /* playlist */ | ||
30 | #define FILE_ATTR_AUDIO 0x0300 /* audio file */ | ||
31 | #define FILE_ATTR_CFG 0x0400 /* config file */ | ||
32 | #define FILE_ATTR_WPS 0x0500 /* wps config file */ | ||
33 | #define FILE_ATTR_FONT 0x0600 /* font file */ | ||
34 | #define FILE_ATTR_LNG 0x0700 /* binary lang file */ | ||
35 | #define FILE_ATTR_ROCK 0x0800 /* binary rockbox plugin */ | ||
36 | #define FILE_ATTR_MOD 0x0900 /* firmware file */ | ||
37 | #define FILE_ATTR_RWPS 0x0A00 /* remote-wps config file */ | ||
38 | #define FILE_ATTR_BMP 0x0B00 /* backdrop bmp file */ | ||
39 | #define FILE_ATTR_KBD 0x0C00 /* keyboard file */ | ||
40 | #define FILE_ATTR_FMR 0x0D00 /* preset file */ | ||
41 | #define FILE_ATTR_CUE 0x0E00 /* cuesheet file */ | ||
42 | #define FILE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */ | ||
43 | |||
44 | struct filetype { | ||
45 | char* extension; | ||
46 | int tree_attr; | ||
47 | int icon; | ||
48 | int voiceclip; | ||
49 | }; | ||
50 | void tree_get_filetypes(const struct filetype**, int*); | ||
51 | |||
25 | /* init the filetypes structs. | 52 | /* init the filetypes structs. |
26 | uses audio buffer for storage, so call early in init... */ | 53 | uses audio buffer for storage, so call early in init... */ |
27 | void filetype_init(void); | 54 | void filetype_init(void); |
28 | void read_viewer_theme_file(void); | 55 | void read_viewer_theme_file(void); |
29 | 56 | ||
30 | /* Return the attribute (TREE_ATTR_*) of the file */ | 57 | /* Return the attribute (FILE_ATTR_*) of the file */ |
31 | int filetype_get_attr(const char* file); | 58 | int filetype_get_attr(const char* file); |
32 | int filetype_get_icon(int attr); | 59 | int filetype_get_icon(int attr); |
33 | /* return the plugin filename associated with the file */ | 60 | /* return the plugin filename associated with the file */ |
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c index 6bf584fc6a..0819d122f5 100644 --- a/apps/gui/gwps.c +++ b/apps/gui/gwps.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "backlight.h" | 28 | #include "backlight.h" |
29 | #include "action.h" | 29 | #include "action.h" |
30 | #include "kernel.h" | 30 | #include "kernel.h" |
31 | #include "tree.h" | 31 | #include "filetypes.h" |
32 | #include "debug.h" | 32 | #include "debug.h" |
33 | #include "sprintf.h" | 33 | #include "sprintf.h" |
34 | #include "settings.h" | 34 | #include "settings.h" |
@@ -236,7 +236,7 @@ long gui_wps_show(void) | |||
236 | show_main_backdrop(); | 236 | show_main_backdrop(); |
237 | #endif | 237 | #endif |
238 | action_signalscreenchange(); | 238 | action_signalscreenchange(); |
239 | if (onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS) | 239 | if (onplay(wps_state.id3->path, FILE_ATTR_AUDIO, CONTEXT_WPS) |
240 | == ONPLAY_MAINMENU) | 240 | == ONPLAY_MAINMENU) |
241 | return GO_TO_ROOT; | 241 | return GO_TO_ROOT; |
242 | #if LCD_DEPTH > 1 | 242 | #if LCD_DEPTH > 1 |
diff --git a/apps/onplay.c b/apps/onplay.c index a92736385c..6aaa6e734f 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -171,7 +171,7 @@ static bool add_to_playlist(int position, bool queue) | |||
171 | else | 171 | else |
172 | #endif | 172 | #endif |
173 | { | 173 | { |
174 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | 174 | if ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) |
175 | playlist_insert_track(NULL, selected_file, position, queue, true); | 175 | playlist_insert_track(NULL, selected_file, position, queue, true); |
176 | else if (selected_file_attr & ATTR_DIRECTORY) | 176 | else if (selected_file_attr & ATTR_DIRECTORY) |
177 | { | 177 | { |
@@ -188,7 +188,7 @@ static bool add_to_playlist(int position, bool queue) | |||
188 | playlist_insert_directory(NULL, selected_file, position, queue, | 188 | playlist_insert_directory(NULL, selected_file, position, queue, |
189 | recurse); | 189 | recurse); |
190 | } | 190 | } |
191 | else if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U) | 191 | else if ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U) |
192 | playlist_insert_playlist(NULL, selected_file, position, queue); | 192 | playlist_insert_playlist(NULL, selected_file, position, queue); |
193 | } | 193 | } |
194 | 194 | ||
@@ -273,7 +273,7 @@ static bool playlist_options(void) | |||
273 | int m, i=0, pstart=0, result; | 273 | int m, i=0, pstart=0, result; |
274 | bool ret = false; | 274 | bool ret = false; |
275 | 275 | ||
276 | if ((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U && | 276 | if ((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U && |
277 | context == CONTEXT_TREE) | 277 | context == CONTEXT_TREE) |
278 | { | 278 | { |
279 | items[i].desc = ID2P(LANG_VIEW); | 279 | items[i].desc = ID2P(LANG_VIEW); |
@@ -355,7 +355,7 @@ static bool playlist_options(void) | |||
355 | args[i].queue = false; | 355 | args[i].queue = false; |
356 | i++; | 356 | i++; |
357 | } | 357 | } |
358 | else if (((selected_file_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) || | 358 | else if (((selected_file_attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) || |
359 | (selected_file_attr & ATTR_DIRECTORY)) | 359 | (selected_file_attr & ATTR_DIRECTORY)) |
360 | { | 360 | { |
361 | items[i].desc = ID2P(LANG_INSERT); | 361 | items[i].desc = ID2P(LANG_INSERT); |
diff --git a/apps/playlist.c b/apps/playlist.c index 9d88e210f8..ba98648c2e 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -91,6 +91,7 @@ | |||
91 | #include "dircache.h" | 91 | #include "dircache.h" |
92 | #include "thread.h" | 92 | #include "thread.h" |
93 | #include "usb.h" | 93 | #include "usb.h" |
94 | #include "filetypes.h" | ||
94 | #ifdef HAVE_LCD_BITMAP | 95 | #ifdef HAVE_LCD_BITMAP |
95 | #include "icons.h" | 96 | #include "icons.h" |
96 | #endif | 97 | #endif |
@@ -1536,7 +1537,7 @@ static int check_subdir_for_music(char *dir, char *subdir) | |||
1536 | { | 1537 | { |
1537 | if (files[i].attr & ATTR_DIRECTORY) | 1538 | if (files[i].attr & ATTR_DIRECTORY) |
1538 | has_subdir = true; | 1539 | has_subdir = true; |
1539 | else if ((files[i].attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | 1540 | else if ((files[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) |
1540 | { | 1541 | { |
1541 | has_music = true; | 1542 | has_music = true; |
1542 | break; | 1543 | break; |
@@ -3568,7 +3569,7 @@ int playlist_directory_tracksearch(const char* dirname, bool recurse, | |||
3568 | else | 3569 | else |
3569 | continue; | 3570 | continue; |
3570 | } | 3571 | } |
3571 | else if ((files[i].attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | 3572 | else if ((files[i].attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) |
3572 | { | 3573 | { |
3573 | snprintf(buf, sizeof(buf), "%s/%s", dirname, files[i].name); | 3574 | snprintf(buf, sizeof(buf), "%s/%s", dirname, files[i].name); |
3574 | 3575 | ||
diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index 1e3d523181..5ff2bddaab 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "sprintf.h" | 37 | #include "sprintf.h" |
38 | #include "tree.h" | 38 | #include "tree.h" |
39 | #include "yesno.h" | 39 | #include "yesno.h" |
40 | #include "filetypes.h" | ||
40 | 41 | ||
41 | #define PLAYLIST_CATALOG_CFG ROCKBOX_DIR "/playlist_catalog.config" | 42 | #define PLAYLIST_CATALOG_CFG ROCKBOX_DIR "/playlist_catalog.config" |
42 | #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists" | 43 | #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists" |
@@ -167,7 +168,7 @@ static int create_playlist_list(char** playlists, int num_items, | |||
167 | 168 | ||
168 | for (i=0; i<num_files && index<num_items; i++) | 169 | for (i=0; i<num_files && index<num_items; i++) |
169 | { | 170 | { |
170 | if (files[i].attr & TREE_ATTR_M3U) | 171 | if (files[i].attr & FILE_ATTR_M3U) |
171 | { | 172 | { |
172 | if (most_recent && !strncmp(files[i].name, most_recent_playlist, | 173 | if (most_recent && !strncmp(files[i].name, most_recent_playlist, |
173 | sizeof(most_recent_playlist))) | 174 | sizeof(most_recent_playlist))) |
@@ -287,7 +288,7 @@ static int display_playlists(char* playlist, bool view) | |||
287 | snprintf(playlist, MAX_PATH, "%s/%s", playlist_dir, | 288 | snprintf(playlist, MAX_PATH, "%s/%s", playlist_dir, |
288 | sel_file); | 289 | sel_file); |
289 | 290 | ||
290 | if (onplay(playlist, TREE_ATTR_M3U, | 291 | if (onplay(playlist, FILE_ATTR_M3U, |
291 | CONTEXT_TREE) != ONPLAY_OK) | 292 | CONTEXT_TREE) != ONPLAY_OK) |
292 | { | 293 | { |
293 | result = 0; | 294 | result = 0; |
@@ -358,13 +359,13 @@ static int add_to_playlist(const char* playlist, char* sel, int sel_attr) | |||
358 | /* In case we're in the playlist directory */ | 359 | /* In case we're in the playlist directory */ |
359 | reload_directory(); | 360 | reload_directory(); |
360 | 361 | ||
361 | if ((sel_attr & TREE_ATTR_MASK) == TREE_ATTR_MPA) | 362 | if ((sel_attr & FILE_ATTR_MASK) == FILE_ATTR_AUDIO) |
362 | { | 363 | { |
363 | /* append the selected file */ | 364 | /* append the selected file */ |
364 | if (fdprintf(fd, "%s\n", sel) > 0) | 365 | if (fdprintf(fd, "%s\n", sel) > 0) |
365 | result = 0; | 366 | result = 0; |
366 | } | 367 | } |
367 | else if ((sel_attr & TREE_ATTR_MASK) == TREE_ATTR_M3U) | 368 | else if ((sel_attr & FILE_ATTR_MASK) == FILE_ATTR_M3U) |
368 | { | 369 | { |
369 | /* append playlist */ | 370 | /* append playlist */ |
370 | int f, fs, i; | 371 | int f, fs, i; |
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index b5f72cbfe5..eaca81e190 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "menu.h" | 32 | #include "menu.h" |
33 | #include "plugin.h" | 33 | #include "plugin.h" |
34 | #include "keyboard.h" | 34 | #include "keyboard.h" |
35 | #include "tree.h" | 35 | #include "filetypes.h" |
36 | #include "onplay.h" | 36 | #include "onplay.h" |
37 | #include "talk.h" | 37 | #include "talk.h" |
38 | #include "misc.h" | 38 | #include "misc.h" |
@@ -487,7 +487,7 @@ static int onplay_menu(int index) | |||
487 | case 2: /* add to catalog */ | 487 | case 2: /* add to catalog */ |
488 | case 3: /* add to a new one */ | 488 | case 3: /* add to a new one */ |
489 | catalog_add_to_a_playlist(current_track->name, | 489 | catalog_add_to_a_playlist(current_track->name, |
490 | TREE_ATTR_MPA, | 490 | FILE_ATTR_AUDIO, |
491 | result==3 ); | 491 | result==3 ); |
492 | ret = 0; | 492 | ret = 0; |
493 | break; | 493 | break; |
diff --git a/apps/tagtree.c b/apps/tagtree.c index 41db17b31a..405274c6bd 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <string.h> | 25 | #include <string.h> |
26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
27 | #include "config.h" | ||
27 | #include "system.h" | 28 | #include "system.h" |
28 | #include "kernel.h" | 29 | #include "kernel.h" |
29 | #include "splash.h" | 30 | #include "splash.h" |
@@ -43,6 +44,7 @@ | |||
43 | #include "playback.h" | 44 | #include "playback.h" |
44 | #include "yesno.h" | 45 | #include "yesno.h" |
45 | #include "misc.h" | 46 | #include "misc.h" |
47 | #include "filetypes.h" | ||
46 | 48 | ||
47 | #define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config" | 49 | #define FILE_SEARCH_INSTRUCTIONS ROCKBOX_DIR "/tagnavi.config" |
48 | 50 | ||
@@ -1669,13 +1671,13 @@ int tagtree_get_attr(struct tree_context* c) | |||
1669 | { | 1671 | { |
1670 | case navibrowse: | 1672 | case navibrowse: |
1671 | if (csi->tagorder[c->currextra] == tag_title) | 1673 | if (csi->tagorder[c->currextra] == tag_title) |
1672 | attr = TREE_ATTR_MPA; | 1674 | attr = FILE_ATTR_AUDIO; |
1673 | else | 1675 | else |
1674 | attr = ATTR_DIRECTORY; | 1676 | attr = ATTR_DIRECTORY; |
1675 | break; | 1677 | break; |
1676 | 1678 | ||
1677 | case allsubentries: | 1679 | case allsubentries: |
1678 | attr = TREE_ATTR_MPA; | 1680 | attr = FILE_ATTR_AUDIO; |
1679 | break; | 1681 | break; |
1680 | 1682 | ||
1681 | default: | 1683 | default: |
@@ -1690,7 +1692,7 @@ int tagtree_get_icon(struct tree_context* c) | |||
1690 | { | 1692 | { |
1691 | int icon = Icon_Folder; | 1693 | int icon = Icon_Folder; |
1692 | 1694 | ||
1693 | if (tagtree_get_attr(c) == TREE_ATTR_MPA) | 1695 | if (tagtree_get_attr(c) == FILE_ATTR_AUDIO) |
1694 | icon = Icon_Audio; | 1696 | icon = Icon_Audio; |
1695 | 1697 | ||
1696 | return icon; | 1698 | return icon; |
diff --git a/apps/tree.c b/apps/tree.c index 944f76840f..b847a7f112 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -85,60 +85,8 @@ | |||
85 | #include "backdrop.h" | 85 | #include "backdrop.h" |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | /* a table for the know file types */ | 88 | static const struct filetype *filetypes; |
89 | const struct filetype filetypes[] = { | 89 | static int filetypes_count; |
90 | { "mp3", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
91 | { "mp2", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
92 | { "mpa", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
93 | #if CONFIG_CODEC == SWCODEC | ||
94 | /* Temporary hack to allow playlist creation */ | ||
95 | { "mp1", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
96 | { "ogg", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
97 | { "wma", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
98 | { "wav", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
99 | { "flac",TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
100 | { "ac3", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
101 | { "a52", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
102 | { "mpc", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
103 | { "wv", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
104 | { "m4a", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
105 | { "m4b", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
106 | { "mp4", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
107 | { "shn", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
108 | { "aif", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
109 | { "aiff",TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
110 | { "spx" ,TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
111 | { "sid", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
112 | { "adx", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
113 | { "nsf", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
114 | { "nsfe", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
115 | { "spc", TREE_ATTR_MPA, Icon_Audio, VOICE_EXT_MPA }, | ||
116 | #endif | ||
117 | { "m3u", TREE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST }, | ||
118 | { "m3u8", TREE_ATTR_M3U, Icon_Playlist, LANG_PLAYLIST }, | ||
119 | { "cfg", TREE_ATTR_CFG, Icon_Config, VOICE_EXT_CFG }, | ||
120 | { "wps", TREE_ATTR_WPS, Icon_Wps, VOICE_EXT_WPS }, | ||
121 | #ifdef HAVE_REMOTE_LCD | ||
122 | { "rwps", TREE_ATTR_RWPS, Icon_Wps, VOICE_EXT_RWPS }, | ||
123 | #endif | ||
124 | #if LCD_DEPTH > 1 | ||
125 | { "bmp", TREE_ATTR_BMP, Icon_Wps, VOICE_EXT_WPS }, | ||
126 | #endif | ||
127 | #if CONFIG_TUNER | ||
128 | { "fmr", TREE_ATTR_FMR, Icon_Preset, LANG_FMR }, | ||
129 | #endif | ||
130 | { "lng", TREE_ATTR_LNG, Icon_Language, LANG_LANGUAGE }, | ||
131 | { "rock",TREE_ATTR_ROCK,Icon_Plugin, VOICE_EXT_ROCK }, | ||
132 | #ifdef HAVE_LCD_BITMAP | ||
133 | { "fnt", TREE_ATTR_FONT,Icon_Font, VOICE_EXT_FONT }, | ||
134 | { "kbd", TREE_ATTR_KBD, Icon_Keyboard, VOICE_EXT_KBD }, | ||
135 | #endif | ||
136 | { "bmark",TREE_ATTR_BMARK, Icon_Bookmark, VOICE_EXT_BMARK }, | ||
137 | { "cue", TREE_ATTR_CUE, Icon_Bookmark, LANG_CUESHEET }, | ||
138 | #ifdef BOOTFILE_EXT | ||
139 | { BOOTFILE_EXT, TREE_ATTR_MOD, Icon_Firmware, VOICE_EXT_AJZ }, | ||
140 | #endif /* #ifndef SIMULATOR */ | ||
141 | }; | ||
142 | 90 | ||
143 | struct gui_synclist tree_lists; | 91 | struct gui_synclist tree_lists; |
144 | 92 | ||
@@ -279,11 +227,7 @@ void browse_root(void) | |||
279 | root_menu(); | 227 | root_menu(); |
280 | } | 228 | } |
281 | 229 | ||
282 | void tree_get_filetypes(const struct filetype** types, int* count) | 230 | |
283 | { | ||
284 | *types = filetypes; | ||
285 | *count = sizeof(filetypes) / sizeof(*filetypes); | ||
286 | } | ||
287 | 231 | ||
288 | struct tree_context* tree_get_context(void) | 232 | struct tree_context* tree_get_context(void) |
289 | { | 233 | { |
@@ -710,9 +654,9 @@ static int dirbrowse() | |||
710 | #ifdef HAVE_TAGCACHE | 654 | #ifdef HAVE_TAGCACHE |
711 | if (id3db) | 655 | if (id3db) |
712 | { | 656 | { |
713 | if (tagtree_get_attr(&tc) == TREE_ATTR_MPA) | 657 | if (tagtree_get_attr(&tc) == FILE_ATTR_AUDIO) |
714 | { | 658 | { |
715 | attr = TREE_ATTR_MPA; | 659 | attr = FILE_ATTR_AUDIO; |
716 | tagtree_get_filename(&tc, buf, sizeof(buf)); | 660 | tagtree_get_filename(&tc, buf, sizeof(buf)); |
717 | } | 661 | } |
718 | else | 662 | else |
@@ -931,7 +875,7 @@ static int dirbrowse() | |||
931 | case 1: /* files as numbers */ | 875 | case 1: /* files as numbers */ |
932 | ft_play_filenumber( | 876 | ft_play_filenumber( |
933 | tc.selected_item-tc.dirsindir+1, | 877 | tc.selected_item-tc.dirsindir+1, |
934 | attr & TREE_ATTR_MASK); | 878 | attr & FILE_ATTR_MASK); |
935 | break; | 879 | break; |
936 | 880 | ||
937 | case 2: /* files spelled */ | 881 | case 2: /* files spelled */ |
@@ -941,7 +885,7 @@ static int dirbrowse() | |||
941 | case 3: /* thumbnail clip */ | 885 | case 3: /* thumbnail clip */ |
942 | /* "schedule" a thumbnail, to have a little | 886 | /* "schedule" a thumbnail, to have a little |
943 | delay */ | 887 | delay */ |
944 | if (attr & TREE_ATTR_THUMBNAIL) | 888 | if (attr & FILE_ATTR_THUMBNAIL) |
945 | thumbnail_time = current_tick + HOVER_DELAY; | 889 | thumbnail_time = current_tick + HOVER_DELAY; |
946 | else | 890 | else |
947 | /* spell the number as fallback */ | 891 | /* spell the number as fallback */ |
@@ -1003,15 +947,15 @@ static bool add_dir(char* dirname, int len, int fd) | |||
1003 | } | 947 | } |
1004 | else { | 948 | else { |
1005 | int x = strlen((char *)entry->d_name); | 949 | int x = strlen((char *)entry->d_name); |
1006 | unsigned int i; | 950 | int i; |
1007 | char *cp = strrchr((char *)entry->d_name,'.'); | 951 | char *cp = strrchr((char *)entry->d_name,'.'); |
1008 | 952 | ||
1009 | if (cp) { | 953 | if (cp) { |
1010 | cp++; | 954 | cp++; |
1011 | 955 | ||
1012 | /* add all supported audio files to playlists */ | 956 | /* add all supported audio files to playlists */ |
1013 | for (i=0; i < sizeof(filetypes)/sizeof(struct filetype); i++) { | 957 | for (i=0; i < filetypes_count; i++) { |
1014 | if (filetypes[i].tree_attr == TREE_ATTR_MPA) { | 958 | if (filetypes[i].tree_attr == FILE_ATTR_AUDIO) { |
1015 | if (!strcasecmp(cp, filetypes[i].extension)) { | 959 | if (!strcasecmp(cp, filetypes[i].extension)) { |
1016 | char buf[8]; | 960 | char buf[8]; |
1017 | int i; | 961 | int i; |
@@ -1147,6 +1091,7 @@ void tree_init(void) | |||
1147 | 1091 | ||
1148 | tc.dircache_size = max_files * sizeof(struct entry); | 1092 | tc.dircache_size = max_files * sizeof(struct entry); |
1149 | tc.dircache = buffer_alloc(tc.dircache_size); | 1093 | tc.dircache = buffer_alloc(tc.dircache_size); |
1094 | tree_get_filetypes(&filetypes, &filetypes_count); | ||
1150 | } | 1095 | } |
1151 | 1096 | ||
1152 | void bookmark_play(char *resume_file, int index, int offset, int seed, | 1097 | void bookmark_play(char *resume_file, int index, int offset, int seed, |
@@ -1230,9 +1175,9 @@ void bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1230 | static int ft_play_filenumber(int pos, int attr) | 1175 | static int ft_play_filenumber(int pos, int attr) |
1231 | { | 1176 | { |
1232 | /* try to find a voice ID for the extension, if known */ | 1177 | /* try to find a voice ID for the extension, if known */ |
1233 | unsigned int j; | 1178 | int j; |
1234 | int ext_id = -1; /* default to none */ | 1179 | int ext_id = -1; /* default to none */ |
1235 | for (j=0; j<sizeof(filetypes)/sizeof(*filetypes); j++) | 1180 | for (j=0; j<filetypes_count; j++) |
1236 | { | 1181 | { |
1237 | if (attr == filetypes[j].tree_attr) | 1182 | if (attr == filetypes[j].tree_attr) |
1238 | { | 1183 | { |
diff --git a/apps/tree.h b/apps/tree.h index 062dcf9639..5c808e8df7 100644 --- a/apps/tree.h +++ b/apps/tree.h | |||
@@ -29,12 +29,6 @@ struct entry { | |||
29 | char *name; | 29 | char *name; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | struct filetype { | ||
33 | char* extension; | ||
34 | int tree_attr; | ||
35 | int icon; | ||
36 | int voiceclip; | ||
37 | }; | ||
38 | 32 | ||
39 | /* browser context for file or db */ | 33 | /* browser context for file or db */ |
40 | struct tree_context { | 34 | struct tree_context { |
@@ -75,28 +69,6 @@ struct tree_context { | |||
75 | bool dirfull; | 69 | bool dirfull; |
76 | }; | 70 | }; |
77 | 71 | ||
78 | /* using attribute bits not used by FAT (FAT uses lower 7) */ | ||
79 | |||
80 | #define TREE_ATTR_THUMBNAIL 0x0080 /* corresponding .talk file exists */ | ||
81 | |||
82 | /* (this also reflects the sort order if by type) */ | ||
83 | #define TREE_ATTR_BMARK 0x0100 /* book mark file */ | ||
84 | #define TREE_ATTR_M3U 0x0200 /* playlist */ | ||
85 | #define TREE_ATTR_MPA 0x0300 /* mpeg audio file */ | ||
86 | #define TREE_ATTR_CFG 0x0400 /* config file */ | ||
87 | #define TREE_ATTR_WPS 0x0500 /* wps config file */ | ||
88 | #define TREE_ATTR_FONT 0x0600 /* font file */ | ||
89 | #define TREE_ATTR_LNG 0x0700 /* binary lang file */ | ||
90 | #define TREE_ATTR_ROCK 0x0800 /* binary rockbox plugin */ | ||
91 | #define TREE_ATTR_MOD 0x0900 /* firmware file */ | ||
92 | #define TREE_ATTR_RWPS 0x1000 /* remote-wps config file */ | ||
93 | #define TREE_ATTR_BMP 0x1100 /* backdrop bmp file */ | ||
94 | #define TREE_ATTR_KBD 0x1200 /* keyboard file */ | ||
95 | #define TREE_ATTR_FMR 0x1300 /* preset file */ | ||
96 | #define TREE_ATTR_CUE 0x1400 /* cuesheet file */ | ||
97 | #define TREE_ATTR_MASK 0xFF00 /* which bits tree.c uses for file types */ | ||
98 | |||
99 | void tree_get_filetypes(const struct filetype**, int*); | ||
100 | void tree_init(void); | 72 | void tree_init(void); |
101 | void browse_root(void); | 73 | void browse_root(void); |
102 | void get_current_file(char* buffer, int buffer_len); | 74 | void get_current_file(char* buffer, int buffer_len); |