forked from len0rd/rockbox
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
This commit is contained in:
parent
487662a67c
commit
22633d66a2
1 changed files with 54 additions and 17 deletions
|
|
@ -606,7 +606,11 @@ static void add_track_to_tag_list(char *filename)
|
||||||
{
|
{
|
||||||
/* grab id3 tag of new file and
|
/* grab id3 tag of new file and
|
||||||
remember where in memory it starts */
|
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->mempos = mp3buf_write;
|
||||||
t->id3.elapsed = 0;
|
t->id3.elapsed = 0;
|
||||||
if(!append_tag(t))
|
if(!append_tag(t))
|
||||||
|
|
@ -1220,14 +1224,23 @@ bool mpeg_has_changed_track(void)
|
||||||
void mpeg_play(int offset)
|
void mpeg_play(int offset)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
char* trackname = playlist_next( 0, NULL );
|
char* trackname;
|
||||||
|
int steps=0;
|
||||||
|
|
||||||
|
do {
|
||||||
|
trackname = playlist_next( steps, NULL );
|
||||||
if ( trackname ) {
|
if ( trackname ) {
|
||||||
mp3info(&taginfo, trackname);
|
if(mp3info(&taginfo, trackname)) {
|
||||||
|
/* bad mp3, move on */
|
||||||
|
steps++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
taginfo.offset = offset;
|
taginfo.offset = offset;
|
||||||
set_elapsed(&taginfo);
|
set_elapsed(&taginfo);
|
||||||
playing = true;
|
playing = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
(void)offset;
|
} while(1);
|
||||||
#else
|
#else
|
||||||
queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset);
|
queue_post(&mpeg_queue, MPEG_PLAY, (void*)offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -1267,10 +1280,19 @@ void mpeg_next(void)
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_NEXT, NULL);
|
queue_post(&mpeg_queue, MPEG_NEXT, NULL);
|
||||||
#else
|
#else
|
||||||
char* file = playlist_next(1,NULL);
|
char* file;
|
||||||
mp3info(&taginfo, file);
|
int steps = 1;
|
||||||
|
|
||||||
|
do {
|
||||||
|
file = playlist_next(steps, NULL);
|
||||||
|
if(mp3info(&taginfo, file)) {
|
||||||
|
steps++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
current_track_counter++;
|
current_track_counter++;
|
||||||
playing = true;
|
playing = true;
|
||||||
|
break;
|
||||||
|
} while(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1279,10 +1301,19 @@ void mpeg_prev(void)
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
queue_post(&mpeg_queue, MPEG_PREV, NULL);
|
queue_post(&mpeg_queue, MPEG_PREV, NULL);
|
||||||
#else
|
#else
|
||||||
char* file = playlist_next(-1,NULL);
|
char* file;
|
||||||
mp3info(&taginfo, file);
|
int steps = -1;
|
||||||
|
|
||||||
|
do {
|
||||||
|
file = playlist_next(steps, NULL);
|
||||||
|
if(mp3info(&taginfo, file)) {
|
||||||
|
steps--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
current_track_counter++;
|
current_track_counter++;
|
||||||
playing = true;
|
playing = true;
|
||||||
|
break;
|
||||||
|
} while(1);
|
||||||
#endif
|
#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);
|
||||||
memset(_id3tags, sizeof(id3tags), 0);
|
memset(_id3tags, sizeof(id3tags), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------
|
||||||
|
* local variables:
|
||||||
|
* eval: (load-file "rockbox-mode.el")
|
||||||
|
* end:
|
||||||
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue