diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 6 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.c | 6 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.h | 1 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_render.c | 5 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 9 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 22 | ||||
-rw-r--r-- | apps/gui/wps.c | 57 | ||||
-rw-r--r-- | apps/gui/wps.h | 13 | ||||
-rw-r--r-- | apps/radio/radio.c | 6 |
9 files changed, 59 insertions, 66 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 3e3f203f9a..49375829e6 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -65,7 +65,7 @@ | |||
65 | #endif | 65 | #endif |
66 | #include "root_menu.h" | 66 | #include "root_menu.h" |
67 | 67 | ||
68 | 68 | #include "wps.h" | |
69 | #include "wps_internals.h" | 69 | #include "wps_internals.h" |
70 | #include "skin_engine.h" | 70 | #include "skin_engine.h" |
71 | #include "statusbar-skinned.h" | 71 | #include "statusbar-skinned.h" |
@@ -83,7 +83,7 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen, | |||
83 | struct gui_wps *gwps = skin_get_gwps(skin, screen); | 83 | struct gui_wps *gwps = skin_get_gwps(skin, screen); |
84 | /* This maybe shouldnt be here, | 84 | /* This maybe shouldnt be here, |
85 | * This is also safe for skined screen which dont use the id3 */ | 85 | * This is also safe for skined screen which dont use the id3 */ |
86 | struct mp3entry *id3 = skin_get_global_state()->id3; | 86 | struct mp3entry *id3 = get_wps_state()->id3; |
87 | bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); | 87 | bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); |
88 | if (cuesheet_update) | 88 | if (cuesheet_update) |
89 | skin_request_full_update(skin); | 89 | skin_request_full_update(skin); |
@@ -162,7 +162,7 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) | |||
162 | { | 162 | { |
163 | struct screen *display = gwps->display; | 163 | struct screen *display = gwps->display; |
164 | struct viewport *vp = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->vp); | 164 | struct viewport *vp = SKINOFFSETTOPTR(get_skin_buffer(gwps->data), pb->vp); |
165 | struct wps_state *state = skin_get_global_state(); | 165 | struct wps_state *state = get_wps_state(); |
166 | struct mp3entry *id3 = state->id3; | 166 | struct mp3entry *id3 = state->id3; |
167 | int x = pb->x, y = pb->y, width = pb->width, height = pb->height; | 167 | int x = pb->x, y = pb->y, width = pb->width, height = pb->height; |
168 | unsigned long length, end; | 168 | unsigned long length, end; |
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c index a3ad85fd6e..c007ed35d4 100644 --- a/apps/gui/skin_engine/skin_engine.c +++ b/apps/gui/skin_engine/skin_engine.c | |||
@@ -53,7 +53,6 @@ static bool skins_initialised = false; | |||
53 | static char* get_skin_filename(char *buf, size_t buf_size, | 53 | static char* get_skin_filename(char *buf, size_t buf_size, |
54 | enum skinnable_screens skin, enum screen_type screen); | 54 | enum skinnable_screens skin, enum screen_type screen); |
55 | 55 | ||
56 | struct wps_state wps_state = { .id3 = NULL }; | ||
57 | static struct gui_skin_helper { | 56 | static struct gui_skin_helper { |
58 | int (*preproccess)(enum screen_type screen, struct wps_data *data); | 57 | int (*preproccess)(enum screen_type screen, struct wps_data *data); |
59 | int (*postproccess)(enum screen_type screen, struct wps_data *data); | 58 | int (*postproccess)(enum screen_type screen, struct wps_data *data); |
@@ -310,11 +309,6 @@ struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type scre | |||
310 | return &skins[skin][screen].gui_wps; | 309 | return &skins[skin][screen].gui_wps; |
311 | } | 310 | } |
312 | 311 | ||
313 | struct wps_state *skin_get_global_state(void) | ||
314 | { | ||
315 | return &wps_state; | ||
316 | } | ||
317 | |||
318 | /* This is called to find out if we the screen needs a full update. | 312 | /* This is called to find out if we the screen needs a full update. |
319 | * if true you MUST do a full update as the next call will return false */ | 313 | * if true you MUST do a full update as the next call will return false */ |
320 | bool skin_do_full_update(enum skinnable_screens skin, | 314 | bool skin_do_full_update(enum skinnable_screens skin, |
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h index d7efb5b888..a685f4f072 100644 --- a/apps/gui/skin_engine/skin_engine.h +++ b/apps/gui/skin_engine/skin_engine.h | |||
@@ -85,7 +85,6 @@ int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout); | |||
85 | void skin_load(enum skinnable_screens skin, enum screen_type screen, | 85 | void skin_load(enum skinnable_screens skin, enum screen_type screen, |
86 | const char *buf, bool isfile); | 86 | const char *buf, bool isfile); |
87 | struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type screen); | 87 | struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type screen); |
88 | struct wps_state *skin_get_global_state(void); | ||
89 | void gui_sync_skin_init(void); | 88 | void gui_sync_skin_init(void); |
90 | 89 | ||
91 | void skin_unload_all(void); | 90 | void skin_unload_all(void); |
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 2238bd9bec..e5d2078177 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include "root_menu.h" | 50 | #include "root_menu.h" |
51 | #include "misc.h" | 51 | #include "misc.h" |
52 | #include "list.h" | 52 | #include "list.h" |
53 | #include "wps.h" | ||
53 | 54 | ||
54 | 55 | ||
55 | #define MAX_LINE 1024 | 56 | #define MAX_LINE 1024 |
@@ -956,8 +957,8 @@ void skin_render_playlistviewer(struct playlistviewer* viewer, | |||
956 | else | 957 | else |
957 | #endif | 958 | #endif |
958 | { | 959 | { |
959 | struct cuesheet *cue = skin_get_global_state()->id3 ? | 960 | struct wps_state *state = get_wps_state(); |
960 | skin_get_global_state()->id3->cuesheet : NULL; | 961 | struct cuesheet *cue = state->id3 ? state->id3->cuesheet : NULL; |
961 | cur_pos = playlist_get_display_index(); | 962 | cur_pos = playlist_get_display_index(); |
962 | max = playlist_amount()+1; | 963 | max = playlist_amount()+1; |
963 | if (cue) | 964 | if (cue) |
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 0101a5e01e..a1d0a4b840 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -66,11 +66,10 @@ | |||
66 | #include "fixedpoint.h" | 66 | #include "fixedpoint.h" |
67 | #endif | 67 | #endif |
68 | #include "list.h" | 68 | #include "list.h" |
69 | #include "wps.h" | ||
69 | 70 | ||
70 | #define NOINLINE __attribute__ ((noinline)) | 71 | #define NOINLINE __attribute__ ((noinline)) |
71 | 72 | ||
72 | extern struct wps_state wps_state; | ||
73 | |||
74 | static const char* get_codectype(const struct mp3entry* id3) | 73 | static const char* get_codectype(const struct mp3entry* id3) |
75 | { | 74 | { |
76 | if (id3 && id3->codectype < AFMT_NUM_CODECS) { | 75 | if (id3 && id3->codectype < AFMT_NUM_CODECS) { |
@@ -228,7 +227,7 @@ static const char* get_filename_token(struct wps_token *token, char* filename, | |||
228 | const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, | 227 | const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, |
229 | char *filename, char *buf, int buf_size, int limit, int *intval) | 228 | char *filename, char *buf, int buf_size, int limit, int *intval) |
230 | { | 229 | { |
231 | struct wps_state *state = &wps_state; | 230 | struct wps_state *state = get_wps_state(); |
232 | if (id3) | 231 | if (id3) |
233 | { | 232 | { |
234 | unsigned long length = id3->length; | 233 | unsigned long length = id3->length; |
@@ -540,7 +539,7 @@ const char *get_radio_token(struct wps_token *token, int preset_offset, | |||
540 | static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) | 539 | static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) |
541 | { | 540 | { |
542 | struct mp3entry* pid3 = NULL; | 541 | struct mp3entry* pid3 = NULL; |
543 | struct wps_state *state = skin_get_global_state(); | 542 | struct wps_state *state = get_wps_state(); |
544 | struct cuesheet *cue = state->id3 ? state->id3->cuesheet : NULL; | 543 | struct cuesheet *cue = state->id3 ? state->id3->cuesheet : NULL; |
545 | const char *fname = NULL; | 544 | const char *fname = NULL; |
546 | if (cue && cue->curr_track_idx + offset < cue->track_count) | 545 | if (cue && cue->curr_track_idx + offset < cue->track_count) |
@@ -678,7 +677,7 @@ const char *get_token_value(struct gui_wps *gwps, | |||
678 | return NULL; | 677 | return NULL; |
679 | 678 | ||
680 | struct wps_data *data = gwps->data; | 679 | struct wps_data *data = gwps->data; |
681 | struct wps_state *state = skin_get_global_state(); | 680 | struct wps_state *state = get_wps_state(); |
682 | struct mp3entry *id3; /* Think very carefully about using this. | 681 | struct mp3entry *id3; /* Think very carefully about using this. |
683 | maybe get_id3_token() is the better place? */ | 682 | maybe get_id3_token() is the better place? */ |
684 | const char *out_text = NULL; | 683 | const char *out_text = NULL; |
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 2aedff752b..0ae2e24235 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -393,28 +393,6 @@ static inline char* get_skin_buffer(struct wps_data* data) | |||
393 | 393 | ||
394 | /* wps_data end */ | 394 | /* wps_data end */ |
395 | 395 | ||
396 | /* wps_state | ||
397 | holds the data which belongs to the current played track, | ||
398 | the track which will be played afterwards, current path to the track | ||
399 | and some status infos */ | ||
400 | struct wps_state | ||
401 | { | ||
402 | struct mp3entry* id3; | ||
403 | struct mp3entry* nid3; | ||
404 | int ff_rewind_count; | ||
405 | bool paused; | ||
406 | }; | ||
407 | |||
408 | /* change the ff/rew-status | ||
409 | if ff_rew = true then we are in skipping mode | ||
410 | else we are in normal mode */ | ||
411 | /* void wps_state_update_ff_rew(bool ff_rew); Currently unused */ | ||
412 | |||
413 | /* change the tag-information of the current played track | ||
414 | and the following track */ | ||
415 | /* void wps_state_update_id3_nid3(struct mp3entry *id3, struct mp3entry *nid3); Currently unused */ | ||
416 | /* wps_state end*/ | ||
417 | |||
418 | /* gui_wps | 396 | /* gui_wps |
419 | defines a wps with its data, state, | 397 | defines a wps with its data, state, |
420 | and the screen on which the wps-content should be drawn */ | 398 | and the screen on which the wps-content should be drawn */ |
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 53ece62e9c..2587542b00 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -70,6 +70,8 @@ | |||
70 | /* 3% of 30min file == 54s step size */ | 70 | /* 3% of 30min file == 54s step size */ |
71 | #define MIN_FF_REWIND_STEP 500 | 71 | #define MIN_FF_REWIND_STEP 500 |
72 | 72 | ||
73 | static struct wps_state wps_state; | ||
74 | |||
73 | /* initial setup of wps_data */ | 75 | /* initial setup of wps_data */ |
74 | static void wps_state_init(void); | 76 | static void wps_state_init(void); |
75 | static void track_info_callback(unsigned short id, void *param); | 77 | static void track_info_callback(unsigned short id, void *param); |
@@ -157,6 +159,7 @@ static int skintouch_to_wps(struct wps_data *data) | |||
157 | { | 159 | { |
158 | int offset = 0; | 160 | int offset = 0; |
159 | struct touchregion *region; | 161 | struct touchregion *region; |
162 | struct wps_state *gstate = get_wps_state(); | ||
160 | int button = skin_get_touchaction(data, &offset, ®ion); | 163 | int button = skin_get_touchaction(data, &offset, ®ion); |
161 | switch (button) | 164 | switch (button) |
162 | { | 165 | { |
@@ -179,9 +182,9 @@ static int skintouch_to_wps(struct wps_data *data) | |||
179 | return ACTION_WPS_HOTKEY; | 182 | return ACTION_WPS_HOTKEY; |
180 | #endif | 183 | #endif |
181 | case ACTION_TOUCH_SCROLLBAR: | 184 | case ACTION_TOUCH_SCROLLBAR: |
182 | skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/1000; | 185 | gstate->id3->elapsed = gstate->id3->length*offset/1000; |
183 | audio_pre_ff_rewind(); | 186 | audio_pre_ff_rewind(); |
184 | audio_ff_rewind(skin_get_global_state()->id3->elapsed); | 187 | audio_ff_rewind(gstate->id3->elapsed); |
185 | return ACTION_TOUCHSCREEN; | 188 | return ACTION_TOUCHSCREEN; |
186 | case ACTION_TOUCH_VOLUME: | 189 | case ACTION_TOUCH_VOLUME: |
187 | { | 190 | { |
@@ -209,6 +212,7 @@ static bool ffwd_rew(int button) | |||
209 | bool usb = false; | 212 | bool usb = false; |
210 | bool ff_rewind = false; | 213 | bool ff_rewind = false; |
211 | const long ff_rw_accel = (global_settings.ff_rewind_accel + 3); | 214 | const long ff_rw_accel = (global_settings.ff_rewind_accel + 3); |
215 | struct wps_state *gstate = get_wps_state(); | ||
212 | 216 | ||
213 | if (button == ACTION_NONE) | 217 | if (button == ACTION_NONE) |
214 | { | 218 | { |
@@ -228,15 +232,15 @@ static bool ffwd_rew(int button) | |||
228 | if (direction == 1) | 232 | if (direction == 1) |
229 | { | 233 | { |
230 | /* fast forwarding, calc max step relative to end */ | 234 | /* fast forwarding, calc max step relative to end */ |
231 | max_step = (skin_get_global_state()->id3->length - | 235 | max_step = (gstate->id3->length - |
232 | (skin_get_global_state()->id3->elapsed + | 236 | (gstate->id3->elapsed + |
233 | ff_rewind_count)) * | 237 | ff_rewind_count)) * |
234 | FF_REWIND_MAX_PERCENT / 100; | 238 | FF_REWIND_MAX_PERCENT / 100; |
235 | } | 239 | } |
236 | else | 240 | else |
237 | { | 241 | { |
238 | /* rewinding, calc max step relative to start */ | 242 | /* rewinding, calc max step relative to start */ |
239 | max_step = (skin_get_global_state()->id3->elapsed + ff_rewind_count) * | 243 | max_step = (gstate->id3->elapsed + ff_rewind_count) * |
240 | FF_REWIND_MAX_PERCENT / 100; | 244 | FF_REWIND_MAX_PERCENT / 100; |
241 | } | 245 | } |
242 | 246 | ||
@@ -253,7 +257,7 @@ static bool ffwd_rew(int button) | |||
253 | else | 257 | else |
254 | { | 258 | { |
255 | if ( (audio_status() & AUDIO_STATUS_PLAY) && | 259 | if ( (audio_status() & AUDIO_STATUS_PLAY) && |
256 | skin_get_global_state()->id3 && skin_get_global_state()->id3->length ) | 260 | gstate->id3 && gstate->id3->length ) |
257 | { | 261 | { |
258 | audio_pre_ff_rewind(); | 262 | audio_pre_ff_rewind(); |
259 | if (direction > 0) | 263 | if (direction > 0) |
@@ -270,19 +274,17 @@ static bool ffwd_rew(int button) | |||
270 | } | 274 | } |
271 | 275 | ||
272 | if (direction > 0) { | 276 | if (direction > 0) { |
273 | if ((skin_get_global_state()->id3->elapsed + ff_rewind_count) > | 277 | if ((gstate->id3->elapsed + ff_rewind_count) > gstate->id3->length) |
274 | skin_get_global_state()->id3->length) | 278 | ff_rewind_count = gstate->id3->length - gstate->id3->elapsed; |
275 | ff_rewind_count = skin_get_global_state()->id3->length - | ||
276 | skin_get_global_state()->id3->elapsed; | ||
277 | } | 279 | } |
278 | else { | 280 | else { |
279 | if ((int)(skin_get_global_state()->id3->elapsed + ff_rewind_count) < 0) | 281 | if ((int)(gstate->id3->elapsed + ff_rewind_count) < 0) |
280 | ff_rewind_count = -skin_get_global_state()->id3->elapsed; | 282 | ff_rewind_count = -gstate->id3->elapsed; |
281 | } | 283 | } |
282 | 284 | ||
283 | /* set the wps state ff_rewind_count so the progess info | 285 | /* set the wps state ff_rewind_count so the progess info |
284 | displays corectly */ | 286 | displays corectly */ |
285 | skin_get_global_state()->ff_rewind_count = ff_rewind_count; | 287 | gstate->ff_rewind_count = ff_rewind_count; |
286 | 288 | ||
287 | FOR_NB_SCREENS(i) | 289 | FOR_NB_SCREENS(i) |
288 | { | 290 | { |
@@ -294,9 +296,9 @@ static bool ffwd_rew(int button) | |||
294 | break; | 296 | break; |
295 | 297 | ||
296 | case ACTION_WPS_STOPSEEK: | 298 | case ACTION_WPS_STOPSEEK: |
297 | skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->elapsed+ff_rewind_count; | 299 | gstate->id3->elapsed = gstate->id3->elapsed+ff_rewind_count; |
298 | audio_ff_rewind(skin_get_global_state()->id3->elapsed); | 300 | audio_ff_rewind(gstate->id3->elapsed); |
299 | skin_get_global_state()->ff_rewind_count = 0; | 301 | gstate->ff_rewind_count = 0; |
300 | ff_rewind = false; | 302 | ff_rewind = false; |
301 | status_set_ffmode(0); | 303 | status_set_ffmode(0); |
302 | exit = true; | 304 | exit = true; |
@@ -328,7 +330,7 @@ static bool ffwd_rew(int button) | |||
328 | #if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) | 330 | #if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD) |
329 | static void gwps_caption_backlight(struct wps_state *state) | 331 | static void gwps_caption_backlight(struct wps_state *state) |
330 | { | 332 | { |
331 | if (state && state->id3) | 333 | if (state->id3) |
332 | { | 334 | { |
333 | #ifdef HAVE_BACKLIGHT | 335 | #ifdef HAVE_BACKLIGHT |
334 | if (global_settings.caption_backlight) | 336 | if (global_settings.caption_backlight) |
@@ -383,7 +385,7 @@ static void change_dir(int direction) | |||
383 | 385 | ||
384 | static void prev_track(unsigned long skip_thresh) | 386 | static void prev_track(unsigned long skip_thresh) |
385 | { | 387 | { |
386 | struct wps_state *state = skin_get_global_state(); | 388 | struct wps_state *state = get_wps_state(); |
387 | if (state->id3->elapsed < skip_thresh) | 389 | if (state->id3->elapsed < skip_thresh) |
388 | { | 390 | { |
389 | audio_prev(); | 391 | audio_prev(); |
@@ -404,7 +406,7 @@ static void prev_track(unsigned long skip_thresh) | |||
404 | 406 | ||
405 | static void next_track(void) | 407 | static void next_track(void) |
406 | { | 408 | { |
407 | struct wps_state *state = skin_get_global_state(); | 409 | struct wps_state *state = get_wps_state(); |
408 | /* take care of if we're playing a cuesheet */ | 410 | /* take care of if we're playing a cuesheet */ |
409 | if (state->id3->cuesheet) | 411 | if (state->id3->cuesheet) |
410 | { | 412 | { |
@@ -421,7 +423,7 @@ static void next_track(void) | |||
421 | 423 | ||
422 | static void play_hop(int direction) | 424 | static void play_hop(int direction) |
423 | { | 425 | { |
424 | struct wps_state *state = skin_get_global_state(); | 426 | struct wps_state *state = get_wps_state(); |
425 | struct cuesheet *cue = state->id3->cuesheet; | 427 | struct cuesheet *cue = state->id3->cuesheet; |
426 | long step = global_settings.skip_length*1000; | 428 | long step = global_settings.skip_length*1000; |
427 | long elapsed = state->id3->elapsed; | 429 | long elapsed = state->id3->elapsed; |
@@ -571,7 +573,7 @@ static void gwps_enter_wps(void) | |||
571 | 573 | ||
572 | void wps_do_playpause(bool updatewps) | 574 | void wps_do_playpause(bool updatewps) |
573 | { | 575 | { |
574 | struct wps_state *state = skin_get_global_state(); | 576 | struct wps_state *state = get_wps_state(); |
575 | if ( state->paused ) | 577 | if ( state->paused ) |
576 | { | 578 | { |
577 | state->paused = false; | 579 | state->paused = false; |
@@ -608,7 +610,7 @@ long gui_wps_show(void) | |||
608 | bool update = false; | 610 | bool update = false; |
609 | bool vol_changed = false; | 611 | bool vol_changed = false; |
610 | long last_left = 0, last_right = 0; | 612 | long last_left = 0, last_right = 0; |
611 | struct wps_state *state = skin_get_global_state(); | 613 | struct wps_state *state = get_wps_state(); |
612 | 614 | ||
613 | #ifdef AB_REPEAT_ENABLE | 615 | #ifdef AB_REPEAT_ENABLE |
614 | ab_repeat_init(); | 616 | ab_repeat_init(); |
@@ -1021,10 +1023,15 @@ long gui_wps_show(void) | |||
1021 | return GO_TO_ROOT; /* unreachable - just to reduce compiler warnings */ | 1023 | return GO_TO_ROOT; /* unreachable - just to reduce compiler warnings */ |
1022 | } | 1024 | } |
1023 | 1025 | ||
1026 | struct wps_state *get_wps_state(void) | ||
1027 | { | ||
1028 | return &wps_state; | ||
1029 | } | ||
1030 | |||
1024 | /* this is called from the playback thread so NO DRAWING! */ | 1031 | /* this is called from the playback thread so NO DRAWING! */ |
1025 | static void track_info_callback(unsigned short id, void *param) | 1032 | static void track_info_callback(unsigned short id, void *param) |
1026 | { | 1033 | { |
1027 | struct wps_state *state = skin_get_global_state(); | 1034 | struct wps_state *state = get_wps_state(); |
1028 | 1035 | ||
1029 | if (id == PLAYBACK_EVENT_TRACK_CHANGE || id == PLAYBACK_EVENT_CUR_TRACK_READY) | 1036 | if (id == PLAYBACK_EVENT_TRACK_CHANGE || id == PLAYBACK_EVENT_CUR_TRACK_READY) |
1030 | { | 1037 | { |
@@ -1040,13 +1047,13 @@ static void track_info_callback(unsigned short id, void *param) | |||
1040 | state->id3 = audio_current_track(); | 1047 | state->id3 = audio_current_track(); |
1041 | } | 1048 | } |
1042 | #endif | 1049 | #endif |
1043 | skin_get_global_state()->nid3 = audio_next_track(); | 1050 | state->nid3 = audio_next_track(); |
1044 | skin_request_full_update(WPS); | 1051 | skin_request_full_update(WPS); |
1045 | } | 1052 | } |
1046 | 1053 | ||
1047 | static void wps_state_init(void) | 1054 | static void wps_state_init(void) |
1048 | { | 1055 | { |
1049 | struct wps_state *state = skin_get_global_state(); | 1056 | struct wps_state *state = get_wps_state(); |
1050 | state->paused = false; | 1057 | state->paused = false; |
1051 | if(audio_status() & AUDIO_STATUS_PLAY) | 1058 | if(audio_status() & AUDIO_STATUS_PLAY) |
1052 | { | 1059 | { |
diff --git a/apps/gui/wps.h b/apps/gui/wps.h index 75c8138d35..001c112a4d 100644 --- a/apps/gui/wps.h +++ b/apps/gui/wps.h | |||
@@ -23,6 +23,17 @@ | |||
23 | 23 | ||
24 | #include <stdbool.h> | 24 | #include <stdbool.h> |
25 | 25 | ||
26 | struct mp3entry; | ||
27 | |||
28 | /* Please don't add anything else to here... */ | ||
29 | struct wps_state | ||
30 | { | ||
31 | struct mp3entry *id3; | ||
32 | struct mp3entry *nid3; | ||
33 | int ff_rewind_count; | ||
34 | bool paused; | ||
35 | }; | ||
36 | |||
26 | long gui_wps_show(void); | 37 | long gui_wps_show(void); |
27 | 38 | ||
28 | /* fade (if enabled) and pause the audio, optionally rewind a little */ | 39 | /* fade (if enabled) and pause the audio, optionally rewind a little */ |
@@ -30,6 +41,8 @@ void pause_action(bool updatewps); | |||
30 | void unpause_action(bool updatewps); | 41 | void unpause_action(bool updatewps); |
31 | void wps_do_playpause(bool updatewps); | 42 | void wps_do_playpause(bool updatewps); |
32 | 43 | ||
44 | struct wps_state *get_wps_state(void); | ||
45 | |||
33 | /* in milliseconds */ | 46 | /* in milliseconds */ |
34 | #define DEFAULT_SKIP_THRESH 3000l | 47 | #define DEFAULT_SKIP_THRESH 3000l |
35 | 48 | ||
diff --git a/apps/radio/radio.c b/apps/radio/radio.c index 1764495c7f..bf8ad865dd 100644 --- a/apps/radio/radio.c +++ b/apps/radio/radio.c | |||
@@ -56,7 +56,7 @@ | |||
56 | #include "statusbar-skinned.h" | 56 | #include "statusbar-skinned.h" |
57 | #include "playback.h" | 57 | #include "playback.h" |
58 | #include "presets.h" | 58 | #include "presets.h" |
59 | #include "skin_engine/wps_internals.h" | 59 | #include "wps.h" /* for wps_state... */ |
60 | 60 | ||
61 | #if CONFIG_TUNER | 61 | #if CONFIG_TUNER |
62 | 62 | ||
@@ -364,7 +364,9 @@ void radio_screen(void) | |||
364 | { | 364 | { |
365 | radio_load_presets(global_settings.fmr_file); | 365 | radio_load_presets(global_settings.fmr_file); |
366 | } | 366 | } |
367 | skin_get_global_state()->id3 = NULL; | 367 | /* TODO: Can this be moved somewhere else? */ |
368 | get_wps_state()->id3 = NULL; | ||
369 | get_wps_state()->nid3 = NULL; | ||
368 | #ifdef HAVE_ALBUMART | 370 | #ifdef HAVE_ALBUMART |
369 | radioart_init(true); | 371 | radioart_init(true); |
370 | #endif | 372 | #endif |