diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-08-22 07:58:18 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-08-22 07:58:18 +0000 |
commit | 22633d66a22e4fd16625d1da6219d72c22f80dcd (patch) | |
tree | 330622a74ad4c0302affe11c5fcc5d386ad5861e /firmware | |
parent | 487662a67cedf34b8062453eb392f49a575dbe21 (diff) | |
download | rockbox-22633d66a22e4fd16625d1da6219d72c22f80dcd.tar.gz rockbox-22633d66a22e4fd16625d1da6219d72c22f80dcd.zip |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/mpeg.c | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 0117102e57..2e3080f47d 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -606,7 +606,11 @@ static void add_track_to_tag_list(char *filename) | |||
606 | { | 606 | { |
607 | /* grab id3 tag of new file and | 607 | /* grab id3 tag of new file and |
608 | remember where in memory it starts */ | 608 | remember where in memory it starts */ |
609 | mp3info(&(t->id3), filename); | 609 | if(mp3info(&(t->id3), filename)) |
610 | { | ||
611 | DEBUGF("Bad mp3\n"); | ||
612 | return; | ||
613 | } | ||
610 | t->mempos = mp3buf_write; | 614 | t->mempos = mp3buf_write; |
611 | t->id3.elapsed = 0; | 615 | t->id3.elapsed = 0; |
612 | if(!append_tag(t)) | 616 | if(!append_tag(t)) |
@@ -1220,14 +1224,23 @@ bool mpeg_has_changed_track(void) | |||
1220 | void mpeg_play(int offset) | 1224 | void mpeg_play(int offset) |
1221 | { | 1225 | { |
1222 | #ifdef SIMULATOR | 1226 | #ifdef SIMULATOR |
1223 | char* trackname = playlist_next( 0, NULL ); | 1227 | char* trackname; |
1224 | if ( trackname ) { | 1228 | int steps=0; |
1225 | mp3info(&taginfo, trackname); | 1229 | |
1226 | taginfo.offset = offset; | 1230 | do { |
1227 | set_elapsed(&taginfo); | 1231 | trackname = playlist_next( steps, NULL ); |
1228 | playing = true; | 1232 | if ( trackname ) { |
1229 | } | 1233 | if(mp3info(&taginfo, trackname)) { |
1230 | (void)offset; | 1234 | /* bad mp3, move on */ |
1235 | steps++; | ||
1236 | continue; | ||
1237 | } | ||
1238 | taginfo.offset = offset; | ||
1239 | set_elapsed(&taginfo); | ||
1240 | playing = true; | ||
1241 | break; | ||
1242 | } | ||
1243 | } while(1); | ||
1231 | #else | 1244 | #else |
1232 | queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset); | 1245 | queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset); |
1233 | #endif | 1246 | #endif |
@@ -1267,10 +1280,19 @@ void mpeg_next(void) | |||
1267 | #ifndef SIMULATOR | 1280 | #ifndef SIMULATOR |
1268 | queue_post(&mpeg_queue, MPEG_NEXT, NULL); | 1281 | queue_post(&mpeg_queue, MPEG_NEXT, NULL); |
1269 | #else | 1282 | #else |
1270 | char* file = playlist_next(1,NULL); | 1283 | char* file; |
1271 | mp3info(&taginfo, file); | 1284 | int steps = 1; |
1272 | current_track_counter++; | 1285 | |
1273 | playing = true; | 1286 | do { |
1287 | file = playlist_next(steps, NULL); | ||
1288 | if(mp3info(&taginfo, file)) { | ||
1289 | steps++; | ||
1290 | continue; | ||
1291 | } | ||
1292 | current_track_counter++; | ||
1293 | playing = true; | ||
1294 | break; | ||
1295 | } while(1); | ||
1274 | #endif | 1296 | #endif |
1275 | } | 1297 | } |
1276 | 1298 | ||
@@ -1279,10 +1301,19 @@ void mpeg_prev(void) | |||
1279 | #ifndef SIMULATOR | 1301 | #ifndef SIMULATOR |
1280 | queue_post(&mpeg_queue, MPEG_PREV, NULL); | 1302 | queue_post(&mpeg_queue, MPEG_PREV, NULL); |
1281 | #else | 1303 | #else |
1282 | char* file = playlist_next(-1,NULL); | 1304 | char* file; |
1283 | mp3info(&taginfo, file); | 1305 | int steps = -1; |
1284 | current_track_counter++; | 1306 | |
1285 | playing = true; | 1307 | do { |
1308 | file = playlist_next(steps, NULL); | ||
1309 | if(mp3info(&taginfo, file)) { | ||
1310 | steps--; | ||
1311 | continue; | ||
1312 | } | ||
1313 | current_track_counter++; | ||
1314 | playing = true; | ||
1315 | break; | ||
1316 | } while(1); | ||
1286 | #endif | 1317 | #endif |
1287 | } | 1318 | } |
1288 | 1319 | ||
@@ -1638,3 +1669,9 @@ void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int | |||
1638 | memset(id3tags, sizeof(id3tags), 0); | 1669 | memset(id3tags, sizeof(id3tags), 0); |
1639 | memset(_id3tags, sizeof(id3tags), 0); | 1670 | memset(_id3tags, sizeof(id3tags), 0); |
1640 | } | 1671 | } |
1672 | |||
1673 | /* ----------------------------------------------------------------- | ||
1674 | * local variables: | ||
1675 | * eval: (load-file "rockbox-mode.el") | ||
1676 | * end: | ||
1677 | */ | ||