diff options
Diffstat (limited to 'apps/playback.c')
-rw-r--r-- | apps/playback.c | 18 |
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-) */ | |||
234 | static int track_widx = 0; /* Track being buffered (A) */ | 234 | static 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-) */ |
237 | static 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; |