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.tar.gz
rockbox-e71bc67d94599be70da6f79365e765ea02d6b698.zip
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 497f250a9c..2488de7abc 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -234,6 +234,7 @@ static volatile int track_ridx = 0; /* Track being decoded (A/C-) */
234static int track_widx = 0; /* Track being buffered (A) */ 234static int track_widx = 0; /* Track being buffered (A) */
235 235
236#define CUR_TI (&tracks[track_ridx]) /* Playing track info pointer (A/C-) */ 236#define CUR_TI (&tracks[track_ridx]) /* Playing track info pointer (A/C-) */
237static struct track_info *prev_ti; /* Pointer to the previous track played */
237 238
238/* Set by the audio thread when the current track information has updated 239/* Set by the audio thread when the current track information has updated
239 * and the WPS may need to update its cached information */ 240 * and the WPS may need to update its cached information */
@@ -2415,7 +2416,7 @@ static bool audio_load_track(int offset, bool start_play)
2415 track_id3 = bufgetid3(tracks[track_widx].id3_hid); 2416 track_id3 = bufgetid3(tracks[track_widx].id3_hid);
2416 2417
2417#ifdef HAVE_ALBUMART 2418#ifdef HAVE_ALBUMART
2418 if (gui_sync_wps_uses_albumart()) 2419 if (tracks[track_widx].aa_hid < 0 && gui_sync_wps_uses_albumart())
2419 { 2420 {
2420 char aa_path[MAX_PATH]; 2421 char aa_path[MAX_PATH];
2421 if (find_albumart(track_id3, aa_path, sizeof(aa_path))) 2422 if (find_albumart(track_id3, aa_path, sizeof(aa_path)))
@@ -2665,9 +2666,12 @@ static int audio_check_new_track(void)
2665 new_playlist = false; 2666 new_playlist = false;
2666 } 2667 }
2667 2668
2668 /* Save the old track to allow the WPS to display it */ 2669 /* Save the old track's metadata to allow the WPS to display it */
2669 copy_mp3entry(&prevtrack_id3, &curtrack_id3); 2670 copy_mp3entry(&prevtrack_id3, &curtrack_id3);
2670 2671
2672 /* Save a pointer to the old track to allow later clearing */
2673 prev_ti = CUR_TI;
2674
2671 for (i = 0; i < ci.new_track; i++) 2675 for (i = 0; i < ci.new_track; i++)
2672 { 2676 {
2673 idx = (track_ridx + i) & MAX_TRACK_MASK; 2677 idx = (track_ridx + i) & MAX_TRACK_MASK;
@@ -2678,7 +2682,10 @@ static int audio_check_new_track(void)
2678 /* We don't have all the audio data for that track, so clear it, 2682 /* We don't have all the audio data for that track, so clear it,
2679 but keep the metadata. */ 2683 but keep the metadata. */
2680 if (tracks[idx].audio_hid >= 0 && bufclose(tracks[idx].audio_hid)) 2684 if (tracks[idx].audio_hid >= 0 && bufclose(tracks[idx].audio_hid))
2685 {
2681 tracks[idx].audio_hid = -1; 2686 tracks[idx].audio_hid = -1;
2687 tracks[idx].filesize = 0;
2688 }
2682 } 2689 }
2683 } 2690 }
2684 2691
@@ -2959,6 +2966,13 @@ static void audio_finalise_track_change(void)
2959 automatic_skip = false; 2966 automatic_skip = false;
2960 } 2967 }
2961 prevtrack_id3.path[0] = 0; 2968 prevtrack_id3.path[0] = 0;
2969
2970 if (prev_ti->audio_hid < 0)
2971 {
2972 /* No audio left so we clear all the track info. */
2973 clear_track_info(prev_ti);
2974 }
2975
2962 if (track_changed_callback) 2976 if (track_changed_callback)
2963 track_changed_callback(&curtrack_id3); 2977 track_changed_callback(&curtrack_id3);
2964 track_changed = true; 2978 track_changed = true;