summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-07-03 18:03:20 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-07-03 18:03:20 +0000
commitf46c9f204c2d1a4d477364d5f3a87e59e06a0aa9 (patch)
treedf90356447f47382945444388faad6c51835a6fc /apps/playback.c
parent349f39a7f4a0b78dc1e6e9e6bcbe6f484471cb74 (diff)
Now next track info is always available.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6994 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/apps/playback.c b/apps/playback.c
index edeaedb118..c5b6fbc6a5 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -783,6 +783,33 @@ bool loadcodec(const char *trackname, bool start_play)
return true;
}
+bool read_next_metadata(void)
+{
+ int fd;
+ char *trackname;
+ int next_track;
+ int status;
+
+ trackname = playlist_peek(last_peek_offset);
+ if (!trackname)
+ return false;
+
+ fd = open(trackname, O_RDONLY);
+ if (fd < 0)
+ return false;
+
+ next_track = track_ridx + 1;
+ if (next_track >= MAX_TRACK)
+ next_track -= MAX_TRACK;
+
+ /* Start buffer refilling also because we need to spin-up the disk. */
+ filling = true;
+ status = get_metadata(&tracks[next_track],fd,trackname,v1first);
+ close(fd);
+
+ return status;
+}
+
bool audio_load_track(int offset, bool start_play, int peek_offset)
{
char *trackname;
@@ -838,10 +865,12 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
tracks[track_widx].start_pos = 0;
//logf("%s", trackname);
-
- if (!get_metadata(&tracks[track_widx],fd,trackname,v1first)) {
- close(fd);
- return false;
+
+ if (!tracks[track_widx].taginfo_ready) {
+ if (!get_metadata(&tracks[track_widx],fd,trackname,v1first)) {
+ close(fd);
+ return false;
+ }
}
/* Starting playback from an offset is only support in MPA at the moment */
@@ -1068,10 +1097,14 @@ void audio_check_buffer(void)
if (audio_load_track(0, false, last_peek_offset)) {
last_peek_offset++;
} else if (tracks[track_widx].filerem == 0 || fill_bytesleft == 0) {
+ if (track_count <= 1)
+ read_next_metadata();
+
generate_postbuffer_events();
filling = false;
conf_bufferlimit = 0;
pcm_set_boost_mode(false);
+
if (playing)
ata_sleep();
}
@@ -1243,6 +1276,7 @@ void audio_invalidate_tracks(void)
buf_widx = buf_ridx + cur_ti->available;
if (buf_widx >= codecbuflen)
buf_widx -= codecbuflen;
+ read_next_metadata();
}
void audio_thread(void)