summaryrefslogtreecommitdiff
path: root/apps/gui/gwps-common.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2009-04-06 00:39:43 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2009-04-06 00:39:43 +0000
commit843c7efaf8c953fc3bec40a7da0be3a5da9950df (patch)
treecb27e411394f716d26193433c66132072730ea70 /apps/gui/gwps-common.c
parent9188f0ffd7ce97101a5b2d697cc43072cd63b502 (diff)
downloadrockbox-843c7efaf8c953fc3bec40a7da0be3a5da9950df.tar.gz
rockbox-843c7efaf8c953fc3bec40a7da0be3a5da9950df.zip
FS9795 - some playback cleanup.
* Use events to notify things when the track has changed instead of the nasty has_track_changed() * Event for when the mp3entry for the next track is avilable (which allows alot more tags to be static which means less redrawing in the WPS) * virtually guarentee that the mp3entry sturct returned by audio_current/next_track() is going to be valid for the duration of the current track. The only time it wont be now is during the time between the codec finishing the previous track and the next track actually starting (~2s), but this is not an issue as long as it is called again when the TRACK_CHANGED event happens (or just use the pointer that gives) It is still possible to confuse the WPS with the next tracks id3 info being displayed but this should fix itself up faster than it used to (and be harder to do) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20633 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r--apps/gui/gwps-common.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index f32b002f69..189fc6fa31 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -348,33 +348,8 @@ bool gui_wps_display(struct gui_wps *gwps)
348 348
349bool gui_wps_update(struct gui_wps *gwps) 349bool gui_wps_update(struct gui_wps *gwps)
350{ 350{
351 bool track_changed = audio_has_changed_track();
352 struct mp3entry *id3 = gwps->state->id3; 351 struct mp3entry *id3 = gwps->state->id3;
353 352 bool retval;
354 gwps->state->nid3 = audio_next_track();
355 if (track_changed)
356 {
357 gwps->state->id3 = id3 = audio_current_track();
358
359 if (cuesheet_is_enabled() && id3->cuesheet_type
360 && strcmp(id3->path, curr_cue->audio_filename))
361 {
362 /* the current cuesheet isn't the right one any more */
363 /* We need to parse the new cuesheet */
364
365 char cuepath[MAX_PATH];
366
367 if (look_for_cuesheet_file(id3->path, cuepath) &&
368 parse_cuesheet(cuepath, curr_cue))
369 {
370 id3->cuesheet_type = 1;
371 strcpy(curr_cue->audio_filename, id3->path);
372 }
373
374 cue_spoof_id3(curr_cue, id3);
375 }
376 }
377
378 if (cuesheet_is_enabled() && id3->cuesheet_type 353 if (cuesheet_is_enabled() && id3->cuesheet_type
379 && (id3->elapsed < curr_cue->curr_track->offset 354 && (id3->elapsed < curr_cue->curr_track->offset
380 || (curr_cue->curr_track_idx < curr_cue->track_count - 1 355 || (curr_cue->curr_track_idx < curr_cue->track_count - 1
@@ -382,17 +357,15 @@ bool gui_wps_update(struct gui_wps *gwps)
382 { 357 {
383 /* We've changed tracks within the cuesheet : 358 /* We've changed tracks within the cuesheet :
384 we need to update the ID3 info and refresh the WPS */ 359 we need to update the ID3 info and refresh the WPS */
385 360 gwps->state->do_full_update = true;
386 track_changed = true;
387 cue_find_current_track(curr_cue, id3->elapsed); 361 cue_find_current_track(curr_cue, id3->elapsed);
388 cue_spoof_id3(curr_cue, id3); 362 cue_spoof_id3(curr_cue, id3);
389 } 363 }
390 364
391 if (track_changed) 365 retval = gui_wps_redraw(gwps, 0,
392 gwps->display->stop_scroll(); 366 gwps->state->do_full_update ?
393 367 WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
394 return gui_wps_redraw(gwps, 0, 368 return retval;
395 track_changed ? WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
396} 369}
397 370
398 371