summaryrefslogtreecommitdiff
path: root/apps/gui/wps.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r--apps/gui/wps.c52
1 files changed, 22 insertions, 30 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index b4c3f40e9f..d1161ea71d 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -74,8 +74,7 @@
74 74
75/* initial setup of wps_data */ 75/* initial setup of wps_data */
76static void wps_state_init(void); 76static void wps_state_init(void);
77static void track_changed_callback(void *param); 77static void track_info_callback(unsigned short id, void *param);
78static void nextid3available_callback(void* param);
79 78
80#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps" 79#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
81#ifdef HAVE_REMOTE_LCD 80#ifdef HAVE_REMOTE_LCD
@@ -626,8 +625,9 @@ static void play_hop(int direction)
626 * we suppress updates until the wps is activated again (the lcd driver will 625 * we suppress updates until the wps is activated again (the lcd driver will
627 * call this hook to issue an instant update) 626 * call this hook to issue an instant update)
628 * */ 627 * */
629static void wps_lcd_activation_hook(void *param) 628static void wps_lcd_activation_hook(unsigned short id, void *param)
630{ 629{
630 (void)id;
631 (void)param; 631 (void)param;
632 skin_request_full_update(WPS); 632 skin_request_full_update(WPS);
633 /* force timeout in wps main loop, so that the update is instantly */ 633 /* force timeout in wps main loop, so that the update is instantly */
@@ -1119,7 +1119,7 @@ long gui_wps_show(void)
1119 restore = false; 1119 restore = false;
1120 restoretimer = RESTORE_WPS_INSTANTLY; 1120 restoretimer = RESTORE_WPS_INSTANTLY;
1121#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 1121#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
1122 add_event(LCD_EVENT_ACTIVATION, false, wps_lcd_activation_hook); 1122 add_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook);
1123#endif 1123#endif
1124 /* we remove the update delay since it's not very usable in the wps, 1124 /* we remove the update delay since it's not very usable in the wps,
1125 * e.g. during volume changing or ffwd/rewind */ 1125 * e.g. during volume changing or ffwd/rewind */
@@ -1187,35 +1187,27 @@ long gui_wps_show(void)
1187} 1187}
1188 1188
1189/* this is called from the playback thread so NO DRAWING! */ 1189/* this is called from the playback thread so NO DRAWING! */
1190static void track_changed_callback(void *param) 1190static void track_info_callback(unsigned short id, void *param)
1191{ 1191{
1192 struct wps_state *state = skin_get_global_state(); 1192 struct wps_state *state = skin_get_global_state();
1193 state->id3 = ((struct track_event *)param)->id3; 1193
1194 state->nid3 = audio_next_track(); 1194 if (id == PLAYBACK_EVENT_TRACK_CHANGE || id == PLAYBACK_EVENT_CUR_TRACK_READY)
1195 if (state->id3->cuesheet)
1196 { 1195 {
1197 cue_find_current_track(state->id3->cuesheet, state->id3->elapsed); 1196 state->id3 = ((struct track_event *)param)->id3;
1197 if (state->id3->cuesheet)
1198 {
1199 cue_find_current_track(state->id3->cuesheet, state->id3->elapsed);
1200 }
1198 } 1201 }
1199 skin_request_full_update(WPS);
1200}
1201static void nextid3available_callback(void* param)
1202{
1203 (void)param;
1204 skin_get_global_state()->nid3 = audio_next_track();
1205 skin_request_full_update(WPS);
1206}
1207
1208#ifdef AUDIO_FAST_SKIP_PREVIEW 1202#ifdef AUDIO_FAST_SKIP_PREVIEW
1209/* this is called on the audio_skip caller thread */ 1203 else if (id == PLAYBACK_EVENT_TRACK_SKIP)
1210static void track_skip_callback(void *param) 1204 {
1211{ 1205 state->id3 = audio_current_track();
1212 struct wps_state *state = skin_get_global_state(); 1206 }
1213 state->id3 = audio_current_track(); 1207#endif
1214 state->nid3 = audio_next_track(); 1208 skin_get_global_state()->nid3 = audio_next_track();
1215 skin_request_full_update(WPS); 1209 skin_request_full_update(WPS);
1216 (void)param;
1217} 1210}
1218#endif /* AUDIO_FAST_SKIP_PREVIEW */
1219 1211
1220static void wps_state_init(void) 1212static void wps_state_init(void)
1221{ 1213{
@@ -1235,15 +1227,15 @@ static void wps_state_init(void)
1235 /* We'll be updating due to restore initialized with true */ 1227 /* We'll be updating due to restore initialized with true */
1236 skin_request_full_update(WPS); 1228 skin_request_full_update(WPS);
1237 /* add the WPS track event callbacks */ 1229 /* add the WPS track event callbacks */
1238 add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, track_changed_callback); 1230 add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_info_callback);
1239 add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false, nextid3available_callback); 1231 add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, track_info_callback);
1240#if CONFIG_CODEC == SWCODEC 1232#if CONFIG_CODEC == SWCODEC
1241 /* Use the same callback as ..._TRACK_CHANGE for when remaining handles have 1233 /* Use the same callback as ..._TRACK_CHANGE for when remaining handles have
1242 finished */ 1234 finished */
1243 add_event(PLAYBACK_EVENT_CUR_TRACK_READY, false, track_changed_callback); 1235 add_event(PLAYBACK_EVENT_CUR_TRACK_READY, track_info_callback);
1244#endif 1236#endif
1245#ifdef AUDIO_FAST_SKIP_PREVIEW 1237#ifdef AUDIO_FAST_SKIP_PREVIEW
1246 add_event(PLAYBACK_EVENT_TRACK_SKIP, false, track_skip_callback); 1238 add_event(PLAYBACK_EVENT_TRACK_SKIP, track_info_callback);
1247#endif 1239#endif
1248} 1240}
1249 1241