summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-11 21:27:18 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-11-11 21:27:18 +0000
commite71bc67d94599be70da6f79365e765ea02d6b698 (patch)
tree7659817767b239c338b99d20c7060a19e65c89c0
parentbe1283dbacac66c94e2b56ed7066bf361dffabce (diff)
downloadrockbox-e71bc67d94599be70da6f79365e765ea02d6b698.zip
rockbox-e71bc67d94599be70da6f79365e765ea02d6b698.tar.gz
rockbox-e71bc67d94599be70da6f79365e765ea02d6b698.tar.bz2
rockbox-e71bc67d94599be70da6f79365e765ea02d6b698.tar.xz
Fix an issue that appeared in r15577, where skipping back to a track that has no audio data left, but still has its metadata and album art, would fail. The fix is to also clear the filesize member (as it should have been previously) to force a rebuffer when skipping back. To prevent the album art bitmap from flashing on the back skip, the whole track info struct is cleared when the track isn't needed anymore, i.e. after the PCM track change.
Also a slightly unrelated but trivial change: only load album art if it's not already loaded. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15588 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 497f250..2488de7 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -234,6 +234,7 @@ static volatile int track_ridx = 0; /* Track being decoded (A/C-) */
static int track_widx = 0; /* Track being buffered (A) */
#define CUR_TI (&tracks[track_ridx]) /* Playing track info pointer (A/C-) */
+static struct track_info *prev_ti; /* Pointer to the previous track played */
/* Set by the audio thread when the current track information has updated
* and the WPS may need to update its cached information */
@@ -2415,7 +2416,7 @@ static bool audio_load_track(int offset, bool start_play)
track_id3 = bufgetid3(tracks[track_widx].id3_hid);
#ifdef HAVE_ALBUMART
- if (gui_sync_wps_uses_albumart())
+ if (tracks[track_widx].aa_hid < 0 && gui_sync_wps_uses_albumart())
{
char aa_path[MAX_PATH];
if (find_albumart(track_id3, aa_path, sizeof(aa_path)))
@@ -2665,9 +2666,12 @@ static int audio_check_new_track(void)
new_playlist = false;
}
- /* Save the old track to allow the WPS to display it */
+ /* Save the old track's metadata to allow the WPS to display it */
copy_mp3entry(&prevtrack_id3, &curtrack_id3);
+ /* Save a pointer to the old track to allow later clearing */
+ prev_ti = CUR_TI;
+
for (i = 0; i < ci.new_track; i++)
{
idx = (track_ridx + i) & MAX_TRACK_MASK;
@@ -2678,7 +2682,10 @@ static int audio_check_new_track(void)
/* We don't have all the audio data for that track, so clear it,
but keep the metadata. */
if (tracks[idx].audio_hid >= 0 && bufclose(tracks[idx].audio_hid))
+ {
tracks[idx].audio_hid = -1;
+ tracks[idx].filesize = 0;
+ }
}
}
@@ -2959,6 +2966,13 @@ static void audio_finalise_track_change(void)
automatic_skip = false;
}
prevtrack_id3.path[0] = 0;
+
+ if (prev_ti->audio_hid < 0)
+ {
+ /* No audio left so we clear all the track info. */
+ clear_track_info(prev_ti);
+ }
+
if (track_changed_callback)
track_changed_callback(&curtrack_id3);
track_changed = true;