forked from len0rd/rockbox
More error handling, handles empty MP3 files now
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2030 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e8b856e454
commit
606b0f545d
1 changed files with 19 additions and 9 deletions
|
|
@ -615,7 +615,7 @@ void IMIA1(void)
|
||||||
TSR1 &= ~0x01;
|
TSR1 &= ~0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_track_to_tag_list(char *filename)
|
static int add_track_to_tag_list(char *filename)
|
||||||
{
|
{
|
||||||
struct id3tag *t = NULL;
|
struct id3tag *t = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -631,7 +631,7 @@ static void add_track_to_tag_list(char *filename)
|
||||||
if(mp3info(&(t->id3), filename))
|
if(mp3info(&(t->id3), filename))
|
||||||
{
|
{
|
||||||
DEBUGF("Bad mp3\n");
|
DEBUGF("Bad mp3\n");
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
t->mempos = mp3buf_write;
|
t->mempos = mp3buf_write;
|
||||||
t->id3.elapsed = 0;
|
t->id3.elapsed = 0;
|
||||||
|
|
@ -646,6 +646,7 @@ static void add_track_to_tag_list(char *filename)
|
||||||
{
|
{
|
||||||
DEBUGF("No memory available for id3 tag");
|
DEBUGF("No memory available for id3 tag");
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If next_track is true, opens the next track, if false, opens prev track */
|
/* If next_track is true, opens the next track, if false, opens prev track */
|
||||||
|
|
@ -672,7 +673,15 @@ static int new_file(int steps)
|
||||||
|
|
||||||
index = playlist_next(steps);
|
index = playlist_next(steps);
|
||||||
|
|
||||||
add_track_to_tag_list(trackname);
|
if(add_track_to_tag_list(trackname))
|
||||||
|
{
|
||||||
|
/* Bad mp3 file */
|
||||||
|
steps++;
|
||||||
|
close(mpeg_file);
|
||||||
|
mpeg_file = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* skip past id3v2 tag (to an even byte) */
|
/* skip past id3v2 tag (to an even byte) */
|
||||||
lseek(mpeg_file,
|
lseek(mpeg_file,
|
||||||
id3tags[new_tag_idx]->id3.id3v2len & ~1,
|
id3tags[new_tag_idx]->id3.id3v2len & ~1,
|
||||||
|
|
@ -680,6 +689,7 @@ static int new_file(int steps)
|
||||||
id3tags[new_tag_idx]->id3.index = index;
|
id3tags[new_tag_idx]->id3.index = index;
|
||||||
id3tags[new_tag_idx]->id3.offset = 0;
|
id3tags[new_tag_idx]->id3.offset = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} while ( mpeg_file < 0 );
|
} while ( mpeg_file < 0 );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue