diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2013-07-12 12:03:20 -0400 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2013-07-12 21:39:06 -0400 |
commit | ffa8626b0c93f8a65e0e17190917f7f173160842 (patch) | |
tree | d6d9498cdaa0cfff06bc5e079a195f2c63dd1237 | |
parent | d85f796890f496cc89e0dd2588f123432638ab64 (diff) | |
download | rockbox-ffa8626b0c93f8a65e0e17190917f7f173160842.tar.gz rockbox-ffa8626b0c93f8a65e0e17190917f7f173160842.zip |
Fix whitespace in files for following commit.
Change-Id: I4adb8a152e9b99fcd26d95da7334d7d0cbe2a036
-rw-r--r-- | apps/gui/wps.c | 40 | ||||
-rw-r--r-- | apps/main.c | 34 | ||||
-rw-r--r-- | apps/menus/playback_menu.c | 18 | ||||
-rw-r--r-- | apps/misc.c | 20 | ||||
-rw-r--r-- | apps/mpeg.c | 162 | ||||
-rw-r--r-- | apps/playback.h | 2 | ||||
-rw-r--r-- | apps/scrobbler.c | 2 | ||||
-rw-r--r-- | apps/tagtree.c | 414 |
8 files changed, 346 insertions, 346 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 1acd00d120..a3d7a1bcf1 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -68,7 +68,7 @@ | |||
68 | #define RESTORE_WPS_INSTANTLY 0l | 68 | #define RESTORE_WPS_INSTANTLY 0l |
69 | #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) | 69 | #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) |
70 | 70 | ||
71 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ | 71 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ |
72 | /* 3% of 30min file == 54s step size */ | 72 | /* 3% of 30min file == 54s step size */ |
73 | #define MIN_FF_REWIND_STEP 500 | 73 | #define MIN_FF_REWIND_STEP 500 |
74 | 74 | ||
@@ -170,7 +170,7 @@ void unpause_action(bool may_fade, bool updatewps) | |||
170 | #endif | 170 | #endif |
171 | 171 | ||
172 | (void)may_fade; | 172 | (void)may_fade; |
173 | } | 173 | } |
174 | 174 | ||
175 | #if CONFIG_CODEC != SWCODEC | 175 | #if CONFIG_CODEC != SWCODEC |
176 | void fade(bool fade_in, bool updatewps) | 176 | void fade(bool fade_in, bool updatewps) |
@@ -189,7 +189,7 @@ void fade(bool fade_in, bool updatewps) | |||
189 | 189 | ||
190 | sleep(HZ/10); /* let audio thread run */ | 190 | sleep(HZ/10); /* let audio thread run */ |
191 | audio_resume(); | 191 | audio_resume(); |
192 | 192 | ||
193 | if (updatewps) | 193 | if (updatewps) |
194 | update_non_static(); | 194 | update_non_static(); |
195 | 195 | ||
@@ -227,7 +227,7 @@ void fade(bool fade_in, bool updatewps) | |||
227 | sound_set_volume(global_settings.volume); | 227 | sound_set_volume(global_settings.volume); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | #endif /* SWCODEC */ | 230 | #endif /* SWCODEC */ |
231 | 231 | ||
232 | static bool update_onvol_change(enum screen_type screen) | 232 | static bool update_onvol_change(enum screen_type screen) |
233 | { | 233 | { |
@@ -298,8 +298,8 @@ static int skintouch_to_wps(struct wps_data *data) | |||
298 | 298 | ||
299 | bool ffwd_rew(int button) | 299 | bool ffwd_rew(int button) |
300 | { | 300 | { |
301 | unsigned int step = 0; /* current ff/rewind step */ | 301 | unsigned int step = 0; /* current ff/rewind step */ |
302 | unsigned int max_step = 0; /* maximum ff/rewind step */ | 302 | unsigned int max_step = 0; /* maximum ff/rewind step */ |
303 | int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */ | 303 | int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */ |
304 | int direction = -1; /* forward=1 or backward=-1 */ | 304 | int direction = -1; /* forward=1 or backward=-1 */ |
305 | bool exit = false; | 305 | bool exit = false; |
@@ -323,7 +323,7 @@ bool ffwd_rew(int button) | |||
323 | if (direction == 1) | 323 | if (direction == 1) |
324 | { | 324 | { |
325 | /* fast forwarding, calc max step relative to end */ | 325 | /* fast forwarding, calc max step relative to end */ |
326 | max_step = (skin_get_global_state()->id3->length - | 326 | max_step = (skin_get_global_state()->id3->length - |
327 | (skin_get_global_state()->id3->elapsed + | 327 | (skin_get_global_state()->id3->elapsed + |
328 | ff_rewind_count)) * | 328 | ff_rewind_count)) * |
329 | FF_REWIND_MAX_PERCENT / 100; | 329 | FF_REWIND_MAX_PERCENT / 100; |
@@ -360,7 +360,7 @@ bool ffwd_rew(int button) | |||
360 | FOR_NB_SCREENS(i) | 360 | FOR_NB_SCREENS(i) |
361 | skin_get_gwps(WPS, i)->display->stop_scroll(); | 361 | skin_get_gwps(WPS, i)->display->stop_scroll(); |
362 | #endif | 362 | #endif |
363 | if (direction > 0) | 363 | if (direction > 0) |
364 | status_set_ffmode(STATUS_FASTFORWARD); | 364 | status_set_ffmode(STATUS_FASTFORWARD); |
365 | else | 365 | else |
366 | status_set_ffmode(STATUS_FASTBACKWARD); | 366 | status_set_ffmode(STATUS_FASTBACKWARD); |
@@ -489,8 +489,8 @@ static void change_dir(int direction) | |||
489 | audio_prev_dir(); | 489 | audio_prev_dir(); |
490 | else if (direction > 0) | 490 | else if (direction > 0) |
491 | audio_next_dir(); | 491 | audio_next_dir(); |
492 | /* prevent the next dir to immediatly start being ffw'd */ | 492 | /* prevent the next dir to immediatly start being ffw'd */ |
493 | action_wait_for_release(); | 493 | action_wait_for_release(); |
494 | } | 494 | } |
495 | 495 | ||
496 | static void prev_track(unsigned long skip_thresh) | 496 | static void prev_track(unsigned long skip_thresh) |
@@ -644,7 +644,7 @@ static void gwps_leave_wps(void) | |||
644 | skin_backdrop_show(sb_get_backdrop(i)); | 644 | skin_backdrop_show(sb_get_backdrop(i)); |
645 | #endif | 645 | #endif |
646 | viewportmanager_theme_undo(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data)); | 646 | viewportmanager_theme_undo(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data)); |
647 | 647 | ||
648 | } | 648 | } |
649 | 649 | ||
650 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 650 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
@@ -676,7 +676,7 @@ static void gwps_enter_wps(void) | |||
676 | #if LCD_DEPTH > 1 | 676 | #if LCD_DEPTH > 1 |
677 | if (display->depth > 1) | 677 | if (display->depth > 1) |
678 | { | 678 | { |
679 | struct skin_viewport *svp = skin_find_item(VP_DEFAULT_LABEL_STRING, | 679 | struct skin_viewport *svp = skin_find_item(VP_DEFAULT_LABEL_STRING, |
680 | SKIN_FIND_VP, gwps->data); | 680 | SKIN_FIND_VP, gwps->data); |
681 | if (svp) | 681 | if (svp) |
682 | { | 682 | { |
@@ -722,7 +722,7 @@ void wps_do_playpause(bool updatewps) | |||
722 | #endif | 722 | #endif |
723 | } | 723 | } |
724 | } | 724 | } |
725 | 725 | ||
726 | 726 | ||
727 | /* The WPS can be left in two ways: | 727 | /* The WPS can be left in two ways: |
728 | * a) call a function, which draws over the wps. In this case, the wps | 728 | * a) call a function, which draws over the wps. In this case, the wps |
@@ -755,7 +755,7 @@ long gui_wps_show(void) | |||
755 | ab_reset_markers(); | 755 | ab_reset_markers(); |
756 | #endif | 756 | #endif |
757 | wps_state_init(); | 757 | wps_state_init(); |
758 | 758 | ||
759 | while ( 1 ) | 759 | while ( 1 ) |
760 | { | 760 | { |
761 | bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; | 761 | bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; |
@@ -773,7 +773,7 @@ long gui_wps_show(void) | |||
773 | #endif | 773 | #endif |
774 | } | 774 | } |
775 | } | 775 | } |
776 | button = skin_wait_for_action(WPS, CONTEXT_WPS|ALLOW_SOFTLOCK, | 776 | button = skin_wait_for_action(WPS, CONTEXT_WPS|ALLOW_SOFTLOCK, |
777 | restore ? 1 : HZ/5); | 777 | restore ? 1 : HZ/5); |
778 | 778 | ||
779 | /* Exit if audio has stopped playing. This happens e.g. at end of | 779 | /* Exit if audio has stopped playing. This happens e.g. at end of |
@@ -820,17 +820,17 @@ long gui_wps_show(void) | |||
820 | { | 820 | { |
821 | bool hotkey = button == ACTION_WPS_HOTKEY; | 821 | bool hotkey = button == ACTION_WPS_HOTKEY; |
822 | gwps_leave_wps(); | 822 | gwps_leave_wps(); |
823 | int retval = onplay(state->id3->path, | 823 | int retval = onplay(state->id3->path, |
824 | FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); | 824 | FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); |
825 | /* if music is stopped in the context menu we want to exit the wps */ | 825 | /* if music is stopped in the context menu we want to exit the wps */ |
826 | if (retval == ONPLAY_MAINMENU | 826 | if (retval == ONPLAY_MAINMENU |
827 | || !audio_status()) | 827 | || !audio_status()) |
828 | return GO_TO_ROOT; | 828 | return GO_TO_ROOT; |
829 | else if (retval == ONPLAY_PLAYLIST) | 829 | else if (retval == ONPLAY_PLAYLIST) |
830 | return GO_TO_PLAYLIST_VIEWER; | 830 | return GO_TO_PLAYLIST_VIEWER; |
831 | #ifdef HAVE_PICTUREFLOW_INTEGRATION | 831 | #ifdef HAVE_PICTUREFLOW_INTEGRATION |
832 | else if (retval == ONPLAY_PICTUREFLOW) | 832 | else if (retval == ONPLAY_PICTUREFLOW) |
833 | return GO_TO_PICTUREFLOW; | 833 | return GO_TO_PICTUREFLOW; |
834 | #endif | 834 | #endif |
835 | restore = true; | 835 | restore = true; |
836 | } | 836 | } |
@@ -860,7 +860,7 @@ long gui_wps_show(void) | |||
860 | global_settings.volume--; | 860 | global_settings.volume--; |
861 | vol_changed = true; | 861 | vol_changed = true; |
862 | break; | 862 | break; |
863 | /* fast forward | 863 | /* fast forward |
864 | OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ | 864 | OR next dir if this is straight after ACTION_WPS_SKIPNEXT */ |
865 | case ACTION_WPS_SEEKFWD: | 865 | case ACTION_WPS_SEEKFWD: |
866 | if (global_settings.party_mode) | 866 | if (global_settings.party_mode) |
@@ -880,7 +880,7 @@ long gui_wps_show(void) | |||
880 | ffwd_rew(ACTION_WPS_SEEKFWD); | 880 | ffwd_rew(ACTION_WPS_SEEKFWD); |
881 | last_right = last_left = 0; | 881 | last_right = last_left = 0; |
882 | break; | 882 | break; |
883 | /* fast rewind | 883 | /* fast rewind |
884 | OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/ | 884 | OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/ |
885 | case ACTION_WPS_SEEKBACK: | 885 | case ACTION_WPS_SEEKBACK: |
886 | if (global_settings.party_mode) | 886 | if (global_settings.party_mode) |
diff --git a/apps/main.c b/apps/main.c index 57257aff66..7f44d89a6a 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -183,7 +183,7 @@ int main(void) | |||
183 | #ifdef AUTOROCK | 183 | #ifdef AUTOROCK |
184 | { | 184 | { |
185 | char filename[MAX_PATH]; | 185 | char filename[MAX_PATH]; |
186 | const char *file = | 186 | const char *file = |
187 | #ifdef APPLICATION | 187 | #ifdef APPLICATION |
188 | ROCKBOX_DIR | 188 | ROCKBOX_DIR |
189 | #else | 189 | #else |
@@ -210,15 +210,15 @@ static int init_dircache(bool preinit) | |||
210 | #ifdef HAVE_DIRCACHE | 210 | #ifdef HAVE_DIRCACHE |
211 | int result = 0; | 211 | int result = 0; |
212 | bool clear = false; | 212 | bool clear = false; |
213 | 213 | ||
214 | if (preinit) | 214 | if (preinit) |
215 | dircache_init(); | 215 | dircache_init(); |
216 | 216 | ||
217 | if (!global_settings.dircache) | 217 | if (!global_settings.dircache) |
218 | return 0; | 218 | return 0; |
219 | 219 | ||
220 | # ifdef HAVE_EEPROM_SETTINGS | 220 | # ifdef HAVE_EEPROM_SETTINGS |
221 | if (firmware_settings.initialized && firmware_settings.disk_clean | 221 | if (firmware_settings.initialized && firmware_settings.disk_clean |
222 | && preinit) | 222 | && preinit) |
223 | { | 223 | { |
224 | result = dircache_load(); | 224 | result = dircache_load(); |
@@ -233,7 +233,7 @@ static int init_dircache(bool preinit) | |||
233 | splash(0, str(LANG_SCANNING_DISK)); | 233 | splash(0, str(LANG_SCANNING_DISK)); |
234 | clear = true; | 234 | clear = true; |
235 | } | 235 | } |
236 | 236 | ||
237 | dircache_build(global_status.dircache_size); | 237 | dircache_build(global_status.dircache_size); |
238 | } | 238 | } |
239 | } | 239 | } |
@@ -242,7 +242,7 @@ static int init_dircache(bool preinit) | |||
242 | { | 242 | { |
243 | if (preinit) | 243 | if (preinit) |
244 | return -1; | 244 | return -1; |
245 | 245 | ||
246 | if (!dircache_is_enabled() | 246 | if (!dircache_is_enabled() |
247 | && !dircache_is_initializing()) | 247 | && !dircache_is_initializing()) |
248 | { | 248 | { |
@@ -253,7 +253,7 @@ static int init_dircache(bool preinit) | |||
253 | } | 253 | } |
254 | result = dircache_build(global_status.dircache_size); | 254 | result = dircache_build(global_status.dircache_size); |
255 | } | 255 | } |
256 | 256 | ||
257 | if (result < 0) | 257 | if (result < 0) |
258 | { | 258 | { |
259 | /* Initialization of dircache failed. Manual action is | 259 | /* Initialization of dircache failed. Manual action is |
@@ -263,7 +263,7 @@ static int init_dircache(bool preinit) | |||
263 | global_settings.dircache = false; | 263 | global_settings.dircache = false; |
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | if (clear) | 267 | if (clear) |
268 | { | 268 | { |
269 | backlight_on(); | 269 | backlight_on(); |
@@ -271,7 +271,7 @@ static int init_dircache(bool preinit) | |||
271 | global_status.dircache_size = dircache_get_cache_size(); | 271 | global_status.dircache_size = dircache_get_cache_size(); |
272 | status_save(); | 272 | status_save(); |
273 | } | 273 | } |
274 | 274 | ||
275 | return result; | 275 | return result; |
276 | #else | 276 | #else |
277 | (void)preinit; | 277 | (void)preinit; |
@@ -288,7 +288,7 @@ static void init_tagcache(void) | |||
288 | long talked_tick = 0; | 288 | long talked_tick = 0; |
289 | #endif | 289 | #endif |
290 | tagcache_init(); | 290 | tagcache_init(); |
291 | 291 | ||
292 | while (!tagcache_is_initialized()) | 292 | while (!tagcache_is_initialized()) |
293 | { | 293 | { |
294 | int ret = tagcache_get_commit_step(); | 294 | int ret = tagcache_get_commit_step(); |
@@ -322,7 +322,7 @@ static void init_tagcache(void) | |||
322 | } | 322 | } |
323 | #else | 323 | #else |
324 | lcd_double_height(false); | 324 | lcd_double_height(false); |
325 | lcd_putsf(0, 1, " DB [%d/%d]", ret, | 325 | lcd_putsf(0, 1, " DB [%d/%d]", ret, |
326 | tagcache_get_max_commit_step()); | 326 | tagcache_get_max_commit_step()); |
327 | lcd_update(); | 327 | lcd_update(); |
328 | #endif | 328 | #endif |
@@ -370,7 +370,7 @@ static void init(void) | |||
370 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) | 370 | #if (CONFIG_PLATFORM & PLATFORM_ANDROID) |
371 | notification_init(); | 371 | notification_init(); |
372 | #endif | 372 | #endif |
373 | lang_init(core_language_builtin, language_strings, | 373 | lang_init(core_language_builtin, language_strings, |
374 | LANG_LAST_INDEX_IN_ARRAY); | 374 | LANG_LAST_INDEX_IN_ARRAY); |
375 | #ifdef DEBUG | 375 | #ifdef DEBUG |
376 | debug_init(); | 376 | debug_init(); |
@@ -452,7 +452,7 @@ static void init(void) | |||
452 | #endif | 452 | #endif |
453 | 453 | ||
454 | i2c_init(); | 454 | i2c_init(); |
455 | 455 | ||
456 | power_init(); | 456 | power_init(); |
457 | 457 | ||
458 | enable_irq(); | 458 | enable_irq(); |
@@ -471,13 +471,13 @@ static void init(void) | |||
471 | global_status.font_id[i] = FONT_SYSFIXED; | 471 | global_status.font_id[i] = FONT_SYSFIXED; |
472 | font_init(); | 472 | font_init(); |
473 | #endif | 473 | #endif |
474 | 474 | ||
475 | settings_reset(); | 475 | settings_reset(); |
476 | 476 | ||
477 | CHART(">show_logo"); | 477 | CHART(">show_logo"); |
478 | show_logo(); | 478 | show_logo(); |
479 | CHART("<show_logo"); | 479 | CHART("<show_logo"); |
480 | lang_init(core_language_builtin, language_strings, | 480 | lang_init(core_language_builtin, language_strings, |
481 | LANG_LAST_INDEX_IN_ARRAY); | 481 | LANG_LAST_INDEX_IN_ARRAY); |
482 | 482 | ||
483 | #ifdef DEBUG | 483 | #ifdef DEBUG |
@@ -676,7 +676,7 @@ static void init(void) | |||
676 | } | 676 | } |
677 | 677 | ||
678 | CHART(">settings_apply(true)"); | 678 | CHART(">settings_apply(true)"); |
679 | settings_apply(true); | 679 | settings_apply(true); |
680 | CHART("<settings_apply(true)"); | 680 | CHART("<settings_apply(true)"); |
681 | CHART(">init_dircache(false)"); | 681 | CHART(">init_dircache(false)"); |
682 | init_dircache(false); | 682 | init_dircache(false); |
diff --git a/apps/menus/playback_menu.c b/apps/menus/playback_menu.c index 89472d45b9..dbfb44f15d 100644 --- a/apps/menus/playback_menu.c +++ b/apps/menus/playback_menu.c | |||
@@ -62,7 +62,7 @@ static int setcrossfadeonexit_callback(int action,const struct menu_item_ex *thi | |||
62 | /***********************************/ | 62 | /***********************************/ |
63 | /* PLAYBACK MENU */ | 63 | /* PLAYBACK MENU */ |
64 | static int playback_callback(int action,const struct menu_item_ex *this_item); | 64 | static int playback_callback(int action,const struct menu_item_ex *this_item); |
65 | 65 | ||
66 | MENUITEM_SETTING(shuffle_item, &global_settings.playlist_shuffle, playback_callback); | 66 | MENUITEM_SETTING(shuffle_item, &global_settings.playlist_shuffle, playback_callback); |
67 | MENUITEM_SETTING(repeat_mode, &global_settings.repeat_mode, playback_callback); | 67 | MENUITEM_SETTING(repeat_mode, &global_settings.repeat_mode, playback_callback); |
68 | MENUITEM_SETTING(play_selected, &global_settings.play_selected, NULL); | 68 | MENUITEM_SETTING(play_selected, &global_settings.play_selected, NULL); |
@@ -84,7 +84,7 @@ static int buffermargin_callback(int action,const struct menu_item_ex *this_item | |||
84 | } | 84 | } |
85 | return action; | 85 | return action; |
86 | } | 86 | } |
87 | #else | 87 | #else |
88 | # define buffermargin_callback NULL | 88 | # define buffermargin_callback NULL |
89 | #endif | 89 | #endif |
90 | MENUITEM_SETTING(buffer_margin, &global_settings.buffer_margin, | 90 | MENUITEM_SETTING(buffer_margin, &global_settings.buffer_margin, |
@@ -120,7 +120,7 @@ static int replaygain_callback(int action,const struct menu_item_ex *this_item) | |||
120 | (void)this_item; | 120 | (void)this_item; |
121 | switch (action) | 121 | switch (action) |
122 | { | 122 | { |
123 | case ACTION_EXIT_MENUITEM: /* on exit */ | 123 | case ACTION_EXIT_MENUITEM: /* on exit */ |
124 | replaygain_update(); | 124 | replaygain_update(); |
125 | break; | 125 | break; |
126 | } | 126 | } |
@@ -137,7 +137,7 @@ MENUITEM_SETTING(replaygain_preamp, | |||
137 | replaygain_callback); | 137 | replaygain_callback); |
138 | MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0, Icon_NOICON, | 138 | MAKE_MENU(replaygain_settings_menu,ID2P(LANG_REPLAYGAIN),0, Icon_NOICON, |
139 | &replaygain_type, &replaygain_noclip, &replaygain_preamp); | 139 | &replaygain_type, &replaygain_noclip, &replaygain_preamp); |
140 | 140 | ||
141 | MENUITEM_SETTING(beep, &global_settings.beep ,NULL); | 141 | MENUITEM_SETTING(beep, &global_settings.beep ,NULL); |
142 | #endif /* CONFIG_CODEC == SWCODEC */ | 142 | #endif /* CONFIG_CODEC == SWCODEC */ |
143 | 143 | ||
@@ -155,7 +155,7 @@ static int audioscrobbler_callback(int action,const struct menu_item_ex *this_it | |||
155 | case ACTION_EXIT_MENUITEM: /* on exit */ | 155 | case ACTION_EXIT_MENUITEM: /* on exit */ |
156 | if (!scrobbler_is_enabled() && global_settings.audioscrobbler) | 156 | if (!scrobbler_is_enabled() && global_settings.audioscrobbler) |
157 | scrobbler_init(); | 157 | scrobbler_init(); |
158 | 158 | ||
159 | if(scrobbler_is_enabled() && !global_settings.audioscrobbler) | 159 | if(scrobbler_is_enabled() && !global_settings.audioscrobbler) |
160 | scrobbler_shutdown(); | 160 | scrobbler_shutdown(); |
161 | break; | 161 | break; |
@@ -205,13 +205,13 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, | |||
205 | Icon_Playback_menu, | 205 | Icon_Playback_menu, |
206 | &shuffle_item, &repeat_mode, &play_selected, | 206 | &shuffle_item, &repeat_mode, &play_selected, |
207 | &ff_rewind_settings_menu, | 207 | &ff_rewind_settings_menu, |
208 | #ifdef HAVE_DISK_STORAGE | 208 | #ifdef HAVE_DISK_STORAGE |
209 | &buffer_margin, | 209 | &buffer_margin, |
210 | #endif | 210 | #endif |
211 | &fade_on_stop, &party_mode, | 211 | &fade_on_stop, &party_mode, |
212 | 212 | ||
213 | #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE) | 213 | #if (CONFIG_CODEC == SWCODEC) && defined(HAVE_CROSSFADE) |
214 | &crossfade_settings_menu, | 214 | &crossfade_settings_menu, |
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | #if CONFIG_CODEC == SWCODEC | 217 | #if CONFIG_CODEC == SWCODEC |
@@ -235,7 +235,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0, | |||
235 | ,&play_frequency | 235 | ,&play_frequency |
236 | #endif | 236 | #endif |
237 | ); | 237 | ); |
238 | 238 | ||
239 | static int playback_callback(int action,const struct menu_item_ex *this_item) | 239 | static int playback_callback(int action,const struct menu_item_ex *this_item) |
240 | { | 240 | { |
241 | static bool old_shuffle = false; | 241 | static bool old_shuffle = false; |
diff --git a/apps/misc.c b/apps/misc.c index d7d4bdd2f9..91244f2c39 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * __________ __ ___. | 2 | * __________ __ ___. |
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 by Daniel Stenberg | 10 | * Copyright (C) 2002 by Daniel Stenberg |
@@ -424,7 +424,7 @@ bool list_stop_handler(void) | |||
424 | 424 | ||
425 | if (TIME_BEFORE(current_tick, last_off + HZ/2)) | 425 | if (TIME_BEFORE(current_tick, last_off + HZ/2)) |
426 | { | 426 | { |
427 | if (charger_inserted()) | 427 | if (charger_inserted()) |
428 | { | 428 | { |
429 | charging_splash(); | 429 | charging_splash(); |
430 | ret = true; /* screen is dirty, caller needs to refresh */ | 430 | ret = true; /* screen is dirty, caller needs to refresh */ |
@@ -1064,7 +1064,7 @@ void format_time(char* buf, int buf_size, long t) | |||
1064 | int const seconds = time % 60; | 1064 | int const seconds = time % 60; |
1065 | const char * const sign = &"-"[t < 0 ? 0 : 1]; | 1065 | const char * const sign = &"-"[t < 0 ? 0 : 1]; |
1066 | 1066 | ||
1067 | if ( hours == 0 ) | 1067 | if ( hours == 0 ) |
1068 | { | 1068 | { |
1069 | snprintf(buf, buf_size, "%s%d:%02d", sign, minutes, seconds); | 1069 | snprintf(buf, buf_size, "%s%d:%02d", sign, minutes, seconds); |
1070 | } | 1070 | } |
@@ -1177,7 +1177,7 @@ bool parse_color(enum screen_type screen, char *text, int *value) | |||
1177 | { | 1177 | { |
1178 | (void)text; (void)value; /* silence warnings on mono bitmap */ | 1178 | (void)text; (void)value; /* silence warnings on mono bitmap */ |
1179 | (void)screen; | 1179 | (void)screen; |
1180 | 1180 | ||
1181 | #ifdef HAVE_LCD_COLOR | 1181 | #ifdef HAVE_LCD_COLOR |
1182 | if (screens[screen].depth > 2) | 1182 | if (screens[screen].depth > 2) |
1183 | { | 1183 | { |
@@ -1214,7 +1214,7 @@ int clamp_value_wrap(int value, int max, int min) | |||
1214 | #endif | 1214 | #endif |
1215 | #endif | 1215 | #endif |
1216 | #define MAX_ACTIVITY_DEPTH 12 | 1216 | #define MAX_ACTIVITY_DEPTH 12 |
1217 | static enum current_activity | 1217 | static enum current_activity |
1218 | current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN}; | 1218 | current_activity[MAX_ACTIVITY_DEPTH] = {ACTIVITY_UNKNOWN}; |
1219 | static int current_activity_top = 0; | 1219 | static int current_activity_top = 0; |
1220 | void push_current_activity(enum current_activity screen) | 1220 | void push_current_activity(enum current_activity screen) |
diff --git a/apps/mpeg.c b/apps/mpeg.c index 0ecf68fc53..5c206c79f1 100644 --- a/apps/mpeg.c +++ b/apps/mpeg.c | |||
@@ -382,7 +382,7 @@ static void set_elapsed(struct mp3entry* id3) | |||
382 | break; | 382 | break; |
383 | } | 383 | } |
384 | } | 384 | } |
385 | 385 | ||
386 | i--; | 386 | i--; |
387 | if (i < 0) | 387 | if (i < 0) |
388 | i = 0; | 388 | i = 0; |
@@ -395,7 +395,7 @@ static void set_elapsed(struct mp3entry* id3) | |||
395 | } | 395 | } |
396 | else | 396 | else |
397 | { | 397 | { |
398 | nextpos = 256; | 398 | nextpos = 256; |
399 | } | 399 | } |
400 | 400 | ||
401 | remainder = id3->offset - (relpos * (id3->filesize / 256)); | 401 | remainder = id3->offset - (relpos * (id3->filesize / 256)); |
@@ -425,7 +425,7 @@ int audio_get_file_pos(void) | |||
425 | { | 425 | { |
426 | int pos = -1; | 426 | int pos = -1; |
427 | struct mp3entry *id3 = audio_current_track(); | 427 | struct mp3entry *id3 = audio_current_track(); |
428 | 428 | ||
429 | if (id3->vbr) | 429 | if (id3->vbr) |
430 | { | 430 | { |
431 | if (id3->has_toc) | 431 | if (id3->has_toc) |
@@ -433,20 +433,20 @@ int audio_get_file_pos(void) | |||
433 | /* Use the TOC to find the new position */ | 433 | /* Use the TOC to find the new position */ |
434 | unsigned int percent, remainder; | 434 | unsigned int percent, remainder; |
435 | int curtoc, nexttoc, plen; | 435 | int curtoc, nexttoc, plen; |
436 | 436 | ||
437 | percent = (id3->elapsed*100)/id3->length; | 437 | percent = (id3->elapsed*100)/id3->length; |
438 | if (percent > 99) | 438 | if (percent > 99) |
439 | percent = 99; | 439 | percent = 99; |
440 | 440 | ||
441 | curtoc = id3->toc[percent]; | 441 | curtoc = id3->toc[percent]; |
442 | 442 | ||
443 | if (percent < 99) | 443 | if (percent < 99) |
444 | nexttoc = id3->toc[percent+1]; | 444 | nexttoc = id3->toc[percent+1]; |
445 | else | 445 | else |
446 | nexttoc = 256; | 446 | nexttoc = 256; |
447 | 447 | ||
448 | pos = (id3->filesize/256)*curtoc; | 448 | pos = (id3->filesize/256)*curtoc; |
449 | 449 | ||
450 | /* Use the remainder to get a more accurate position */ | 450 | /* Use the remainder to get a more accurate position */ |
451 | remainder = (id3->elapsed*100)%id3->length; | 451 | remainder = (id3->elapsed*100)%id3->length; |
452 | remainder = (remainder*100)/id3->length; | 452 | remainder = (remainder*100)/id3->length; |
@@ -478,7 +478,7 @@ int audio_get_file_pos(void) | |||
478 | /* skip past id3v2 tag and other leading garbage */ | 478 | /* skip past id3v2 tag and other leading garbage */ |
479 | pos = id3->first_frame_offset; | 479 | pos = id3->first_frame_offset; |
480 | } | 480 | } |
481 | return pos; | 481 | return pos; |
482 | } | 482 | } |
483 | 483 | ||
484 | unsigned long mpeg_get_last_header(void) | 484 | unsigned long mpeg_get_last_header(void) |
@@ -637,9 +637,9 @@ static void recalculate_watermark(int bitrate) | |||
637 | and set a high threshold */ | 637 | and set a high threshold */ |
638 | if(bitrate == 0) | 638 | if(bitrate == 0) |
639 | bitrate = 320; | 639 | bitrate = 320; |
640 | 640 | ||
641 | bytes_per_sec = bitrate * 1000 / 8; | 641 | bytes_per_sec = bitrate * 1000 / 8; |
642 | 642 | ||
643 | if(time) | 643 | if(time) |
644 | { | 644 | { |
645 | /* No drive spins up faster than 3.5s */ | 645 | /* No drive spins up faster than 3.5s */ |
@@ -693,7 +693,7 @@ void audio_get_debugdata(struct audio_debug *dbgdata) | |||
693 | static void dbg_timer_start(void) | 693 | static void dbg_timer_start(void) |
694 | { | 694 | { |
695 | /* We are using timer 2 */ | 695 | /* We are using timer 2 */ |
696 | 696 | ||
697 | TSTR &= ~0x04; /* Stop the timer */ | 697 | TSTR &= ~0x04; /* Stop the timer */ |
698 | TSNC &= ~0x04; /* No synchronization */ | 698 | TSNC &= ~0x04; /* No synchronization */ |
699 | TMDR &= ~0x44; /* Operate normally */ | 699 | TMDR &= ~0x44; /* Operate normally */ |
@@ -813,7 +813,7 @@ void rec_tick(void) | |||
813 | } | 813 | } |
814 | 814 | ||
815 | data = *(unsigned char *)0x04000000; /* read data byte */ | 815 | data = *(unsigned char *)0x04000000; /* read data byte */ |
816 | 816 | ||
817 | xor_b(0x08, &PADRH); /* Set PR inactive */ | 817 | xor_b(0x08, &PADRH); /* Set PR inactive */ |
818 | 818 | ||
819 | mpeg_audiobuf[audiobuf_write++] = data; | 819 | mpeg_audiobuf[audiobuf_write++] = data; |
@@ -888,7 +888,7 @@ static void transfer_end(const void** ppbuf, size_t* psize) | |||
888 | audiobuf_read += last_dma_chunk_size; | 888 | audiobuf_read += last_dma_chunk_size; |
889 | if(audiobuf_read >= audiobuflen) | 889 | if(audiobuf_read >= audiobuflen) |
890 | audiobuf_read = 0; | 890 | audiobuf_read = 0; |
891 | 891 | ||
892 | /* First, check if we are on a track boundary */ | 892 | /* First, check if we are on a track boundary */ |
893 | if (num_tracks_in_memory() > 1) | 893 | if (num_tracks_in_memory() > 1) |
894 | { | 894 | { |
@@ -901,17 +901,17 @@ static void transfer_end(const void** ppbuf, size_t* psize) | |||
901 | } | 901 | } |
902 | } | 902 | } |
903 | } | 903 | } |
904 | 904 | ||
905 | unplayed_space_left = get_unplayed_space(); | 905 | unplayed_space_left = get_unplayed_space(); |
906 | 906 | ||
907 | space_until_end_of_buffer = audiobuflen - audiobuf_read; | 907 | space_until_end_of_buffer = audiobuflen - audiobuf_read; |
908 | 908 | ||
909 | if(!filling && unplayed_space_left < low_watermark) | 909 | if(!filling && unplayed_space_left < low_watermark) |
910 | { | 910 | { |
911 | filling = true; | 911 | filling = true; |
912 | queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS); | 912 | queue_post(&mpeg_queue, MPEG_NEED_DATA, GENERATE_UNBUFFER_EVENTS); |
913 | } | 913 | } |
914 | 914 | ||
915 | if(unplayed_space_left) | 915 | if(unplayed_space_left) |
916 | { | 916 | { |
917 | last_dma_chunk_size = MIN(0x2000, unplayed_space_left); | 917 | last_dma_chunk_size = MIN(0x2000, unplayed_space_left); |
@@ -953,7 +953,7 @@ static void transfer_end(const void** ppbuf, size_t* psize) | |||
953 | /* Update the watermark debug level */ | 953 | /* Update the watermark debug level */ |
954 | if(unplayed_space_left < lowest_watermark_level) | 954 | if(unplayed_space_left < lowest_watermark_level) |
955 | lowest_watermark_level = unplayed_space_left; | 955 | lowest_watermark_level = unplayed_space_left; |
956 | 956 | ||
957 | DEBUGF("DMA underrun.\n"); | 957 | DEBUGF("DMA underrun.\n"); |
958 | dma_underrun = true; | 958 | dma_underrun = true; |
959 | } | 959 | } |
@@ -975,7 +975,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename) | |||
975 | { | 975 | { |
976 | struct trackdata *track; | 976 | struct trackdata *track; |
977 | bool send_nid3_event; | 977 | bool send_nid3_event; |
978 | 978 | ||
979 | if(num_tracks_in_memory() >= MAX_TRACK_ENTRIES) | 979 | if(num_tracks_in_memory() >= MAX_TRACK_ENTRIES) |
980 | { | 980 | { |
981 | DEBUGF("Tag memory is full\n"); | 981 | DEBUGF("Tag memory is full\n"); |
@@ -983,7 +983,7 @@ static struct trackdata *add_track_to_tag_list(const char *filename) | |||
983 | } | 983 | } |
984 | 984 | ||
985 | track = &trackdata[track_write_idx]; | 985 | track = &trackdata[track_write_idx]; |
986 | 986 | ||
987 | /* grab id3 tag of new file and | 987 | /* grab id3 tag of new file and |
988 | remember where in memory it starts */ | 988 | remember where in memory it starts */ |
989 | if(mp3info(&track->id3, filename)) | 989 | if(mp3info(&track->id3, filename)) |
@@ -1032,14 +1032,14 @@ static int new_file(int steps) | |||
1032 | start += track->load_ahead_index; | 1032 | start += track->load_ahead_index; |
1033 | } | 1033 | } |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | do { | 1036 | do { |
1037 | trackname = playlist_peek(start + steps, name_buf, sizeof(name_buf)); | 1037 | trackname = playlist_peek(start + steps, name_buf, sizeof(name_buf)); |
1038 | if ( !trackname ) | 1038 | if ( !trackname ) |
1039 | return -1; | 1039 | return -1; |
1040 | 1040 | ||
1041 | DEBUGF("Loading %s\n", trackname); | 1041 | DEBUGF("Loading %s\n", trackname); |
1042 | 1042 | ||
1043 | mpeg_file = open(trackname, O_RDONLY); | 1043 | mpeg_file = open(trackname, O_RDONLY); |
1044 | if(mpeg_file < 0) { | 1044 | if(mpeg_file < 0) { |
1045 | DEBUGF("Couldn't open file: %s\n",trackname); | 1045 | DEBUGF("Couldn't open file: %s\n",trackname); |
@@ -1065,7 +1065,7 @@ static int new_file(int steps) | |||
1065 | else | 1065 | else |
1066 | { | 1066 | { |
1067 | /* skip past id3v2 tag */ | 1067 | /* skip past id3v2 tag */ |
1068 | lseek(mpeg_file, | 1068 | lseek(mpeg_file, |
1069 | track->id3.first_frame_offset, | 1069 | track->id3.first_frame_offset, |
1070 | SEEK_SET); | 1070 | SEEK_SET); |
1071 | track->id3.index = steps; | 1071 | track->id3.index = steps; |
@@ -1079,7 +1079,7 @@ static int new_file(int steps) | |||
1079 | else | 1079 | else |
1080 | recalculate_watermark( | 1080 | recalculate_watermark( |
1081 | track->id3.bitrate); | 1081 | track->id3.bitrate); |
1082 | 1082 | ||
1083 | } | 1083 | } |
1084 | } | 1084 | } |
1085 | 1085 | ||
@@ -1212,7 +1212,7 @@ static void start_playback_if_ready(void) | |||
1212 | playable_space = audiobuf_swapwrite - audiobuf_read; | 1212 | playable_space = audiobuf_swapwrite - audiobuf_read; |
1213 | if(playable_space < 0) | 1213 | if(playable_space < 0) |
1214 | playable_space += audiobuflen; | 1214 | playable_space += audiobuflen; |
1215 | 1215 | ||
1216 | /* See if we have started playing yet. If not, do it. */ | 1216 | /* See if we have started playing yet. If not, do it. */ |
1217 | if(play_pending || dma_underrun) | 1217 | if(play_pending || dma_underrun) |
1218 | { | 1218 | { |
@@ -1273,7 +1273,7 @@ static bool swap_one_chunk(void) | |||
1273 | else | 1273 | else |
1274 | amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left); | 1274 | amount_to_swap = MIN(MPEG_SWAP_CHUNKSIZE, free_space_left); |
1275 | } | 1275 | } |
1276 | 1276 | ||
1277 | if(audiobuf_write < audiobuf_swapwrite) | 1277 | if(audiobuf_write < audiobuf_swapwrite) |
1278 | amount_to_swap = MIN(audiobuflen - audiobuf_swapwrite, | 1278 | amount_to_swap = MIN(audiobuflen - audiobuf_swapwrite, |
1279 | amount_to_swap); | 1279 | amount_to_swap); |
@@ -1342,7 +1342,7 @@ static void mpeg_thread(void) | |||
1342 | } | 1342 | } |
1343 | 1343 | ||
1344 | start_playback_if_ready(); | 1344 | start_playback_if_ready(); |
1345 | 1345 | ||
1346 | switch(ev.id) | 1346 | switch(ev.id) |
1347 | { | 1347 | { |
1348 | case MPEG_PLAY: | 1348 | case MPEG_PLAY: |
@@ -1376,8 +1376,8 @@ static void mpeg_thread(void) | |||
1376 | } | 1376 | } |
1377 | else { | 1377 | else { |
1378 | /* skip past id3v2 tag */ | 1378 | /* skip past id3v2 tag */ |
1379 | lseek(mpeg_file, | 1379 | lseek(mpeg_file, |
1380 | get_trackdata(0)->id3.first_frame_offset, | 1380 | get_trackdata(0)->id3.first_frame_offset, |
1381 | SEEK_SET); | 1381 | SEEK_SET); |
1382 | 1382 | ||
1383 | } | 1383 | } |
@@ -1421,7 +1421,7 @@ static void mpeg_thread(void) | |||
1421 | if ( current_track_counter == pause_track ) | 1421 | if ( current_track_counter == pause_track ) |
1422 | last_dma_tick += current_tick - pause_tick; | 1422 | last_dma_tick += current_tick - pause_tick; |
1423 | else | 1423 | else |
1424 | last_dma_tick = current_tick; | 1424 | last_dma_tick = current_tick; |
1425 | pause_tick = 0; | 1425 | pause_tick = 0; |
1426 | mp3_play_pause(true); | 1426 | mp3_play_pause(true); |
1427 | } | 1427 | } |
@@ -1481,7 +1481,7 @@ static void mpeg_thread(void) | |||
1481 | /* Make it read more data */ | 1481 | /* Make it read more data */ |
1482 | filling = true; | 1482 | filling = true; |
1483 | queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); | 1483 | queue_post(&mpeg_queue, MPEG_NEED_DATA, 0); |
1484 | 1484 | ||
1485 | /* Tell the file loading code that we want | 1485 | /* Tell the file loading code that we want |
1486 | to start playing as soon as we have some data */ | 1486 | to start playing as soon as we have some data */ |
1487 | play_pending = true; | 1487 | play_pending = true; |
@@ -1498,7 +1498,7 @@ static void mpeg_thread(void) | |||
1498 | 1498 | ||
1499 | if (!playlist_check(-1)) | 1499 | if (!playlist_check(-1)) |
1500 | break; | 1500 | break; |
1501 | 1501 | ||
1502 | /* stop the current stream */ | 1502 | /* stop the current stream */ |
1503 | end_current_track(); | 1503 | end_current_track(); |
1504 | 1504 | ||
@@ -1540,7 +1540,7 @@ static void mpeg_thread(void) | |||
1540 | id3->elapsed = oldtime; | 1540 | id3->elapsed = oldtime; |
1541 | break; | 1541 | break; |
1542 | } | 1542 | } |
1543 | 1543 | ||
1544 | if (mpeg_file >= 0) | 1544 | if (mpeg_file >= 0) |
1545 | curpos = lseek(mpeg_file, 0, SEEK_CUR); | 1545 | curpos = lseek(mpeg_file, 0, SEEK_CUR); |
1546 | else | 1546 | else |
@@ -1581,7 +1581,7 @@ static void mpeg_thread(void) | |||
1581 | hasn't yet advanced up to the new location of the read | 1581 | hasn't yet advanced up to the new location of the read |
1582 | pointer. We just move it, there is no need to swap | 1582 | pointer. We just move it, there is no need to swap |
1583 | data that won't be played anyway. */ | 1583 | data that won't be played anyway. */ |
1584 | 1584 | ||
1585 | if (unswapped_space_left > unplayed_space_left) | 1585 | if (unswapped_space_left > unplayed_space_left) |
1586 | { | 1586 | { |
1587 | DEBUGF("Moved swapwrite\n"); | 1587 | DEBUGF("Moved swapwrite\n"); |
@@ -1599,9 +1599,9 @@ static void mpeg_thread(void) | |||
1599 | else | 1599 | else |
1600 | { | 1600 | { |
1601 | /* resume will start at new position */ | 1601 | /* resume will start at new position */ |
1602 | last_dma_chunk_size = | 1602 | last_dma_chunk_size = |
1603 | MIN(0x2000, get_unplayed_space_current_song()); | 1603 | MIN(0x2000, get_unplayed_space_current_song()); |
1604 | mp3_play_data(mpeg_audiobuf + audiobuf_read, | 1604 | mp3_play_data(mpeg_audiobuf + audiobuf_read, |
1605 | last_dma_chunk_size, transfer_end); | 1605 | last_dma_chunk_size, transfer_end); |
1606 | dma_underrun = false; | 1606 | dma_underrun = false; |
1607 | } | 1607 | } |
@@ -1696,7 +1696,7 @@ static void mpeg_thread(void) | |||
1696 | 1696 | ||
1697 | /* Make sure that we don't fill the entire buffer */ | 1697 | /* Make sure that we don't fill the entire buffer */ |
1698 | free_space_left -= MPEG_HIGH_WATER; | 1698 | free_space_left -= MPEG_HIGH_WATER; |
1699 | 1699 | ||
1700 | if (ev.data == GENERATE_UNBUFFER_EVENTS) | 1700 | if (ev.data == GENERATE_UNBUFFER_EVENTS) |
1701 | generate_unbuffer_events(); | 1701 | generate_unbuffer_events(); |
1702 | 1702 | ||
@@ -1748,12 +1748,12 @@ static void mpeg_thread(void) | |||
1748 | static const unsigned char tag[] = "TAG"; | 1748 | static const unsigned char tag[] = "TAG"; |
1749 | int taglen = 128; | 1749 | int taglen = 128; |
1750 | int tagptr = audiobuf_write + len - 128; | 1750 | int tagptr = audiobuf_write + len - 128; |
1751 | 1751 | ||
1752 | /* Really rare case: entire potential tag wasn't | 1752 | /* Really rare case: entire potential tag wasn't |
1753 | read in this call AND audiobuf_write < 128 */ | 1753 | read in this call AND audiobuf_write < 128 */ |
1754 | if (tagptr < 0) | 1754 | if (tagptr < 0) |
1755 | tagptr += audiobuflen; | 1755 | tagptr += audiobuflen; |
1756 | 1756 | ||
1757 | for(i = 0;i < 3;i++) | 1757 | for(i = 0;i < 3;i++) |
1758 | { | 1758 | { |
1759 | if(tagptr >= audiobuflen) | 1759 | if(tagptr >= audiobuflen) |
@@ -1801,10 +1801,10 @@ static void mpeg_thread(void) | |||
1801 | { | 1801 | { |
1802 | DEBUGF("MPEG read error\n"); | 1802 | DEBUGF("MPEG read error\n"); |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | close(mpeg_file); | 1805 | close(mpeg_file); |
1806 | mpeg_file = -1; | 1806 | mpeg_file = -1; |
1807 | 1807 | ||
1808 | if(new_file(1) < 0) | 1808 | if(new_file(1) < 0) |
1809 | { | 1809 | { |
1810 | /* No more data to play */ | 1810 | /* No more data to play */ |
@@ -1819,7 +1819,7 @@ static void mpeg_thread(void) | |||
1819 | } | 1819 | } |
1820 | } | 1820 | } |
1821 | break; | 1821 | break; |
1822 | 1822 | ||
1823 | case MPEG_TRACK_CHANGE: | 1823 | case MPEG_TRACK_CHANGE: |
1824 | track_change(); | 1824 | track_change(); |
1825 | break; | 1825 | break; |
@@ -1838,7 +1838,7 @@ static void mpeg_thread(void) | |||
1838 | usb_wait_for_disconnect(&mpeg_queue); | 1838 | usb_wait_for_disconnect(&mpeg_queue); |
1839 | break; | 1839 | break; |
1840 | #endif /* !USB_NONE */ | 1840 | #endif /* !USB_NONE */ |
1841 | 1841 | ||
1842 | #if CONFIG_CODEC == MAS3587F | 1842 | #if CONFIG_CODEC == MAS3587F |
1843 | case MPEG_INIT_RECORDING: | 1843 | case MPEG_INIT_RECORDING: |
1844 | init_recording(); | 1844 | init_recording(); |
@@ -1876,7 +1876,7 @@ static void mpeg_thread(void) | |||
1876 | mpeg_audiobuf+startpos, startpos); | 1876 | mpeg_audiobuf+startpos, startpos); |
1877 | 1877 | ||
1878 | saved_header = mpeg_get_last_header(); | 1878 | saved_header = mpeg_get_last_header(); |
1879 | 1879 | ||
1880 | mem_find_next_frame(startpos, &offset, 1800, | 1880 | mem_find_next_frame(startpos, &offset, 1800, |
1881 | saved_header, mpeg_audiobuf, | 1881 | saved_header, mpeg_audiobuf, |
1882 | audiobuflen); | 1882 | audiobuflen); |
@@ -1912,10 +1912,10 @@ static void mpeg_thread(void) | |||
1912 | 1912 | ||
1913 | /* delayed until buffer is saved, don't open yet */ | 1913 | /* delayed until buffer is saved, don't open yet */ |
1914 | strcpy(delayed_filename, recording_filename); | 1914 | strcpy(delayed_filename, recording_filename); |
1915 | mpeg_file = -1; | 1915 | mpeg_file = -1; |
1916 | 1916 | ||
1917 | break; | 1917 | break; |
1918 | 1918 | ||
1919 | case MPEG_STOP: | 1919 | case MPEG_STOP: |
1920 | DEBUGF("MPEG_STOP\n"); | 1920 | DEBUGF("MPEG_STOP\n"); |
1921 | 1921 | ||
@@ -1974,7 +1974,7 @@ static void mpeg_thread(void) | |||
1974 | 1974 | ||
1975 | mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_FRAME_COUNT, | 1975 | mas_readmem(MAS_BANK_D0, MAS_D0_MPEG_FRAME_COUNT, |
1976 | &frame_count_end, 1); | 1976 | &frame_count_end, 1); |
1977 | 1977 | ||
1978 | last_rec_time = current_tick - record_start_time; | 1978 | last_rec_time = current_tick - record_start_time; |
1979 | record_start_time = current_tick; | 1979 | record_start_time = current_tick; |
1980 | if (paused) | 1980 | if (paused) |
@@ -2014,7 +2014,7 @@ static void mpeg_thread(void) | |||
2014 | queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); | 2014 | queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); |
2015 | break; | 2015 | break; |
2016 | 2016 | ||
2017 | case MPEG_SAVE_DATA: | 2017 | case MPEG_SAVE_DATA: |
2018 | if (saving_status == BUFFER_FULL) | 2018 | if (saving_status == BUFFER_FULL) |
2019 | save_endpos = audiobuf_write; | 2019 | save_endpos = audiobuf_write; |
2020 | 2020 | ||
@@ -2098,7 +2098,7 @@ static void mpeg_thread(void) | |||
2098 | queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); | 2098 | queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); |
2099 | 2099 | ||
2100 | break; | 2100 | break; |
2101 | 2101 | ||
2102 | case MPEG_PRERECORDING_TICK: | 2102 | case MPEG_PRERECORDING_TICK: |
2103 | if(!is_prerecording) | 2103 | if(!is_prerecording) |
2104 | break; | 2104 | break; |
@@ -2118,21 +2118,21 @@ static void mpeg_thread(void) | |||
2118 | break; | 2118 | break; |
2119 | 2119 | ||
2120 | case MPEG_INIT_PLAYBACK: | 2120 | case MPEG_INIT_PLAYBACK: |
2121 | /* Stop the prerecording */ | 2121 | /* Stop the prerecording */ |
2122 | stop_recording(); | 2122 | stop_recording(); |
2123 | reset_mp3_buffer(); | 2123 | reset_mp3_buffer(); |
2124 | mp3_play_init(); | 2124 | mp3_play_init(); |
2125 | init_playback_done = true; | 2125 | init_playback_done = true; |
2126 | break; | 2126 | break; |
2127 | 2127 | ||
2128 | case MPEG_PAUSE_RECORDING: | 2128 | case MPEG_PAUSE_RECORDING: |
2129 | pause_recording(); | 2129 | pause_recording(); |
2130 | break; | 2130 | break; |
2131 | 2131 | ||
2132 | case MPEG_RESUME_RECORDING: | 2132 | case MPEG_RESUME_RECORDING: |
2133 | resume_recording(); | 2133 | resume_recording(); |
2134 | break; | 2134 | break; |
2135 | 2135 | ||
2136 | case SYS_USB_CONNECTED: | 2136 | case SYS_USB_CONNECTED: |
2137 | /* We can safely go to USB mode if no recording | 2137 | /* We can safely go to USB mode if no recording |
2138 | is taking place */ | 2138 | is taking place */ |
@@ -2142,11 +2142,11 @@ static void mpeg_thread(void) | |||
2142 | function, to put the MAS in monitoring mode, | 2142 | function, to put the MAS in monitoring mode, |
2143 | to save power. */ | 2143 | to save power. */ |
2144 | stop_recording(); | 2144 | stop_recording(); |
2145 | 2145 | ||
2146 | /* Tell the USB thread that we are safe */ | 2146 | /* Tell the USB thread that we are safe */ |
2147 | DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n"); | 2147 | DEBUGF("mpeg_thread got SYS_USB_CONNECTED\n"); |
2148 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | 2148 | usb_acknowledge(SYS_USB_CONNECTED_ACK); |
2149 | 2149 | ||
2150 | /* Wait until the USB cable is extracted again */ | 2150 | /* Wait until the USB cable is extracted again */ |
2151 | usb_wait_for_disconnect(&mpeg_queue); | 2151 | usb_wait_for_disconnect(&mpeg_queue); |
2152 | } | 2152 | } |
@@ -2166,7 +2166,7 @@ struct mp3entry* audio_current_track(void) | |||
2166 | if(num_tracks_in_memory()) | 2166 | if(num_tracks_in_memory()) |
2167 | { | 2167 | { |
2168 | struct mp3entry *id3 = &get_trackdata(0)->id3; | 2168 | struct mp3entry *id3 = &get_trackdata(0)->id3; |
2169 | #endif | 2169 | #endif |
2170 | if (!checked_for_cuesheet && curr_cuesheet && id3->cuesheet == NULL) | 2170 | if (!checked_for_cuesheet && curr_cuesheet && id3->cuesheet == NULL) |
2171 | { | 2171 | { |
2172 | checked_for_cuesheet = true; /* only check once per track */ | 2172 | checked_for_cuesheet = true; /* only check once per track */ |
@@ -2239,9 +2239,9 @@ static void init_recording(void) | |||
2239 | is_prerecording = false; | 2239 | is_prerecording = false; |
2240 | 2240 | ||
2241 | mpeg_stop_done = true; | 2241 | mpeg_stop_done = true; |
2242 | 2242 | ||
2243 | mas_reset(); | 2243 | mas_reset(); |
2244 | 2244 | ||
2245 | /* Enable the audio CODEC and the DSP core, max analog voltage range */ | 2245 | /* Enable the audio CODEC and the DSP core, max analog voltage range */ |
2246 | rc = mas_direct_config_write(MAS_CONTROL, 0x8c00); | 2246 | rc = mas_direct_config_write(MAS_CONTROL, 0x8c00); |
2247 | if(rc < 0) | 2247 | if(rc < 0) |
@@ -2257,7 +2257,7 @@ static void init_recording(void) | |||
2257 | 2257 | ||
2258 | /* Perform black magic as described by the data sheet */ | 2258 | /* Perform black magic as described by the data sheet */ |
2259 | if((mas_version_code & 0x0fff) == 0x0102) | 2259 | if((mas_version_code & 0x0fff) == 0x0102) |
2260 | { | 2260 | { |
2261 | DEBUGF("Performing MAS black magic for B2 version\n"); | 2261 | DEBUGF("Performing MAS black magic for B2 version\n"); |
2262 | mas_writereg(0xa3, 0x98); | 2262 | mas_writereg(0xa3, 0x98); |
2263 | mas_writereg(0x94, 0xfffff); | 2263 | mas_writereg(0x94, 0xfffff); |
@@ -2272,7 +2272,7 @@ static void init_recording(void) | |||
2272 | 2272 | ||
2273 | /* Copy left channel to right (mono mode) */ | 2273 | /* Copy left channel to right (mono mode) */ |
2274 | mas_codec_writereg(8, 0x8000); | 2274 | mas_codec_writereg(8, 0x8000); |
2275 | 2275 | ||
2276 | /* ADC scale 0%, DSP scale 100% | 2276 | /* ADC scale 0%, DSP scale 100% |
2277 | We use the DSP output for monitoring, because it works with all | 2277 | We use the DSP output for monitoring, because it works with all |
2278 | sources including S/PDIF */ | 2278 | sources including S/PDIF */ |
@@ -2282,7 +2282,7 @@ static void init_recording(void) | |||
2282 | /* No mute */ | 2282 | /* No mute */ |
2283 | shadow_soft_mute = 0; | 2283 | shadow_soft_mute = 0; |
2284 | mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1); | 2284 | mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1); |
2285 | 2285 | ||
2286 | #ifdef HAVE_SPDIF_OUT | 2286 | #ifdef HAVE_SPDIF_OUT |
2287 | val = 0x09; /* Disable SDO and SDI, low impedance S/PDIF outputs */ | 2287 | val = 0x09; /* Disable SDO and SDI, low impedance S/PDIF outputs */ |
2288 | #else | 2288 | #else |
@@ -2308,7 +2308,7 @@ static void init_recording(void) | |||
2308 | DMA transfer has taken place. | 2308 | DMA transfer has taken place. |
2309 | Now let's wait for some data to be encoded. */ | 2309 | Now let's wait for some data to be encoded. */ |
2310 | sleep(HZ/5); | 2310 | sleep(HZ/5); |
2311 | 2311 | ||
2312 | /* Now set it to Monitoring mode as default, saves power */ | 2312 | /* Now set it to Monitoring mode as default, saves power */ |
2313 | shadow_io_control_main = 0x525; | 2313 | shadow_io_control_main = 0x525; |
2314 | mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1); | 2314 | mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1); |
@@ -2331,7 +2331,7 @@ static void init_recording(void) | |||
2331 | void audio_record(const char *filename) | 2331 | void audio_record(const char *filename) |
2332 | { | 2332 | { |
2333 | mpeg_errno = 0; | 2333 | mpeg_errno = 0; |
2334 | 2334 | ||
2335 | strlcpy(recording_filename, filename, MAX_PATH); | 2335 | strlcpy(recording_filename, filename, MAX_PATH); |
2336 | 2336 | ||
2337 | queue_post(&mpeg_queue, MPEG_RECORD, 0); | 2337 | queue_post(&mpeg_queue, MPEG_RECORD, 0); |
@@ -2412,13 +2412,13 @@ static void start_prerecording(void) | |||
2412 | unsigned long val; | 2412 | unsigned long val; |
2413 | 2413 | ||
2414 | DEBUGF("Starting prerecording\n"); | 2414 | DEBUGF("Starting prerecording\n"); |
2415 | 2415 | ||
2416 | prerecord_index = 0; | 2416 | prerecord_index = 0; |
2417 | prerecord_count = 0; | 2417 | prerecord_count = 0; |
2418 | prerecord_timeout = current_tick + HZ; | 2418 | prerecord_timeout = current_tick + HZ; |
2419 | memset(prerecord_buffer, 0, sizeof(prerecord_buffer)); | 2419 | memset(prerecord_buffer, 0, sizeof(prerecord_buffer)); |
2420 | reset_mp3_buffer(); | 2420 | reset_mp3_buffer(); |
2421 | 2421 | ||
2422 | is_prerecording = true; | 2422 | is_prerecording = true; |
2423 | 2423 | ||
2424 | /* Stop monitoring and start the encoder */ | 2424 | /* Stop monitoring and start the encoder */ |
@@ -2431,7 +2431,7 @@ static void start_prerecording(void) | |||
2431 | { | 2431 | { |
2432 | mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1); | 2432 | mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1); |
2433 | } while(val & 1); | 2433 | } while(val & 1); |
2434 | 2434 | ||
2435 | is_recording = true; | 2435 | is_recording = true; |
2436 | saving_status = NOT_SAVING; | 2436 | saving_status = NOT_SAVING; |
2437 | 2437 | ||
@@ -2463,7 +2463,7 @@ static void start_recording(void) | |||
2463 | mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1); | 2463 | mas_readmem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &val,1); |
2464 | } while(val & 1); | 2464 | } while(val & 1); |
2465 | } | 2465 | } |
2466 | 2466 | ||
2467 | is_recording = true; | 2467 | is_recording = true; |
2468 | saving_status = NOT_SAVING; | 2468 | saving_status = NOT_SAVING; |
2469 | paused = false; | 2469 | paused = false; |
@@ -2493,7 +2493,7 @@ static void pause_recording(void) | |||
2493 | static void resume_recording(void) | 2493 | static void resume_recording(void) |
2494 | { | 2494 | { |
2495 | paused = false; | 2495 | paused = false; |
2496 | 2496 | ||
2497 | /* Clear the pause bit */ | 2497 | /* Clear the pause bit */ |
2498 | shadow_soft_mute &= ~2; | 2498 | shadow_soft_mute &= ~2; |
2499 | mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1); | 2499 | mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute, 1); |
@@ -2515,7 +2515,7 @@ static void stop_recording(void) | |||
2515 | if(!paused) | 2515 | if(!paused) |
2516 | pause_recording(); | 2516 | pause_recording(); |
2517 | sleep(HZ/5); | 2517 | sleep(HZ/5); |
2518 | 2518 | ||
2519 | demand_irq_enable(false); | 2519 | demand_irq_enable(false); |
2520 | 2520 | ||
2521 | is_recording = false; | 2521 | is_recording = false; |
@@ -2529,7 +2529,7 @@ static void stop_recording(void) | |||
2529 | shadow_io_control_main |= (1 << 10); | 2529 | shadow_io_control_main |= (1 << 10); |
2530 | mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1); | 2530 | mas_writemem(MAS_BANK_D0, MAS_D0_IO_CONTROL_MAIN, &shadow_io_control_main, 1); |
2531 | DEBUGF("mas_writemem(MAS_BANK_D0, IO_CONTROL_MAIN, %x)\n", shadow_io_control_main); | 2531 | DEBUGF("mas_writemem(MAS_BANK_D0, IO_CONTROL_MAIN, %x)\n", shadow_io_control_main); |
2532 | 2532 | ||
2533 | /* Wait until the DSP has accepted the settings */ | 2533 | /* Wait until the DSP has accepted the settings */ |
2534 | do | 2534 | do |
2535 | { | 2535 | { |
@@ -2565,7 +2565,7 @@ void audio_set_recording_options(struct audio_recording_options *options) | |||
2565 | mas_store_pllfreq(24576000); | 2565 | mas_store_pllfreq(24576000); |
2566 | else | 2566 | else |
2567 | mas_store_pllfreq(22579000); | 2567 | mas_store_pllfreq(22579000); |
2568 | #endif | 2568 | #endif |
2569 | 2569 | ||
2570 | shadow_soft_mute = options->rec_editable?4:0; | 2570 | shadow_soft_mute = options->rec_editable?4:0; |
2571 | mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute,1); | 2571 | mas_writemem(MAS_BANK_D0, MAS_D0_SOFT_MUTE, &shadow_soft_mute,1); |
@@ -2647,7 +2647,7 @@ unsigned long audio_recorded_time(void) | |||
2647 | { | 2647 | { |
2648 | if(is_prerecording) | 2648 | if(is_prerecording) |
2649 | return prerecord_count * HZ; | 2649 | return prerecord_count * HZ; |
2650 | 2650 | ||
2651 | if(is_recording) | 2651 | if(is_recording) |
2652 | { | 2652 | { |
2653 | if(paused) | 2653 | if(paused) |
@@ -2663,7 +2663,7 @@ unsigned long audio_num_recorded_bytes(void) | |||
2663 | { | 2663 | { |
2664 | int num_bytes; | 2664 | int num_bytes; |
2665 | int index; | 2665 | int index; |
2666 | 2666 | ||
2667 | if(is_recording) | 2667 | if(is_recording) |
2668 | { | 2668 | { |
2669 | if(is_prerecording) | 2669 | if(is_prerecording) |
@@ -2671,11 +2671,11 @@ unsigned long audio_num_recorded_bytes(void) | |||
2671 | index = prerecord_index - prerecord_count; | 2671 | index = prerecord_index - prerecord_count; |
2672 | if(index < 0) | 2672 | if(index < 0) |
2673 | index += prerecording_max_seconds; | 2673 | index += prerecording_max_seconds; |
2674 | 2674 | ||
2675 | num_bytes = audiobuf_write - prerecord_buffer[index].mempos; | 2675 | num_bytes = audiobuf_write - prerecord_buffer[index].mempos; |
2676 | if(num_bytes < 0) | 2676 | if(num_bytes < 0) |
2677 | num_bytes += audiobuflen; | 2677 | num_bytes += audiobuflen; |
2678 | 2678 | ||
2679 | return num_bytes; | 2679 | return num_bytes; |
2680 | } | 2680 | } |
2681 | else | 2681 | else |
@@ -2796,7 +2796,7 @@ void audio_play(long offset) | |||
2796 | int steps=0; | 2796 | int steps=0; |
2797 | 2797 | ||
2798 | is_playing = true; | 2798 | is_playing = true; |
2799 | 2799 | ||
2800 | do { | 2800 | do { |
2801 | trackname = playlist_peek(steps, name_buf, sizeof(name_buf)); | 2801 | trackname = playlist_peek(steps, name_buf, sizeof(name_buf)); |
2802 | if (!trackname) | 2802 | if (!trackname) |
@@ -2849,7 +2849,7 @@ void audio_stop(void) | |||
2849 | /* dummy */ | 2849 | /* dummy */ |
2850 | void audio_stop_recording(void) | 2850 | void audio_stop_recording(void) |
2851 | { | 2851 | { |
2852 | audio_stop(); | 2852 | audio_stop(); |
2853 | } | 2853 | } |
2854 | 2854 | ||
2855 | void audio_hard_stop(void) | 2855 | void audio_hard_stop(void) |
@@ -2966,7 +2966,7 @@ int audio_status(void) | |||
2966 | 2966 | ||
2967 | if(paused) | 2967 | if(paused) |
2968 | ret |= AUDIO_STATUS_PAUSE; | 2968 | ret |= AUDIO_STATUS_PAUSE; |
2969 | 2969 | ||
2970 | #if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) | 2970 | #if (CONFIG_CODEC == MAS3587F) && !defined(SIMULATOR) |
2971 | if(is_recording && !is_prerecording) | 2971 | if(is_recording && !is_prerecording) |
2972 | ret |= AUDIO_STATUS_RECORD; | 2972 | ret |= AUDIO_STATUS_RECORD; |
@@ -2977,7 +2977,7 @@ int audio_status(void) | |||
2977 | 2977 | ||
2978 | if(mpeg_errno) | 2978 | if(mpeg_errno) |
2979 | ret |= AUDIO_STATUS_ERROR; | 2979 | ret |= AUDIO_STATUS_ERROR; |
2980 | 2980 | ||
2981 | return ret; | 2981 | return ret; |
2982 | } | 2982 | } |
2983 | 2983 | ||
diff --git a/apps/playback.h b/apps/playback.h index 865e9a313b..0a9d22cde2 100644 --- a/apps/playback.h +++ b/apps/playback.h | |||
@@ -58,7 +58,7 @@ int playback_claim_aa_slot(struct dim *dim); | |||
58 | 58 | ||
59 | /* | 59 | /* |
60 | * Releases the albumart slot with given id | 60 | * Releases the albumart slot with given id |
61 | * | 61 | * |
62 | * Save to call from other threads */ | 62 | * Save to call from other threads */ |
63 | void playback_release_aa_slot(int slot); | 63 | void playback_release_aa_slot(int slot); |
64 | 64 | ||
diff --git a/apps/scrobbler.c b/apps/scrobbler.c index 1a0ad9390e..be60cc15af 100644 --- a/apps/scrobbler.c +++ b/apps/scrobbler.c | |||
@@ -140,7 +140,7 @@ static void write_cache(void) | |||
140 | fd = open(scrobbler_file, O_WRONLY | O_APPEND); | 140 | fd = open(scrobbler_file, O_WRONLY | O_APPEND); |
141 | if(fd >= 0) | 141 | if(fd >= 0) |
142 | { | 142 | { |
143 | logf("SCROBBLER: writing %d entries", cache_pos); | 143 | logf("SCROBBLER: writing %d entries", cache_pos); |
144 | /* copy data to temporary storage in case data moves during I/O */ | 144 | /* copy data to temporary storage in case data moves during I/O */ |
145 | char temp_buf[SCROBBLER_CACHE_LEN]; | 145 | char temp_buf[SCROBBLER_CACHE_LEN]; |
146 | for ( i=0; i < cache_pos; i++ ) | 146 | for ( i=0; i < cache_pos; i++ ) |
diff --git a/apps/tagtree.c b/apps/tagtree.c index 5766d2892e..6b0c6aa3dd 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Basic structure on this file was copied from dbtree.c and modified to | 23 | * Basic structure on this file was copied from dbtree.c and modified to |
24 | * support the tag cache interface. | 24 | * support the tag cache interface. |
25 | */ | 25 | */ |
@@ -117,13 +117,13 @@ static bool sort_inverse; | |||
117 | 117 | ||
118 | /* | 118 | /* |
119 | * "%3d. %s" autoscore title %sort = "inverse" %limit = "100" | 119 | * "%3d. %s" autoscore title %sort = "inverse" %limit = "100" |
120 | * | 120 | * |
121 | * valid = true | 121 | * valid = true |
122 | * formatstr = "%-3d. %s" | 122 | * formatstr = "%-3d. %s" |
123 | * tags[0] = tag_autoscore | 123 | * tags[0] = tag_autoscore |
124 | * tags[1] = tag_title | 124 | * tags[1] = tag_title |
125 | * tag_count = 2 | 125 | * tag_count = 2 |
126 | * | 126 | * |
127 | * limit = 100 | 127 | * limit = 100 |
128 | * sort_inverse = true | 128 | * sort_inverse = true |
129 | */ | 129 | */ |
@@ -135,7 +135,7 @@ struct display_format { | |||
135 | int group_id; | 135 | int group_id; |
136 | int tags[MAX_TAGS]; | 136 | int tags[MAX_TAGS]; |
137 | int tag_count; | 137 | int tag_count; |
138 | 138 | ||
139 | int limit; | 139 | int limit; |
140 | int strip; | 140 | int strip; |
141 | bool sort_inverse; | 141 | bool sort_inverse; |
@@ -288,17 +288,17 @@ static int get_token_str(char *buf, int size) | |||
288 | 288 | ||
289 | if (*strp == '\0' || *(++strp) == '\0') | 289 | if (*strp == '\0' || *(++strp) == '\0') |
290 | return -1; | 290 | return -1; |
291 | 291 | ||
292 | /* Read the data. */ | 292 | /* Read the data. */ |
293 | while (*strp != '"' && *strp != '\0' && --size > 0) | 293 | while (*strp != '"' && *strp != '\0' && --size > 0) |
294 | *(buf++) = *(strp++); | 294 | *(buf++) = *(strp++); |
295 | 295 | ||
296 | *buf = '\0'; | 296 | *buf = '\0'; |
297 | if (*strp != '"') | 297 | if (*strp != '"') |
298 | return -2; | 298 | return -2; |
299 | 299 | ||
300 | strp++; | 300 | strp++; |
301 | 301 | ||
302 | return 0; | 302 | return 0; |
303 | } | 303 | } |
304 | 304 | ||
@@ -345,11 +345,11 @@ static int get_tag(int *tag) | |||
345 | }; | 345 | }; |
346 | char buf[128]; | 346 | char buf[128]; |
347 | unsigned int i; | 347 | unsigned int i; |
348 | 348 | ||
349 | /* Find the start. */ | 349 | /* Find the start. */ |
350 | while ((*strp == ' ' || *strp == '>') && *strp != '\0') | 350 | while ((*strp == ' ' || *strp == '>') && *strp != '\0') |
351 | strp++; | 351 | strp++; |
352 | 352 | ||
353 | if (*strp == '\0' || *strp == '?') | 353 | if (*strp == '\0' || *strp == '?') |
354 | return 0; | 354 | return 0; |
355 | 355 | ||
@@ -433,16 +433,16 @@ static bool read_clause(struct tagcache_search_clause *clause) | |||
433 | { | 433 | { |
434 | char buf[SEARCHSTR_SIZE]; | 434 | char buf[SEARCHSTR_SIZE]; |
435 | unsigned int i; | 435 | unsigned int i; |
436 | 436 | ||
437 | if (get_tag(&clause->tag) <= 0) | 437 | if (get_tag(&clause->tag) <= 0) |
438 | return false; | 438 | return false; |
439 | 439 | ||
440 | if (get_clause(&clause->type) <= 0) | 440 | if (get_clause(&clause->type) <= 0) |
441 | return false; | 441 | return false; |
442 | 442 | ||
443 | if (get_token_str(buf, sizeof buf) < 0) | 443 | if (get_token_str(buf, sizeof buf) < 0) |
444 | return false; | 444 | return false; |
445 | 445 | ||
446 | for (i=0; i<ARRAYLEN(id3_to_search_mapping); i++) | 446 | for (i=0; i<ARRAYLEN(id3_to_search_mapping); i++) |
447 | { | 447 | { |
448 | if (!strcasecmp(buf, id3_to_search_mapping[i].string)) | 448 | if (!strcasecmp(buf, id3_to_search_mapping[i].string)) |
@@ -453,13 +453,13 @@ static bool read_clause(struct tagcache_search_clause *clause) | |||
453 | { | 453 | { |
454 | clause->source = source_runtime+i; | 454 | clause->source = source_runtime+i; |
455 | clause->str = tagtree_alloc(SEARCHSTR_SIZE); | 455 | clause->str = tagtree_alloc(SEARCHSTR_SIZE); |
456 | } | 456 | } |
457 | else | 457 | else |
458 | { | 458 | { |
459 | clause->source = source_constant; | 459 | clause->source = source_constant; |
460 | clause->str = tagtree_strdup(buf); | 460 | clause->str = tagtree_strdup(buf); |
461 | } | 461 | } |
462 | 462 | ||
463 | if (TAGCACHE_IS_NUMERIC(clause->tag)) | 463 | if (TAGCACHE_IS_NUMERIC(clause->tag)) |
464 | { | 464 | { |
465 | clause->numeric = true; | 465 | clause->numeric = true; |
@@ -468,24 +468,24 @@ static bool read_clause(struct tagcache_search_clause *clause) | |||
468 | else | 468 | else |
469 | clause->numeric = false; | 469 | clause->numeric = false; |
470 | 470 | ||
471 | logf("got clause: %d/%d [%s]", clause->tag, clause->type, clause->str); | 471 | logf("got clause: %d/%d [%s]", clause->tag, clause->type, clause->str); |
472 | 472 | ||
473 | return true; | 473 | return true; |
474 | } | 474 | } |
475 | 475 | ||
476 | static bool read_variable(char *buf, int size) | 476 | static bool read_variable(char *buf, int size) |
477 | { | 477 | { |
478 | int condition; | 478 | int condition; |
479 | 479 | ||
480 | if (!get_clause(&condition)) | 480 | if (!get_clause(&condition)) |
481 | return false; | 481 | return false; |
482 | 482 | ||
483 | if (condition != clause_is) | 483 | if (condition != clause_is) |
484 | return false; | 484 | return false; |
485 | 485 | ||
486 | if (get_token_str(buf, size) < 0) | 486 | if (get_token_str(buf, size) < 0) |
487 | return false; | 487 | return false; |
488 | 488 | ||
489 | return true; | 489 | return true; |
490 | } | 490 | } |
491 | 491 | ||
@@ -495,12 +495,12 @@ static int get_format_str(struct display_format *fmt) | |||
495 | int ret; | 495 | int ret; |
496 | char buf[128]; | 496 | char buf[128]; |
497 | int i; | 497 | int i; |
498 | 498 | ||
499 | memset(fmt, 0, sizeof(struct display_format)); | 499 | memset(fmt, 0, sizeof(struct display_format)); |
500 | 500 | ||
501 | if (get_token_str(fmt->name, sizeof fmt->name) < 0) | 501 | if (get_token_str(fmt->name, sizeof fmt->name) < 0) |
502 | return -10; | 502 | return -10; |
503 | 503 | ||
504 | /* Determine the group id */ | 504 | /* Determine the group id */ |
505 | fmt->group_id = 0; | 505 | fmt->group_id = 0; |
506 | for (i = 0; i < format_count; i++) | 506 | for (i = 0; i < format_count; i++) |
@@ -510,30 +510,30 @@ static int get_format_str(struct display_format *fmt) | |||
510 | fmt->group_id = formats[i]->group_id; | 510 | fmt->group_id = formats[i]->group_id; |
511 | break; | 511 | break; |
512 | } | 512 | } |
513 | 513 | ||
514 | if (formats[i]->group_id > fmt->group_id) | 514 | if (formats[i]->group_id > fmt->group_id) |
515 | fmt->group_id = formats[i]->group_id; | 515 | fmt->group_id = formats[i]->group_id; |
516 | } | 516 | } |
517 | 517 | ||
518 | if (i == format_count) | 518 | if (i == format_count) |
519 | fmt->group_id++; | 519 | fmt->group_id++; |
520 | 520 | ||
521 | logf("format: (%d) %s", fmt->group_id, fmt->name); | 521 | logf("format: (%d) %s", fmt->group_id, fmt->name); |
522 | 522 | ||
523 | if (get_token_str(buf, sizeof buf) < 0) | 523 | if (get_token_str(buf, sizeof buf) < 0) |
524 | return -10; | 524 | return -10; |
525 | 525 | ||
526 | fmt->formatstr = tagtree_strdup(buf); | 526 | fmt->formatstr = tagtree_strdup(buf); |
527 | 527 | ||
528 | while (fmt->tag_count < MAX_TAGS) | 528 | while (fmt->tag_count < MAX_TAGS) |
529 | { | 529 | { |
530 | ret = get_tag(&fmt->tags[fmt->tag_count]); | 530 | ret = get_tag(&fmt->tags[fmt->tag_count]); |
531 | if (ret < 0) | 531 | if (ret < 0) |
532 | return -11; | 532 | return -11; |
533 | 533 | ||
534 | if (ret == 0) | 534 | if (ret == 0) |
535 | break; | 535 | break; |
536 | 536 | ||
537 | switch (fmt->tags[fmt->tag_count]) { | 537 | switch (fmt->tags[fmt->tag_count]) { |
538 | case var_sorttype: | 538 | case var_sorttype: |
539 | if (!read_variable(buf, sizeof buf)) | 539 | if (!read_variable(buf, sizeof buf)) |
@@ -541,24 +541,24 @@ static int get_format_str(struct display_format *fmt) | |||
541 | if (!strcasecmp("inverse", buf)) | 541 | if (!strcasecmp("inverse", buf)) |
542 | fmt->sort_inverse = true; | 542 | fmt->sort_inverse = true; |
543 | break; | 543 | break; |
544 | 544 | ||
545 | case var_limit: | 545 | case var_limit: |
546 | if (!read_variable(buf, sizeof buf)) | 546 | if (!read_variable(buf, sizeof buf)) |
547 | return -13; | 547 | return -13; |
548 | fmt->limit = atoi(buf); | 548 | fmt->limit = atoi(buf); |
549 | break; | 549 | break; |
550 | 550 | ||
551 | case var_strip: | 551 | case var_strip: |
552 | if (!read_variable(buf, sizeof buf)) | 552 | if (!read_variable(buf, sizeof buf)) |
553 | return -14; | 553 | return -14; |
554 | fmt->strip = atoi(buf); | 554 | fmt->strip = atoi(buf); |
555 | break; | 555 | break; |
556 | 556 | ||
557 | default: | 557 | default: |
558 | fmt->tag_count++; | 558 | fmt->tag_count++; |
559 | } | 559 | } |
560 | } | 560 | } |
561 | 561 | ||
562 | return 1; | 562 | return 1; |
563 | } | 563 | } |
564 | 564 | ||
@@ -571,17 +571,17 @@ static int add_format(const char *buf) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | strp = buf; | 573 | strp = buf; |
574 | 574 | ||
575 | if (formats[format_count] == NULL) | 575 | if (formats[format_count] == NULL) |
576 | formats[format_count] = tagtree_alloc0(sizeof(struct display_format)); | 576 | formats[format_count] = tagtree_alloc0(sizeof(struct display_format)); |
577 | 577 | ||
578 | if (get_format_str(formats[format_count]) < 0) | 578 | if (get_format_str(formats[format_count]) < 0) |
579 | { | 579 | { |
580 | logf("get_format_str() parser failed!"); | 580 | logf("get_format_str() parser failed!"); |
581 | memset(formats[format_count], 0, sizeof(struct display_format)); | 581 | memset(formats[format_count], 0, sizeof(struct display_format)); |
582 | return -4; | 582 | return -4; |
583 | } | 583 | } |
584 | 584 | ||
585 | while (*strp != '\0' && *strp != '?') | 585 | while (*strp != '\0' && *strp != '?') |
586 | strp++; | 586 | strp++; |
587 | 587 | ||
@@ -594,28 +594,28 @@ static int add_format(const char *buf) | |||
594 | while (1) | 594 | while (1) |
595 | { | 595 | { |
596 | struct tagcache_search_clause *newclause; | 596 | struct tagcache_search_clause *newclause; |
597 | 597 | ||
598 | if (clause_count >= TAGCACHE_MAX_CLAUSES) | 598 | if (clause_count >= TAGCACHE_MAX_CLAUSES) |
599 | { | 599 | { |
600 | logf("too many clauses"); | 600 | logf("too many clauses"); |
601 | break; | 601 | break; |
602 | } | 602 | } |
603 | 603 | ||
604 | newclause = tagtree_alloc(sizeof(struct tagcache_search_clause)); | 604 | newclause = tagtree_alloc(sizeof(struct tagcache_search_clause)); |
605 | 605 | ||
606 | formats[format_count]->clause[clause_count] = newclause; | 606 | formats[format_count]->clause[clause_count] = newclause; |
607 | if (!read_clause(newclause)) | 607 | if (!read_clause(newclause)) |
608 | break; | 608 | break; |
609 | 609 | ||
610 | clause_count++; | 610 | clause_count++; |
611 | } | 611 | } |
612 | tagtree_unlock(); | 612 | tagtree_unlock(); |
613 | 613 | ||
614 | formats[format_count]->clause_count = clause_count; | 614 | formats[format_count]->clause_count = clause_count; |
615 | } | 615 | } |
616 | 616 | ||
617 | format_count++; | 617 | format_count++; |
618 | 618 | ||
619 | return 1; | 619 | return 1; |
620 | } | 620 | } |
621 | 621 | ||
@@ -624,28 +624,28 @@ static int get_condition(struct search_instruction *inst) | |||
624 | struct tagcache_search_clause *new_clause; | 624 | struct tagcache_search_clause *new_clause; |
625 | int clause_count; | 625 | int clause_count; |
626 | char buf[128]; | 626 | char buf[128]; |
627 | 627 | ||
628 | switch (*strp) | 628 | switch (*strp) |
629 | { | 629 | { |
630 | case '=': | 630 | case '=': |
631 | { | 631 | { |
632 | int i; | 632 | int i; |
633 | 633 | ||
634 | if (get_token_str(buf, sizeof buf) < 0) | 634 | if (get_token_str(buf, sizeof buf) < 0) |
635 | return -1; | 635 | return -1; |
636 | 636 | ||
637 | for (i = 0; i < format_count; i++) | 637 | for (i = 0; i < format_count; i++) |
638 | { | 638 | { |
639 | if (!strcasecmp(formats[i]->name, buf)) | 639 | if (!strcasecmp(formats[i]->name, buf)) |
640 | break; | 640 | break; |
641 | } | 641 | } |
642 | 642 | ||
643 | if (i == format_count) | 643 | if (i == format_count) |
644 | { | 644 | { |
645 | logf("format not found: %s", buf); | 645 | logf("format not found: %s", buf); |
646 | return -2; | 646 | return -2; |
647 | } | 647 | } |
648 | 648 | ||
649 | inst->format_id[inst->tagorder_count] = formats[i]->group_id; | 649 | inst->format_id[inst->tagorder_count] = formats[i]->group_id; |
650 | return 1; | 650 | return 1; |
651 | } | 651 | } |
@@ -665,10 +665,10 @@ static int get_condition(struct search_instruction *inst) | |||
665 | logf("Too many clauses"); | 665 | logf("Too many clauses"); |
666 | return false; | 666 | return false; |
667 | } | 667 | } |
668 | 668 | ||
669 | new_clause = tagtree_alloc(sizeof(struct tagcache_search_clause)); | 669 | new_clause = tagtree_alloc(sizeof(struct tagcache_search_clause)); |
670 | inst->clause[inst->tagorder_count][clause_count] = new_clause; | 670 | inst->clause[inst->tagorder_count][clause_count] = new_clause; |
671 | 671 | ||
672 | if (*strp == '|') | 672 | if (*strp == '|') |
673 | { | 673 | { |
674 | strp++; | 674 | strp++; |
@@ -683,7 +683,7 @@ static int get_condition(struct search_instruction *inst) | |||
683 | return -1; | 683 | return -1; |
684 | } | 684 | } |
685 | inst->clause_count[inst->tagorder_count]++; | 685 | inst->clause_count[inst->tagorder_count]++; |
686 | 686 | ||
687 | return 1; | 687 | return 1; |
688 | } | 688 | } |
689 | 689 | ||
@@ -702,25 +702,25 @@ static bool parse_search(struct menu_entry *entry, const char *str) | |||
702 | struct search_instruction *inst = &entry->si; | 702 | struct search_instruction *inst = &entry->si; |
703 | char buf[MAX_PATH]; | 703 | char buf[MAX_PATH]; |
704 | int i; | 704 | int i; |
705 | 705 | ||
706 | strp = str; | 706 | strp = str; |
707 | 707 | ||
708 | /* Parse entry name */ | 708 | /* Parse entry name */ |
709 | if (get_token_str(entry->name, sizeof entry->name) < 0) | 709 | if (get_token_str(entry->name, sizeof entry->name) < 0) |
710 | { | 710 | { |
711 | logf("No name found."); | 711 | logf("No name found."); |
712 | return false; | 712 | return false; |
713 | } | 713 | } |
714 | 714 | ||
715 | /* Parse entry type */ | 715 | /* Parse entry type */ |
716 | if (get_tag(&entry->type) <= 0) | 716 | if (get_tag(&entry->type) <= 0) |
717 | return false; | 717 | return false; |
718 | 718 | ||
719 | if (entry->type == menu_load) | 719 | if (entry->type == menu_load) |
720 | { | 720 | { |
721 | if (get_token_str(buf, sizeof buf) < 0) | 721 | if (get_token_str(buf, sizeof buf) < 0) |
722 | return false; | 722 | return false; |
723 | 723 | ||
724 | /* Find the matching root menu or "create" it */ | 724 | /* Find the matching root menu or "create" it */ |
725 | for (i = 0; i < menu_count; i++) | 725 | for (i = 0; i < menu_count; i++) |
726 | { | 726 | { |
@@ -730,38 +730,38 @@ static bool parse_search(struct menu_entry *entry, const char *str) | |||
730 | return true; | 730 | return true; |
731 | } | 731 | } |
732 | } | 732 | } |
733 | 733 | ||
734 | if (menu_count >= TAGMENU_MAX_MENUS) | 734 | if (menu_count >= TAGMENU_MAX_MENUS) |
735 | { | 735 | { |
736 | logf("max menucount reached"); | 736 | logf("max menucount reached"); |
737 | return false; | 737 | return false; |
738 | } | 738 | } |
739 | 739 | ||
740 | /* Allocate a new menu unless link is found. */ | 740 | /* Allocate a new menu unless link is found. */ |
741 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); | 741 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); |
742 | strlcpy(menus[menu_count]->id, buf, MAX_MENU_ID_SIZE); | 742 | strlcpy(menus[menu_count]->id, buf, MAX_MENU_ID_SIZE); |
743 | entry->link = menu_count; | 743 | entry->link = menu_count; |
744 | ++menu_count; | 744 | ++menu_count; |
745 | 745 | ||
746 | return true; | 746 | return true; |
747 | } | 747 | } |
748 | 748 | ||
749 | if (entry->type != menu_next) | 749 | if (entry->type != menu_next) |
750 | return false; | 750 | return false; |
751 | 751 | ||
752 | while (inst->tagorder_count < MAX_TAGS) | 752 | while (inst->tagorder_count < MAX_TAGS) |
753 | { | 753 | { |
754 | ret = get_tag(&inst->tagorder[inst->tagorder_count]); | 754 | ret = get_tag(&inst->tagorder[inst->tagorder_count]); |
755 | if (ret < 0) | 755 | if (ret < 0) |
756 | { | 756 | { |
757 | logf("Parse error #1"); | 757 | logf("Parse error #1"); |
758 | logf("%s", strp); | 758 | logf("%s", strp); |
759 | return false; | 759 | return false; |
760 | } | 760 | } |
761 | 761 | ||
762 | if (ret == 0) | 762 | if (ret == 0) |
763 | break ; | 763 | break ; |
764 | 764 | ||
765 | logf("tag: %d", inst->tagorder[inst->tagorder_count]); | 765 | logf("tag: %d", inst->tagorder[inst->tagorder_count]); |
766 | 766 | ||
767 | tagtree_lock(); | 767 | tagtree_lock(); |
@@ -772,11 +772,11 @@ static bool parse_search(struct menu_entry *entry, const char *str) | |||
772 | return false; | 772 | return false; |
773 | 773 | ||
774 | inst->tagorder_count++; | 774 | inst->tagorder_count++; |
775 | 775 | ||
776 | if (get_tag(&type) <= 0 || type != menu_next) | 776 | if (get_tag(&type) <= 0 || type != menu_next) |
777 | break; | 777 | break; |
778 | } | 778 | } |
779 | 779 | ||
780 | return true; | 780 | return true; |
781 | } | 781 | } |
782 | 782 | ||
@@ -787,7 +787,7 @@ static int compare(const void *p1, const void *p2) | |||
787 | 787 | ||
788 | if (sort_inverse) | 788 | if (sort_inverse) |
789 | return strncasecmp(e2->name, e1->name, MAX_PATH); | 789 | return strncasecmp(e2->name, e1->name, MAX_PATH); |
790 | 790 | ||
791 | return strncasecmp(e1->name, e2->name, MAX_PATH); | 791 | return strncasecmp(e1->name, e2->name, MAX_PATH); |
792 | } | 792 | } |
793 | 793 | ||
@@ -795,13 +795,13 @@ static void tagtree_buffer_event(void *data) | |||
795 | { | 795 | { |
796 | struct tagcache_search tcs; | 796 | struct tagcache_search tcs; |
797 | struct mp3entry *id3 = (struct mp3entry*)data; | 797 | struct mp3entry *id3 = (struct mp3entry*)data; |
798 | 798 | ||
799 | /* Do not gather data unless proper setting has been enabled. */ | 799 | /* Do not gather data unless proper setting has been enabled. */ |
800 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) | 800 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) |
801 | return; | 801 | return; |
802 | 802 | ||
803 | logf("be:%s", id3->path); | 803 | logf("be:%s", id3->path); |
804 | 804 | ||
805 | while (! tagcache_is_fully_initialized()) | 805 | while (! tagcache_is_fully_initialized()) |
806 | yield(); | 806 | yield(); |
807 | 807 | ||
@@ -810,7 +810,7 @@ static void tagtree_buffer_event(void *data) | |||
810 | logf("tc stat: not found: %s", id3->path); | 810 | logf("tc stat: not found: %s", id3->path); |
811 | return; | 811 | return; |
812 | } | 812 | } |
813 | 813 | ||
814 | if (global_settings.runtimedb) | 814 | if (global_settings.runtimedb) |
815 | { | 815 | { |
816 | id3->playcount = tagcache_get_numeric(&tcs, tag_playcount); | 816 | id3->playcount = tagcache_get_numeric(&tcs, tag_playcount); |
@@ -819,11 +819,11 @@ static void tagtree_buffer_event(void *data) | |||
819 | id3->lastplayed = tagcache_get_numeric(&tcs, tag_lastplayed); | 819 | id3->lastplayed = tagcache_get_numeric(&tcs, tag_lastplayed); |
820 | id3->score = tagcache_get_numeric(&tcs, tag_virt_autoscore) / 10; | 820 | id3->score = tagcache_get_numeric(&tcs, tag_virt_autoscore) / 10; |
821 | id3->playtime = tagcache_get_numeric(&tcs, tag_playtime); | 821 | id3->playtime = tagcache_get_numeric(&tcs, tag_playtime); |
822 | 822 | ||
823 | logf("-> %ld/%ld", id3->playcount, id3->playtime); | 823 | logf("-> %ld/%ld", id3->playcount, id3->playtime); |
824 | } | 824 | } |
825 | 825 | ||
826 | #if CONFIG_CODEC == SWCODEC | 826 | #if CONFIG_CODEC == SWCODEC |
827 | if (global_settings.autoresume_enable) | 827 | if (global_settings.autoresume_enable) |
828 | { | 828 | { |
829 | /* Load current file resume offset if not already defined (by | 829 | /* Load current file resume offset if not already defined (by |
@@ -832,15 +832,15 @@ static void tagtree_buffer_event(void *data) | |||
832 | { | 832 | { |
833 | id3->offset = tagcache_get_numeric(&tcs, tag_lastoffset); | 833 | id3->offset = tagcache_get_numeric(&tcs, tag_lastoffset); |
834 | 834 | ||
835 | logf("tagtree_buffer_event: Set offset for %s to %lX\n", | 835 | logf("tagtree_buffer_event: Set offset for %s to %lX\n", |
836 | str_or_empty(id3->title), id3->offset); | 836 | str_or_empty(id3->title), id3->offset); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | #endif | 839 | #endif |
840 | 840 | ||
841 | /* Store our tagcache index pointer. */ | 841 | /* Store our tagcache index pointer. */ |
842 | id3->tagcache_idx = tcs.idx_id+1; | 842 | id3->tagcache_idx = tcs.idx_id+1; |
843 | 843 | ||
844 | tagcache_search_finish(&tcs); | 844 | tagcache_search_finish(&tcs); |
845 | } | 845 | } |
846 | 846 | ||
@@ -849,14 +849,14 @@ static void tagtree_track_finish_event(void *data) | |||
849 | long lastplayed; | 849 | long lastplayed; |
850 | long tagcache_idx; | 850 | long tagcache_idx; |
851 | struct mp3entry *id3 = (struct mp3entry*)data; | 851 | struct mp3entry *id3 = (struct mp3entry*)data; |
852 | 852 | ||
853 | /* Do not gather data unless proper setting has been enabled. */ | 853 | /* Do not gather data unless proper setting has been enabled. */ |
854 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) | 854 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) |
855 | { | 855 | { |
856 | logf("runtimedb gathering and autoresume not enabled"); | 856 | logf("runtimedb gathering and autoresume not enabled"); |
857 | return; | 857 | return; |
858 | } | 858 | } |
859 | 859 | ||
860 | tagcache_idx=id3->tagcache_idx; | 860 | tagcache_idx=id3->tagcache_idx; |
861 | if (!tagcache_idx) | 861 | if (!tagcache_idx) |
862 | { | 862 | { |
@@ -864,7 +864,7 @@ static void tagtree_track_finish_event(void *data) | |||
864 | return; | 864 | return; |
865 | } | 865 | } |
866 | tagcache_idx--; | 866 | tagcache_idx--; |
867 | 867 | ||
868 | /* Don't process unplayed tracks, or tracks interrupted within the | 868 | /* Don't process unplayed tracks, or tracks interrupted within the |
869 | first 15 seconds. */ | 869 | first 15 seconds. */ |
870 | if (id3->elapsed == 0 | 870 | if (id3->elapsed == 0 |
@@ -876,24 +876,24 @@ static void tagtree_track_finish_event(void *data) | |||
876 | logf("not logging unplayed or skipped track"); | 876 | logf("not logging unplayed or skipped track"); |
877 | return; | 877 | return; |
878 | } | 878 | } |
879 | 879 | ||
880 | lastplayed = tagcache_increase_serial(); | 880 | lastplayed = tagcache_increase_serial(); |
881 | if (lastplayed < 0) | 881 | if (lastplayed < 0) |
882 | { | 882 | { |
883 | logf("incorrect tc serial:%ld", lastplayed); | 883 | logf("incorrect tc serial:%ld", lastplayed); |
884 | return; | 884 | return; |
885 | } | 885 | } |
886 | 886 | ||
887 | if (global_settings.runtimedb) | 887 | if (global_settings.runtimedb) |
888 | { | 888 | { |
889 | long playcount; | 889 | long playcount; |
890 | long playtime; | 890 | long playtime; |
891 | 891 | ||
892 | playcount = id3->playcount + 1; | 892 | playcount = id3->playcount + 1; |
893 | 893 | ||
894 | /* Ignore the last 15s (crossfade etc.) */ | 894 | /* Ignore the last 15s (crossfade etc.) */ |
895 | playtime = id3->playtime + MIN(id3->length, id3->elapsed + 15 * 1000); | 895 | playtime = id3->playtime + MIN(id3->length, id3->elapsed + 15 * 1000); |
896 | 896 | ||
897 | logf("ube:%s", id3->path); | 897 | logf("ube:%s", id3->path); |
898 | logf("-> %ld/%ld", playcount, playtime); | 898 | logf("-> %ld/%ld", playcount, playtime); |
899 | logf("-> %ld/%ld/%ld", id3->elapsed, id3->length, | 899 | logf("-> %ld/%ld/%ld", id3->elapsed, id3->length, |
@@ -905,7 +905,7 @@ static void tagtree_track_finish_event(void *data) | |||
905 | tagcache_update_numeric(tagcache_idx, tag_lastplayed, lastplayed); | 905 | tagcache_update_numeric(tagcache_idx, tag_lastplayed, lastplayed); |
906 | } | 906 | } |
907 | 907 | ||
908 | #if CONFIG_CODEC == SWCODEC | 908 | #if CONFIG_CODEC == SWCODEC |
909 | if (global_settings.autoresume_enable) | 909 | if (global_settings.autoresume_enable) |
910 | { | 910 | { |
911 | unsigned long offset | 911 | unsigned long offset |
@@ -913,7 +913,7 @@ static void tagtree_track_finish_event(void *data) | |||
913 | 913 | ||
914 | tagcache_update_numeric(tagcache_idx, tag_lastoffset, offset); | 914 | tagcache_update_numeric(tagcache_idx, tag_lastoffset, offset); |
915 | 915 | ||
916 | logf("tagtree_track_finish_event: Save offset for %s: %lX", | 916 | logf("tagtree_track_finish_event: Save offset for %s: %lX", |
917 | str_or_empty(id3->title), offset); | 917 | str_or_empty(id3->title), offset); |
918 | } | 918 | } |
919 | #endif | 919 | #endif |
@@ -922,13 +922,13 @@ static void tagtree_track_finish_event(void *data) | |||
922 | bool tagtree_export(void) | 922 | bool tagtree_export(void) |
923 | { | 923 | { |
924 | struct tagcache_search tcs; | 924 | struct tagcache_search tcs; |
925 | 925 | ||
926 | splash(0, str(LANG_CREATING)); | 926 | splash(0, str(LANG_CREATING)); |
927 | if (!tagcache_create_changelog(&tcs)) | 927 | if (!tagcache_create_changelog(&tcs)) |
928 | { | 928 | { |
929 | splash(HZ*2, ID2P(LANG_FAILED)); | 929 | splash(HZ*2, ID2P(LANG_FAILED)); |
930 | } | 930 | } |
931 | 931 | ||
932 | return false; | 932 | return false; |
933 | } | 933 | } |
934 | 934 | ||
@@ -939,7 +939,7 @@ bool tagtree_import(void) | |||
939 | { | 939 | { |
940 | splash(HZ*2, ID2P(LANG_FAILED)); | 940 | splash(HZ*2, ID2P(LANG_FAILED)); |
941 | } | 941 | } |
942 | 942 | ||
943 | return false; | 943 | return false; |
944 | } | 944 | } |
945 | 945 | ||
@@ -952,16 +952,16 @@ static int parse_line(int n, char *buf, void *parameters) | |||
952 | static bool read_menu; | 952 | static bool read_menu; |
953 | int i; | 953 | int i; |
954 | char *p; | 954 | char *p; |
955 | 955 | ||
956 | (void)parameters; | 956 | (void)parameters; |
957 | 957 | ||
958 | /* Strip possible <CR> at end of line. */ | 958 | /* Strip possible <CR> at end of line. */ |
959 | p = strchr(buf, '\r'); | 959 | p = strchr(buf, '\r'); |
960 | if (p != NULL) | 960 | if (p != NULL) |
961 | *p = '\0'; | 961 | *p = '\0'; |
962 | 962 | ||
963 | logf("parse:%d/%s", n, buf); | 963 | logf("parse:%d/%s", n, buf); |
964 | 964 | ||
965 | /* First line, do initialisation. */ | 965 | /* First line, do initialisation. */ |
966 | if (n == 0) | 966 | if (n == 0) |
967 | { | 967 | { |
@@ -970,13 +970,13 @@ static int parse_line(int n, char *buf, void *parameters) | |||
970 | logf("Version mismatch"); | 970 | logf("Version mismatch"); |
971 | return -1; | 971 | return -1; |
972 | } | 972 | } |
973 | 973 | ||
974 | read_menu = false; | 974 | read_menu = false; |
975 | } | 975 | } |
976 | 976 | ||
977 | if (buf[0] == '#') | 977 | if (buf[0] == '#') |
978 | return 0; | 978 | return 0; |
979 | 979 | ||
980 | if (buf[0] == '\0') | 980 | if (buf[0] == '\0') |
981 | { | 981 | { |
982 | if (read_menu) | 982 | if (read_menu) |
@@ -986,13 +986,13 @@ static int parse_line(int n, char *buf, void *parameters) | |||
986 | } | 986 | } |
987 | return 0; | 987 | return 0; |
988 | } | 988 | } |
989 | 989 | ||
990 | if (!read_menu) | 990 | if (!read_menu) |
991 | { | 991 | { |
992 | strp = buf; | 992 | strp = buf; |
993 | if (get_tag(&variable) <= 0) | 993 | if (get_tag(&variable) <= 0) |
994 | return 0; | 994 | return 0; |
995 | 995 | ||
996 | switch (variable) | 996 | switch (variable) |
997 | { | 997 | { |
998 | case var_format: | 998 | case var_format: |
@@ -1001,33 +1001,33 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1001 | logf("Format add fail: %s", data); | 1001 | logf("Format add fail: %s", data); |
1002 | } | 1002 | } |
1003 | break; | 1003 | break; |
1004 | 1004 | ||
1005 | case var_include: | 1005 | case var_include: |
1006 | if (get_token_str(data, sizeof(data)) < 0) | 1006 | if (get_token_str(data, sizeof(data)) < 0) |
1007 | { | 1007 | { |
1008 | logf("%%include empty"); | 1008 | logf("%%include empty"); |
1009 | return 0; | 1009 | return 0; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | if (!parse_menu(data)) | 1012 | if (!parse_menu(data)) |
1013 | { | 1013 | { |
1014 | logf("Load menu fail: %s", data); | 1014 | logf("Load menu fail: %s", data); |
1015 | } | 1015 | } |
1016 | break; | 1016 | break; |
1017 | 1017 | ||
1018 | case var_menu_start: | 1018 | case var_menu_start: |
1019 | if (menu_count >= TAGMENU_MAX_MENUS) | 1019 | if (menu_count >= TAGMENU_MAX_MENUS) |
1020 | { | 1020 | { |
1021 | logf("max menucount reached"); | 1021 | logf("max menucount reached"); |
1022 | return 0; | 1022 | return 0; |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | if (get_token_str(data, sizeof data) < 0) | 1025 | if (get_token_str(data, sizeof data) < 0) |
1026 | { | 1026 | { |
1027 | logf("%%menu_start id empty"); | 1027 | logf("%%menu_start id empty"); |
1028 | return 0; | 1028 | return 0; |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | menu = NULL; | 1031 | menu = NULL; |
1032 | for (i = 0; i < menu_count; i++) | 1032 | for (i = 0; i < menu_count; i++) |
1033 | { | 1033 | { |
@@ -1036,15 +1036,15 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1036 | menu = menus[i]; | 1036 | menu = menus[i]; |
1037 | } | 1037 | } |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | if (menu == NULL) | 1040 | if (menu == NULL) |
1041 | { | 1041 | { |
1042 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); | 1042 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); |
1043 | menu = menus[menu_count]; | 1043 | menu = menus[menu_count]; |
1044 | ++menu_count; | 1044 | ++menu_count; |
1045 | strlcpy(menu->id, data, MAX_MENU_ID_SIZE); | 1045 | strlcpy(menu->id, data, MAX_MENU_ID_SIZE); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | if (get_token_str(menu->title, sizeof(menu->title)) < 0) | 1048 | if (get_token_str(menu->title, sizeof(menu->title)) < 0) |
1049 | { | 1049 | { |
1050 | logf("%%menu_start title empty"); | 1050 | logf("%%menu_start title empty"); |
@@ -1053,18 +1053,18 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1053 | logf("menu: %s", menu->title); | 1053 | logf("menu: %s", menu->title); |
1054 | read_menu = true; | 1054 | read_menu = true; |
1055 | break; | 1055 | break; |
1056 | 1056 | ||
1057 | case var_rootmenu: | 1057 | case var_rootmenu: |
1058 | /* Only set root menu once. */ | 1058 | /* Only set root menu once. */ |
1059 | if (rootmenu >= 0) | 1059 | if (rootmenu >= 0) |
1060 | break; | 1060 | break; |
1061 | 1061 | ||
1062 | if (get_token_str(data, sizeof(data)) < 0) | 1062 | if (get_token_str(data, sizeof(data)) < 0) |
1063 | { | 1063 | { |
1064 | logf("%%rootmenu empty"); | 1064 | logf("%%rootmenu empty"); |
1065 | return 0; | 1065 | return 0; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | for (i = 0; i < menu_count; i++) | 1068 | for (i = 0; i < menu_count; i++) |
1069 | { | 1069 | { |
1070 | if (!strcasecmp(menus[i]->id, data)) | 1070 | if (!strcasecmp(menus[i]->id, data)) |
@@ -1074,16 +1074,16 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1074 | } | 1074 | } |
1075 | break; | 1075 | break; |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | return 0; | 1078 | return 0; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | if (menu->itemcount >= TAGMENU_MAX_ITEMS) | 1081 | if (menu->itemcount >= TAGMENU_MAX_ITEMS) |
1082 | { | 1082 | { |
1083 | logf("max itemcount reached"); | 1083 | logf("max itemcount reached"); |
1084 | return 0; | 1084 | return 0; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | /* Allocate */ | 1087 | /* Allocate */ |
1088 | if (menu->items[menu->itemcount] == NULL) | 1088 | if (menu->items[menu->itemcount] == NULL) |
1089 | menu->items[menu->itemcount] = tagtree_alloc0(sizeof(struct menu_entry)); | 1089 | menu->items[menu->itemcount] = tagtree_alloc0(sizeof(struct menu_entry)); |
@@ -1106,18 +1106,18 @@ static bool parse_menu(const char *filename) | |||
1106 | logf("max menucount reached"); | 1106 | logf("max menucount reached"); |
1107 | return false; | 1107 | return false; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | fd = open(filename, O_RDONLY); | 1110 | fd = open(filename, O_RDONLY); |
1111 | if (fd < 0) | 1111 | if (fd < 0) |
1112 | { | 1112 | { |
1113 | logf("Search instruction file not found."); | 1113 | logf("Search instruction file not found."); |
1114 | return false; | 1114 | return false; |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | /* Now read file for real, parsing into si */ | 1117 | /* Now read file for real, parsing into si */ |
1118 | fast_readline(fd, buf, sizeof buf, NULL, parse_line); | 1118 | fast_readline(fd, buf, sizeof buf, NULL, parse_line); |
1119 | close(fd); | 1119 | close(fd); |
1120 | 1120 | ||
1121 | return true; | 1121 | return true; |
1122 | } | 1122 | } |
1123 | 1123 | ||
@@ -1136,7 +1136,7 @@ void tagtree_init(void) | |||
1136 | sizeof(struct tagentry), sizeof(struct entry)); | 1136 | sizeof(struct tagentry), sizeof(struct entry)); |
1137 | if (lock_count > 0) | 1137 | if (lock_count > 0) |
1138 | panicf("tagtree locked after parsing"); | 1138 | panicf("tagtree locked after parsing"); |
1139 | 1139 | ||
1140 | /* If no root menu is set, assume it's the first single menu | 1140 | /* If no root menu is set, assume it's the first single menu |
1141 | * we have. That shouldn't normally happen. */ | 1141 | * we have. That shouldn't normally happen. */ |
1142 | if (rootmenu < 0) | 1142 | if (rootmenu < 0) |
@@ -1151,14 +1151,14 @@ void tagtree_init(void) | |||
1151 | static bool show_search_progress(bool init, int count) | 1151 | static bool show_search_progress(bool init, int count) |
1152 | { | 1152 | { |
1153 | static int last_tick = 0; | 1153 | static int last_tick = 0; |
1154 | 1154 | ||
1155 | /* Don't show splashes for 1/2 second after starting search */ | 1155 | /* Don't show splashes for 1/2 second after starting search */ |
1156 | if (init) | 1156 | if (init) |
1157 | { | 1157 | { |
1158 | last_tick = current_tick + HZ/2; | 1158 | last_tick = current_tick + HZ/2; |
1159 | return true; | 1159 | return true; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | /* Update progress every 1/10 of a second */ | 1162 | /* Update progress every 1/10 of a second */ |
1163 | if (TIME_AFTER(current_tick, last_tick + HZ/10)) | 1163 | if (TIME_AFTER(current_tick, last_tick + HZ/10)) |
1164 | { | 1164 | { |
@@ -1168,7 +1168,7 @@ static bool show_search_progress(bool init, int count) | |||
1168 | last_tick = current_tick; | 1168 | last_tick = current_tick; |
1169 | yield(); | 1169 | yield(); |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | return true; | 1172 | return true; |
1173 | } | 1173 | } |
1174 | 1174 | ||
@@ -1181,7 +1181,7 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt, | |||
1181 | int parpos = 0; | 1181 | int parpos = 0; |
1182 | int buf_pos = 0; | 1182 | int buf_pos = 0; |
1183 | int i; | 1183 | int i; |
1184 | 1184 | ||
1185 | memset(buf, 0, buf_size); | 1185 | memset(buf, 0, buf_size); |
1186 | for (i = 0; fmt->formatstr[i] != '\0'; i++) | 1186 | for (i = 0; fmt->formatstr[i] != '\0'; i++) |
1187 | { | 1187 | { |
@@ -1195,7 +1195,7 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt, | |||
1195 | return -1; | 1195 | return -1; |
1196 | } | 1196 | } |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | char formatchar = fmt->formatstr[i]; | 1199 | char formatchar = fmt->formatstr[i]; |
1200 | 1200 | ||
1201 | if (read_format) | 1201 | if (read_format) |
@@ -1260,16 +1260,16 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt, | |||
1260 | } | 1260 | } |
1261 | else | 1261 | else |
1262 | buf[buf_pos++] = formatchar; | 1262 | buf[buf_pos++] = formatchar; |
1263 | 1263 | ||
1264 | if (buf_pos >= buf_size - 1) /* need at least one more byte for \0 */ | 1264 | if (buf_pos >= buf_size - 1) /* need at least one more byte for \0 */ |
1265 | { | 1265 | { |
1266 | logf("buffer overflow"); | 1266 | logf("buffer overflow"); |
1267 | return -4; | 1267 | return -4; |
1268 | } | 1268 | } |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | buf[buf_pos++] = '\0'; | 1271 | buf[buf_pos++] = '\0'; |
1272 | 1272 | ||
1273 | return 0; | 1273 | return 0; |
1274 | } | 1274 | } |
1275 | 1275 | ||
@@ -1312,19 +1312,19 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1312 | 1312 | ||
1313 | if (!tagcache_search(&tcs, tag)) | 1313 | if (!tagcache_search(&tcs, tag)) |
1314 | return -1; | 1314 | return -1; |
1315 | 1315 | ||
1316 | /* Prevent duplicate entries in the search list. */ | 1316 | /* Prevent duplicate entries in the search list. */ |
1317 | tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE); | 1317 | tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE); |
1318 | 1318 | ||
1319 | if (level || csi->clause_count[0] || TAGCACHE_IS_NUMERIC(tag)) | 1319 | if (level || csi->clause_count[0] || TAGCACHE_IS_NUMERIC(tag)) |
1320 | sort = true; | 1320 | sort = true; |
1321 | 1321 | ||
1322 | for (i = 0; i < level; i++) | 1322 | for (i = 0; i < level; i++) |
1323 | { | 1323 | { |
1324 | if (TAGCACHE_IS_NUMERIC(csi->tagorder[i])) | 1324 | if (TAGCACHE_IS_NUMERIC(csi->tagorder[i])) |
1325 | { | 1325 | { |
1326 | static struct tagcache_search_clause cc; | 1326 | static struct tagcache_search_clause cc; |
1327 | 1327 | ||
1328 | memset(&cc, 0, sizeof(struct tagcache_search_clause)); | 1328 | memset(&cc, 0, sizeof(struct tagcache_search_clause)); |
1329 | cc.tag = csi->tagorder[i]; | 1329 | cc.tag = csi->tagorder[i]; |
1330 | cc.type = clause_is; | 1330 | cc.type = clause_is; |
@@ -1334,7 +1334,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1334 | } | 1334 | } |
1335 | else | 1335 | else |
1336 | { | 1336 | { |
1337 | tagcache_search_add_filter(&tcs, csi->tagorder[i], | 1337 | tagcache_search_add_filter(&tcs, csi->tagorder[i], |
1338 | csi->result_seek[i]); | 1338 | csi->result_seek[i]); |
1339 | } | 1339 | } |
1340 | } | 1340 | } |
@@ -1345,15 +1345,15 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1345 | for (i = 0; i <= level; i++) | 1345 | for (i = 0; i <= level; i++) |
1346 | { | 1346 | { |
1347 | int j; | 1347 | int j; |
1348 | 1348 | ||
1349 | for (j = 0; j < csi->clause_count[i]; j++) | 1349 | for (j = 0; j < csi->clause_count[i]; j++) |
1350 | tagcache_search_add_clause(&tcs, csi->clause[i][j]); | 1350 | tagcache_search_add_clause(&tcs, csi->clause[i][j]); |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | current_offset = offset; | 1353 | current_offset = offset; |
1354 | current_entry_count = 0; | 1354 | current_entry_count = 0; |
1355 | c->dirfull = false; | 1355 | c->dirfull = false; |
1356 | 1356 | ||
1357 | fmt = NULL; | 1357 | fmt = NULL; |
1358 | for (i = 0; i < format_count; i++) | 1358 | for (i = 0; i < format_count; i++) |
1359 | { | 1359 | { |
@@ -1374,7 +1374,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1374 | sort_limit = 0; | 1374 | sort_limit = 0; |
1375 | strip = 0; | 1375 | strip = 0; |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | /* lock buflib out due to possible yields */ | 1378 | /* lock buflib out due to possible yields */ |
1379 | tree_lock_cache(c); | 1379 | tree_lock_cache(c); |
1380 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); | 1380 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); |
@@ -1401,12 +1401,12 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1401 | 1401 | ||
1402 | total_count += 2; | 1402 | total_count += 2; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | while (tagcache_get_next(&tcs)) | 1405 | while (tagcache_get_next(&tcs)) |
1406 | { | 1406 | { |
1407 | if (total_count++ < offset) | 1407 | if (total_count++ < offset) |
1408 | continue; | 1408 | continue; |
1409 | 1409 | ||
1410 | dptr->newtable = NAVIBROWSE; | 1410 | dptr->newtable = NAVIBROWSE; |
1411 | if (tag == tag_title || tag == tag_filename) | 1411 | if (tag == tag_title || tag == tag_filename) |
1412 | { | 1412 | { |
@@ -1415,7 +1415,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1415 | } | 1415 | } |
1416 | else | 1416 | else |
1417 | dptr->extraseek = tcs.result_seek; | 1417 | dptr->extraseek = tcs.result_seek; |
1418 | 1418 | ||
1419 | fmt = NULL; | 1419 | fmt = NULL; |
1420 | /* Check the format */ | 1420 | /* Check the format */ |
1421 | tagtree_lock(); | 1421 | tagtree_lock(); |
@@ -1423,7 +1423,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1423 | { | 1423 | { |
1424 | if (formats[i]->group_id != csi->format_id[level]) | 1424 | if (formats[i]->group_id != csi->format_id[level]) |
1425 | continue; | 1425 | continue; |
1426 | 1426 | ||
1427 | if (tagcache_check_clauses(&tcs, formats[i]->clause, | 1427 | if (tagcache_check_clauses(&tcs, formats[i]->clause, |
1428 | formats[i]->clause_count)) | 1428 | formats[i]->clause_count)) |
1429 | { | 1429 | { |
@@ -1439,11 +1439,11 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1439 | tcs.result_len = strlen(tcs.result); | 1439 | tcs.result_len = strlen(tcs.result); |
1440 | tcs.ramresult = true; | 1440 | tcs.ramresult = true; |
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | if (!tcs.ramresult || fmt) | 1443 | if (!tcs.ramresult || fmt) |
1444 | { | 1444 | { |
1445 | dptr->name = core_get_data(c->cache.name_buffer_handle)+namebufused; | 1445 | dptr->name = core_get_data(c->cache.name_buffer_handle)+namebufused; |
1446 | 1446 | ||
1447 | if (fmt) | 1447 | if (fmt) |
1448 | { | 1448 | { |
1449 | int ret = format_str(&tcs, fmt, dptr->name, | 1449 | int ret = format_str(&tcs, fmt, dptr->name, |
@@ -1482,7 +1482,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1482 | } | 1482 | } |
1483 | else | 1483 | else |
1484 | dptr->name = tcs.result; | 1484 | dptr->name = tcs.result; |
1485 | 1485 | ||
1486 | dptr++; | 1486 | dptr++; |
1487 | current_entry_count++; | 1487 | current_entry_count++; |
1488 | 1488 | ||
@@ -1493,7 +1493,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1493 | sort = false; | 1493 | sort = false; |
1494 | break ; | 1494 | break ; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | if (init && !tcs.ramsearch) | 1497 | if (init && !tcs.ramsearch) |
1498 | { | 1498 | { |
1499 | if (!show_search_progress(false, total_count)) | 1499 | if (!show_search_progress(false, total_count)) |
@@ -1505,7 +1505,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1505 | } | 1505 | } |
1506 | } | 1506 | } |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | if (sort) | 1509 | if (sort) |
1510 | { | 1510 | { |
1511 | struct tagentry *entries = get_entries(c); | 1511 | struct tagentry *entries = get_entries(c); |
@@ -1513,7 +1513,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1513 | current_entry_count - special_entry_count, | 1513 | current_entry_count - special_entry_count, |
1514 | sizeof(struct tagentry), compare); | 1514 | sizeof(struct tagentry), compare); |
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | if (!init) | 1517 | if (!init) |
1518 | { | 1518 | { |
1519 | tagcache_search_finish(&tcs); | 1519 | tagcache_search_finish(&tcs); |
@@ -1521,7 +1521,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1521 | tagtree_unlock(); | 1521 | tagtree_unlock(); |
1522 | return current_entry_count; | 1522 | return current_entry_count; |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | while (tagcache_get_next(&tcs)) | 1525 | while (tagcache_get_next(&tcs)) |
1526 | { | 1526 | { |
1527 | if (!tcs.ramsearch) | 1527 | if (!tcs.ramsearch) |
@@ -1531,7 +1531,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1531 | } | 1531 | } |
1532 | total_count++; | 1532 | total_count++; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | tagcache_search_finish(&tcs); | 1535 | tagcache_search_finish(&tcs); |
1536 | tree_unlock_cache(c); | 1536 | tree_unlock_cache(c); |
1537 | tagtree_unlock(); | 1537 | tagtree_unlock(); |
@@ -1542,42 +1542,42 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1542 | logf("Too small dir buffer"); | 1542 | logf("Too small dir buffer"); |
1543 | return 0; | 1543 | return 0; |
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | if (sort_limit) | 1546 | if (sort_limit) |
1547 | total_count = MIN(total_count, sort_limit); | 1547 | total_count = MIN(total_count, sort_limit); |
1548 | 1548 | ||
1549 | if (strip) | 1549 | if (strip) |
1550 | { | 1550 | { |
1551 | dptr = get_entries(c); | 1551 | dptr = get_entries(c); |
1552 | for (i = special_entry_count; i < current_entry_count; i++, dptr++) | 1552 | for (i = special_entry_count; i < current_entry_count; i++, dptr++) |
1553 | { | 1553 | { |
1554 | int len = strlen(dptr->name); | 1554 | int len = strlen(dptr->name); |
1555 | 1555 | ||
1556 | if (len < strip) | 1556 | if (len < strip) |
1557 | continue; | 1557 | continue; |
1558 | 1558 | ||
1559 | dptr->name = &dptr->name[strip]; | 1559 | dptr->name = &dptr->name[strip]; |
1560 | } | 1560 | } |
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | return total_count; | 1563 | return total_count; |
1564 | 1564 | ||
1565 | } | 1565 | } |
1566 | 1566 | ||
1567 | static int load_root(struct tree_context *c) | 1567 | static int load_root(struct tree_context *c) |
1568 | { | 1568 | { |
1569 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); | 1569 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); |
1570 | int i; | 1570 | int i; |
1571 | 1571 | ||
1572 | tc = c; | 1572 | tc = c; |
1573 | c->currtable = ROOT; | 1573 | c->currtable = ROOT; |
1574 | if (c->dirlevel == 0) | 1574 | if (c->dirlevel == 0) |
1575 | c->currextra = rootmenu; | 1575 | c->currextra = rootmenu; |
1576 | 1576 | ||
1577 | menu = menus[c->currextra]; | 1577 | menu = menus[c->currextra]; |
1578 | if (menu == NULL) | 1578 | if (menu == NULL) |
1579 | return 0; | 1579 | return 0; |
1580 | 1580 | ||
1581 | for (i = 0; i < menu->itemcount; i++) | 1581 | for (i = 0; i < menu->itemcount; i++) |
1582 | { | 1582 | { |
1583 | dptr->name = menu->items[i]->name; | 1583 | dptr->name = menu->items[i]->name; |
@@ -1587,7 +1587,7 @@ static int load_root(struct tree_context *c) | |||
1587 | dptr->newtable = NAVIBROWSE; | 1587 | dptr->newtable = NAVIBROWSE; |
1588 | dptr->extraseek = i; | 1588 | dptr->extraseek = i; |
1589 | break; | 1589 | break; |
1590 | 1590 | ||
1591 | case menu_load: | 1591 | case menu_load: |
1592 | dptr->newtable = ROOT; | 1592 | dptr->newtable = ROOT; |
1593 | dptr->extraseek = menu->items[i]->link; | 1593 | dptr->extraseek = menu->items[i]->link; |
@@ -1596,10 +1596,10 @@ static int load_root(struct tree_context *c) | |||
1596 | 1596 | ||
1597 | dptr++; | 1597 | dptr++; |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | current_offset = 0; | 1600 | current_offset = 0; |
1601 | current_entry_count = i; | 1601 | current_entry_count = i; |
1602 | 1602 | ||
1603 | return i; | 1603 | return i; |
1604 | } | 1604 | } |
1605 | 1605 | ||
@@ -1607,7 +1607,7 @@ int tagtree_load(struct tree_context* c) | |||
1607 | { | 1607 | { |
1608 | int count; | 1608 | int count; |
1609 | int table = c->currtable; | 1609 | int table = c->currtable; |
1610 | 1610 | ||
1611 | c->dirsindir = 0; | 1611 | c->dirsindir = 0; |
1612 | 1612 | ||
1613 | if (!table) | 1613 | if (!table) |
@@ -1618,7 +1618,7 @@ int tagtree_load(struct tree_context* c) | |||
1618 | c->currextra = rootmenu; | 1618 | c->currextra = rootmenu; |
1619 | } | 1619 | } |
1620 | 1620 | ||
1621 | switch (table) | 1621 | switch (table) |
1622 | { | 1622 | { |
1623 | case ROOT: | 1623 | case ROOT: |
1624 | count = load_root(c); | 1624 | count = load_root(c); |
@@ -1631,12 +1631,12 @@ int tagtree_load(struct tree_context* c) | |||
1631 | count = retrieve_entries(c, 0, true); | 1631 | count = retrieve_entries(c, 0, true); |
1632 | cpu_boost(false); | 1632 | cpu_boost(false); |
1633 | break; | 1633 | break; |
1634 | 1634 | ||
1635 | default: | 1635 | default: |
1636 | logf("Unsupported table %d\n", table); | 1636 | logf("Unsupported table %d\n", table); |
1637 | return -1; | 1637 | return -1; |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | if (count < 0) | 1640 | if (count < 0) |
1641 | { | 1641 | { |
1642 | c->dirlevel = 0; | 1642 | c->dirlevel = 0; |
@@ -1646,7 +1646,7 @@ int tagtree_load(struct tree_context* c) | |||
1646 | 1646 | ||
1647 | /* The _total_ numer of entries available. */ | 1647 | /* The _total_ numer of entries available. */ |
1648 | c->dirlength = c->filesindir = count; | 1648 | c->dirlength = c->filesindir = count; |
1649 | 1649 | ||
1650 | return count; | 1650 | return count; |
1651 | } | 1651 | } |
1652 | 1652 | ||
@@ -1660,10 +1660,10 @@ int tagtree_enter(struct tree_context* c) | |||
1660 | int source; | 1660 | int source; |
1661 | 1661 | ||
1662 | dptr = tagtree_get_entry(c, c->selected_item); | 1662 | dptr = tagtree_get_entry(c, c->selected_item); |
1663 | 1663 | ||
1664 | c->dirfull = false; | 1664 | c->dirfull = false; |
1665 | seek = dptr->extraseek; | 1665 | seek = dptr->extraseek; |
1666 | if (seek == -1) | 1666 | if (seek == -1) |
1667 | { | 1667 | { |
1668 | if(c->filesindir<=2) | 1668 | if(c->filesindir<=2) |
1669 | return 0; | 1669 | return 0; |
@@ -1685,27 +1685,27 @@ int tagtree_enter(struct tree_context* c) | |||
1685 | /* lock buflib for possible I/O to protect dptr */ | 1685 | /* lock buflib for possible I/O to protect dptr */ |
1686 | tree_lock_cache(c); | 1686 | tree_lock_cache(c); |
1687 | tagtree_lock(); | 1687 | tagtree_lock(); |
1688 | 1688 | ||
1689 | switch (c->currtable) { | 1689 | switch (c->currtable) { |
1690 | case ROOT: | 1690 | case ROOT: |
1691 | c->currextra = newextra; | 1691 | c->currextra = newextra; |
1692 | 1692 | ||
1693 | if (newextra == ROOT) | 1693 | if (newextra == ROOT) |
1694 | { | 1694 | { |
1695 | menu = menus[seek]; | 1695 | menu = menus[seek]; |
1696 | c->currextra = seek; | 1696 | c->currextra = seek; |
1697 | } | 1697 | } |
1698 | 1698 | ||
1699 | else if (newextra == NAVIBROWSE) | 1699 | else if (newextra == NAVIBROWSE) |
1700 | { | 1700 | { |
1701 | int i, j; | 1701 | int i, j; |
1702 | 1702 | ||
1703 | csi = &menu->items[seek]->si; | 1703 | csi = &menu->items[seek]->si; |
1704 | c->currextra = 0; | 1704 | c->currextra = 0; |
1705 | 1705 | ||
1706 | strlcpy(current_title[c->currextra], dptr->name, | 1706 | strlcpy(current_title[c->currextra], dptr->name, |
1707 | sizeof(current_title[0])); | 1707 | sizeof(current_title[0])); |
1708 | 1708 | ||
1709 | /* Read input as necessary. */ | 1709 | /* Read input as necessary. */ |
1710 | for (i = 0; i < csi->tagorder_count; i++) | 1710 | for (i = 0; i < csi->tagorder_count; i++) |
1711 | { | 1711 | { |
@@ -1717,13 +1717,13 @@ int tagtree_enter(struct tree_context* c) | |||
1717 | continue; | 1717 | continue; |
1718 | 1718 | ||
1719 | source = csi->clause[i][j]->source; | 1719 | source = csi->clause[i][j]->source; |
1720 | 1720 | ||
1721 | if (source == source_constant) | 1721 | if (source == source_constant) |
1722 | continue; | 1722 | continue; |
1723 | 1723 | ||
1724 | searchstring=csi->clause[i][j]->str; | 1724 | searchstring=csi->clause[i][j]->str; |
1725 | *searchstring = '\0'; | 1725 | *searchstring = '\0'; |
1726 | 1726 | ||
1727 | id3 = audio_current_track(); | 1727 | id3 = audio_current_track(); |
1728 | 1728 | ||
1729 | if (source == source_current_path && id3) | 1729 | if (source == source_current_path && id3) |
@@ -1736,7 +1736,7 @@ int tagtree_enter(struct tree_context* c) | |||
1736 | } | 1736 | } |
1737 | else if (source > source_runtime && id3) | 1737 | else if (source > source_runtime && id3) |
1738 | { | 1738 | { |
1739 | 1739 | ||
1740 | int k = source-source_runtime; | 1740 | int k = source-source_runtime; |
1741 | int offset = id3_to_search_mapping[k].id3_offset; | 1741 | int offset = id3_to_search_mapping[k].id3_offset; |
1742 | char **src = (char**)((char*)id3 + offset); | 1742 | char **src = (char**)((char*)id3 + offset); |
@@ -1757,9 +1757,9 @@ int tagtree_enter(struct tree_context* c) | |||
1757 | } | 1757 | } |
1758 | if (csi->clause[i][j]->numeric) | 1758 | if (csi->clause[i][j]->numeric) |
1759 | csi->clause[i][j]->numeric_data = atoi(searchstring); | 1759 | csi->clause[i][j]->numeric_data = atoi(searchstring); |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | 1762 | ||
1763 | } | 1763 | } |
1764 | } | 1764 | } |
1765 | } | 1765 | } |
@@ -1791,18 +1791,18 @@ int tagtree_enter(struct tree_context* c) | |||
1791 | c->currextra++; | 1791 | c->currextra++; |
1792 | else | 1792 | else |
1793 | c->dirlevel--; | 1793 | c->dirlevel--; |
1794 | 1794 | ||
1795 | /* Update the statusbar title */ | 1795 | /* Update the statusbar title */ |
1796 | strlcpy(current_title[c->currextra], dptr->name, | 1796 | strlcpy(current_title[c->currextra], dptr->name, |
1797 | sizeof(current_title[0])); | 1797 | sizeof(current_title[0])); |
1798 | break; | 1798 | break; |
1799 | 1799 | ||
1800 | default: | 1800 | default: |
1801 | c->dirlevel--; | 1801 | c->dirlevel--; |
1802 | break; | 1802 | break; |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | 1805 | ||
1806 | c->selected_item=0; | 1806 | c->selected_item=0; |
1807 | gui_synclist_select_item(&tree_lists, c->selected_item); | 1807 | gui_synclist_select_item(&tree_lists, c->selected_item); |
1808 | tree_unlock_cache(c); | 1808 | tree_unlock_cache(c); |
@@ -1827,7 +1827,7 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen) | |||
1827 | { | 1827 | { |
1828 | struct tagcache_search tcs; | 1828 | struct tagcache_search tcs; |
1829 | int extraseek = tagtree_get_entry(c, c->selected_item)->extraseek; | 1829 | int extraseek = tagtree_get_entry(c, c->selected_item)->extraseek; |
1830 | 1830 | ||
1831 | 1831 | ||
1832 | if (!tagcache_search(&tcs, tag_filename)) | 1832 | if (!tagcache_search(&tcs, tag_filename)) |
1833 | return -1; | 1833 | return -1; |
@@ -1839,7 +1839,7 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen) | |||
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | tagcache_search_finish(&tcs); | 1841 | tagcache_search_finish(&tcs); |
1842 | 1842 | ||
1843 | return 0; | 1843 | return 0; |
1844 | } | 1844 | } |
1845 | 1845 | ||
@@ -1858,7 +1858,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
1858 | cpu_boost(false); | 1858 | cpu_boost(false); |
1859 | return false; | 1859 | return false; |
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | if (position == PLAYLIST_REPLACE) | 1862 | if (position == PLAYLIST_REPLACE) |
1863 | { | 1863 | { |
1864 | if (playlist_remove_all_tracks(NULL) == 0) | 1864 | if (playlist_remove_all_tracks(NULL) == 0) |
@@ -1882,14 +1882,14 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
1882 | to = c->filesindir; | 1882 | to = c->filesindir; |
1883 | direction = 1; | 1883 | direction = 1; |
1884 | } | 1884 | } |
1885 | 1885 | ||
1886 | for (i = from; i != to; i += direction) | 1886 | for (i = from; i != to; i += direction) |
1887 | { | 1887 | { |
1888 | /* Count back to zero */ | 1888 | /* Count back to zero */ |
1889 | if (!show_search_progress(false, files_left--)) | 1889 | if (!show_search_progress(false, files_left--)) |
1890 | break; | 1890 | break; |
1891 | 1891 | ||
1892 | if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->extraseek, | 1892 | if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->extraseek, |
1893 | tcs.type, buf, sizeof buf)) | 1893 | tcs.type, buf, sizeof buf)) |
1894 | { | 1894 | { |
1895 | continue; | 1895 | continue; |
@@ -1905,7 +1905,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
1905 | playlist_sync(NULL); | 1905 | playlist_sync(NULL); |
1906 | tagcache_search_finish(&tcs); | 1906 | tagcache_search_finish(&tcs); |
1907 | cpu_boost(false); | 1907 | cpu_boost(false); |
1908 | 1908 | ||
1909 | return true; | 1909 | return true; |
1910 | } | 1910 | } |
1911 | 1911 | ||
@@ -1923,10 +1923,10 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1923 | #endif | 1923 | #endif |
1924 | , 0); | 1924 | , 0); |
1925 | 1925 | ||
1926 | 1926 | ||
1927 | /* We need to set the table to allsubentries. */ | 1927 | /* We need to set the table to allsubentries. */ |
1928 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; | 1928 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; |
1929 | 1929 | ||
1930 | /* Insert a single track? */ | 1930 | /* Insert a single track? */ |
1931 | if (newtable == PLAYTRACK) | 1931 | if (newtable == PLAYTRACK) |
1932 | { | 1932 | { |
@@ -1936,10 +1936,10 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1936 | return false; | 1936 | return false; |
1937 | } | 1937 | } |
1938 | playlist_insert_track(NULL, buf, position, queue, true); | 1938 | playlist_insert_track(NULL, buf, position, queue, true); |
1939 | 1939 | ||
1940 | return true; | 1940 | return true; |
1941 | } | 1941 | } |
1942 | 1942 | ||
1943 | if (newtable == NAVIBROWSE) | 1943 | if (newtable == NAVIBROWSE) |
1944 | { | 1944 | { |
1945 | tagtree_enter(tc); | 1945 | tagtree_enter(tc); |
@@ -1951,14 +1951,14 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1951 | logf("unsupported table: %d", newtable); | 1951 | logf("unsupported table: %d", newtable); |
1952 | return false; | 1952 | return false; |
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | /* Now the current table should be allsubentries. */ | 1955 | /* Now the current table should be allsubentries. */ |
1956 | if (newtable != PLAYTRACK) | 1956 | if (newtable != PLAYTRACK) |
1957 | { | 1957 | { |
1958 | tagtree_enter(tc); | 1958 | tagtree_enter(tc); |
1959 | tagtree_load(tc); | 1959 | tagtree_load(tc); |
1960 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; | 1960 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; |
1961 | 1961 | ||
1962 | /* And now the newtable should be playtrack. */ | 1962 | /* And now the newtable should be playtrack. */ |
1963 | if (newtable != PLAYTRACK) | 1963 | if (newtable != PLAYTRACK) |
1964 | { | 1964 | { |
@@ -1976,12 +1976,12 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1976 | if (!insert_all_playlist(tc, position, queue)) | 1976 | if (!insert_all_playlist(tc, position, queue)) |
1977 | splash(HZ*2, ID2P(LANG_FAILED)); | 1977 | splash(HZ*2, ID2P(LANG_FAILED)); |
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | /* Finally return the dirlevel to its original value. */ | 1980 | /* Finally return the dirlevel to its original value. */ |
1981 | while (tc->dirlevel > dirlevel) | 1981 | while (tc->dirlevel > dirlevel) |
1982 | tagtree_exit(tc); | 1982 | tagtree_exit(tc); |
1983 | tagtree_load(tc); | 1983 | tagtree_load(tc); |
1984 | 1984 | ||
1985 | return true; | 1985 | return true; |
1986 | } | 1986 | } |
1987 | 1987 | ||
@@ -1995,7 +1995,7 @@ static int tagtree_play_folder(struct tree_context* c) | |||
1995 | 1995 | ||
1996 | if (!insert_all_playlist(c, PLAYLIST_INSERT_LAST, false)) | 1996 | if (!insert_all_playlist(c, PLAYLIST_INSERT_LAST, false)) |
1997 | return -2; | 1997 | return -2; |
1998 | 1998 | ||
1999 | if (global_settings.playlist_shuffle) | 1999 | if (global_settings.playlist_shuffle) |
2000 | c->selected_item = playlist_shuffle(current_tick, c->selected_item); | 2000 | c->selected_item = playlist_shuffle(current_tick, c->selected_item); |
2001 | if (!global_settings.play_selected) | 2001 | if (!global_settings.play_selected) |
@@ -2011,7 +2011,7 @@ static struct tagentry* tagtree_get_entry(struct tree_context *c, int id) | |||
2011 | { | 2011 | { |
2012 | struct tagentry *entry; | 2012 | struct tagentry *entry; |
2013 | int realid = id - current_offset; | 2013 | int realid = id - current_offset; |
2014 | 2014 | ||
2015 | /* Load the next chunk if necessary. */ | 2015 | /* Load the next chunk if necessary. */ |
2016 | if (realid >= current_entry_count || realid < 0) | 2016 | if (realid >= current_entry_count || realid < 0) |
2017 | { | 2017 | { |
@@ -2048,12 +2048,12 @@ char *tagtree_get_title(struct tree_context* c) | |||
2048 | { | 2048 | { |
2049 | case ROOT: | 2049 | case ROOT: |
2050 | return menu->title; | 2050 | return menu->title; |
2051 | 2051 | ||
2052 | case NAVIBROWSE: | 2052 | case NAVIBROWSE: |
2053 | case ALLSUBENTRIES: | 2053 | case ALLSUBENTRIES: |
2054 | return current_title[c->currextra]; | 2054 | return current_title[c->currextra]; |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | return "?"; | 2057 | return "?"; |
2058 | } | 2058 | } |
2059 | 2059 | ||
@@ -2072,7 +2072,7 @@ int tagtree_get_attr(struct tree_context* c) | |||
2072 | case ALLSUBENTRIES: | 2072 | case ALLSUBENTRIES: |
2073 | attr = FILE_ATTR_AUDIO; | 2073 | attr = FILE_ATTR_AUDIO; |
2074 | break; | 2074 | break; |
2075 | 2075 | ||
2076 | default: | 2076 | default: |
2077 | attr = ATTR_DIRECTORY; | 2077 | attr = ATTR_DIRECTORY; |
2078 | break; | 2078 | break; |