summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-11-21 11:14:51 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-11-21 11:14:51 +0000
commitd1704f689462393012715f6d0cd6ae0b153becf8 (patch)
treebf20555330530a95b7c6d753da316df4b68be381
parent0fe9abbad1aa06378ad1ac1aed071861202f3e93 (diff)
downloadrockbox-d1704f689462393012715f6d0cd6ae0b153becf8.zip
rockbox-d1704f689462393012715f6d0cd6ae0b153becf8.tar.gz
rockbox-d1704f689462393012715f6d0cd6ae0b153becf8.tar.bz2
rockbox-d1704f689462393012715f6d0cd6ae0b153becf8.tar.xz
Fixed playlist skipping of incorrect files and playback engine not to
hang if codec loading fails. Also displaying a "Loading..." message on resume and not calling queue_post too often. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8021 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c7
-rw-r--r--apps/playlist.c39
2 files changed, 30 insertions, 16 deletions
diff --git a/apps/playback.c b/apps/playback.c
index b662d03..1f04925 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -867,6 +867,7 @@ bool loadcodec(const char *trackname, bool start_play)
int prev_track;
filetype = probe_file_format(trackname);
+
switch (filetype) {
case AFMT_OGG_VORBIS:
logf("Codec: Vorbis");
@@ -915,12 +916,11 @@ bool loadcodec(const char *trackname, bool start_play)
snprintf(msgbuf, sizeof(msgbuf)-1, "No codec for: %s", trackname);
gui_syncsplash(HZ*2, true, msgbuf);
codec_path = NULL;
+ return false;
}
tracks[track_widx].id3.codectype = filetype;
tracks[track_widx].codecsize = 0;
- if (codec_path == NULL)
- return false;
if (!start_play) {
prev_track = track_widx - 1;
@@ -1094,11 +1094,10 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
tracks[track_widx].codecbuf = &filebuf[buf_widx];
if (!loadcodec(trackname, start_play)) {
close(fd);
- /* Stop buffer filling if codec load failed. */
- fill_bytesleft = 0;
/* Set filesize to zero to indicate no file was loaded. */
tracks[track_widx].filesize = 0;
tracks[track_widx].filerem = 0;
+ tracks[track_widx].taginfo_ready = false;
/* Try skipping to next track. */
if (fill_bytesleft > 0) {
diff --git a/apps/playlist.c b/apps/playlist.c
index 694caab..9a132e0 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -582,7 +582,6 @@ static int add_track_to_playlist(struct playlist_info* playlist,
#ifdef HAVE_DIRCACHE
if (playlist->filenames)
playlist->filenames[insert_position] = NULL;
- queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
#endif
playlist->amount++;
@@ -917,22 +916,15 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps)
int index;
int stepped_count = 0;
+ count = steps;
if (steps < 0)
- {
direction = -1;
- count = -steps;
- }
else
- {
direction = 1;
- count = steps;
- }
index = playlist->index;
i = 0;
- while (i < count)
- {
- index += direction;
+ do {
/* Boundary check */
if (index < 0)
index += playlist->amount;
@@ -949,7 +941,9 @@ static int calculate_step_count(const struct playlist_info *playlist, int steps)
}
else
i++;
- }
+
+ index += direction;
+ } while (i < count);
return steps;
}
@@ -1693,6 +1687,7 @@ int playlist_resume(void)
empty_playlist(playlist, true);
+ gui_syncsplash(0, true, str(LANG_WAIT));
playlist->control_fd = open(playlist->control_filename, O_RDWR);
if (playlist->control_fd < 0)
{
@@ -1810,7 +1805,7 @@ int playlist_resume(void)
buffer */
if (add_track_to_playlist(playlist, str3, position,
queue, total_read+(str3-buffer)) < 0)
- return -1;
+ return -1;
playlist->last_insert_pos = last_position;
@@ -2041,6 +2036,10 @@ int playlist_resume(void)
}
}
+#ifdef HAVE_DIRCACHE
+ queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
+#endif
+
return 0;
}
@@ -2582,6 +2581,10 @@ int playlist_insert_track(struct playlist_info* playlist,
audio_flush_and_reload_tracks();
}
+#ifdef HAVE_DIRCACHE
+ queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
+#endif
+
return result;
}
@@ -2624,6 +2627,10 @@ int playlist_insert_directory(struct playlist_info* playlist,
if (audio_status() & AUDIO_STATUS_PLAY)
audio_flush_and_reload_tracks();
+#ifdef HAVE_DIRCACHE
+ queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
+#endif
+
return result;
}
@@ -2738,6 +2745,10 @@ int playlist_insert_playlist(struct playlist_info* playlist, char *filename,
if (audio_status() & AUDIO_STATUS_PLAY)
audio_flush_and_reload_tracks();
+#ifdef HAVE_DIRCACHE
+ queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
+#endif
+
return result;
}
@@ -2860,6 +2871,10 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
}
}
+#ifdef HAVE_DIRCACHE
+ queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
+#endif
+
return result;
}