summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-08-22 07:58:18 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-08-22 07:58:18 +0000
commit22633d66a22e4fd16625d1da6219d72c22f80dcd (patch)
tree330622a74ad4c0302affe11c5fcc5d386ad5861e
parent487662a67cedf34b8062453eb392f49a575dbe21 (diff)
downloadrockbox-22633d66a22e4fd16625d1da6219d72c22f80dcd.zip
rockbox-22633d66a22e4fd16625d1da6219d72c22f80dcd.tar.gz
rockbox-22633d66a22e4fd16625d1da6219d72c22f80dcd.tar.bz2
rockbox-22633d66a22e4fd16625d1da6219d72c22f80dcd.tar.xz
Check the return code from each call to mp3info(), as it might return true
to indicate a bad mp3 file. TODO: when having a dir full of zero-byte mp3 files and pressing play on one using the simulator, this'll go crazy. TO CHECK: I haven't checked how the live target code behaves on this. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1922 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c71
1 files changed, 54 insertions, 17 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 0117102..2e3080f 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -606,7 +606,11 @@ static void add_track_to_tag_list(char *filename)
{
/* grab id3 tag of new file and
remember where in memory it starts */
- mp3info(&(t->id3), filename);
+ if(mp3info(&(t->id3), filename))
+ {
+ DEBUGF("Bad mp3\n");
+ return;
+ }
t->mempos = mp3buf_write;
t->id3.elapsed = 0;
if(!append_tag(t))
@@ -1220,14 +1224,23 @@ bool mpeg_has_changed_track(void)
void mpeg_play(int offset)
{
#ifdef SIMULATOR
- char* trackname = playlist_next( 0, NULL );
- if ( trackname ) {
- mp3info(&taginfo, trackname);
- taginfo.offset = offset;
- set_elapsed(&taginfo);
- playing = true;
- }
- (void)offset;
+ char* trackname;
+ int steps=0;
+
+ do {
+ trackname = playlist_next( steps, NULL );
+ if ( trackname ) {
+ if(mp3info(&taginfo, trackname)) {
+ /* bad mp3, move on */
+ steps++;
+ continue;
+ }
+ taginfo.offset = offset;
+ set_elapsed(&taginfo);
+ playing = true;
+ break;
+ }
+ } while(1);
#else
queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset);
#endif
@@ -1267,10 +1280,19 @@ void mpeg_next(void)
#ifndef SIMULATOR
queue_post(&mpeg_queue, MPEG_NEXT, NULL);
#else
- char* file = playlist_next(1,NULL);
- mp3info(&taginfo, file);
- current_track_counter++;
- playing = true;
+ char* file;
+ int steps = 1;
+
+ do {
+ file = playlist_next(steps, NULL);
+ if(mp3info(&taginfo, file)) {
+ steps++;
+ continue;
+ }
+ current_track_counter++;
+ playing = true;
+ break;
+ } while(1);
#endif
}
@@ -1279,10 +1301,19 @@ void mpeg_prev(void)
#ifndef SIMULATOR
queue_post(&mpeg_queue, MPEG_PREV, NULL);
#else
- char* file = playlist_next(-1,NULL);
- mp3info(&taginfo, file);
- current_track_counter++;
- playing = true;
+ char* file;
+ int steps = -1;
+
+ do {
+ file = playlist_next(steps, NULL);
+ if(mp3info(&taginfo, file)) {
+ steps--;
+ continue;
+ }
+ current_track_counter++;
+ playing = true;
+ break;
+ } while(1);
#endif
}
@@ -1638,3 +1669,9 @@ void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int
memset(id3tags, sizeof(id3tags), 0);
memset(_id3tags, sizeof(id3tags), 0);
}
+
+/* -----------------------------------------------------------------
+ * local variables:
+ * eval: (load-file "rockbox-mode.el")
+ * end:
+ */