forked from len0rd/rockbox
modified the playlist system slightly:
playlist_peek() returns info relative the current index playlist_next() advances the index back or forth (this breaks the build, mpeg fixes are pending) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2022 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
728f5a7626
commit
71a07bebe6
2 changed files with 21 additions and 10 deletions
|
|
@ -64,7 +64,19 @@ int playlist_add(char *filename)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* playlist_next(int steps, int* index)
|
int playlist_next(int steps)
|
||||||
|
{
|
||||||
|
playlist.index = (playlist.index+steps) % playlist.amount;
|
||||||
|
while ( playlist.index < 0 ) {
|
||||||
|
if ( global_settings.loop_playlist )
|
||||||
|
playlist.index += playlist.amount;
|
||||||
|
else
|
||||||
|
playlist.index = 0;
|
||||||
|
}
|
||||||
|
return playlist.index;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* playlist_peek(int steps)
|
||||||
{
|
{
|
||||||
int seek;
|
int seek;
|
||||||
int max;
|
int max;
|
||||||
|
|
@ -73,19 +85,20 @@ char* playlist_next(int steps, int* index)
|
||||||
char *buf;
|
char *buf;
|
||||||
char dir_buf[MAX_PATH+1];
|
char dir_buf[MAX_PATH+1];
|
||||||
char *dir_end;
|
char *dir_end;
|
||||||
|
int index;
|
||||||
|
|
||||||
if(abs(steps) > playlist.amount)
|
if(abs(steps) > playlist.amount)
|
||||||
/* prevent madness when all files are empty/bad */
|
/* prevent madness when all files are empty/bad */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
playlist.index = (playlist.index+steps) % playlist.amount;
|
index = (playlist.index+steps) % playlist.amount;
|
||||||
while ( playlist.index < 0 ) {
|
while ( index < 0 ) {
|
||||||
if ( global_settings.loop_playlist )
|
if ( global_settings.loop_playlist )
|
||||||
playlist.index += playlist.amount;
|
index += playlist.amount;
|
||||||
else
|
else
|
||||||
playlist.index = 0;
|
index = 0;
|
||||||
}
|
}
|
||||||
seek = playlist.indices[playlist.index];
|
seek = playlist.indices[index];
|
||||||
|
|
||||||
if(playlist.in_ram)
|
if(playlist.in_ram)
|
||||||
{
|
{
|
||||||
|
|
@ -106,9 +119,6 @@ char* playlist_next(int steps, int* index)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index)
|
|
||||||
*index = playlist.index;
|
|
||||||
|
|
||||||
/* Zero-terminate the file name */
|
/* Zero-terminate the file name */
|
||||||
seek=0;
|
seek=0;
|
||||||
while((buf[seek] != '\n') &&
|
while((buf[seek] != '\n') &&
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ extern bool playlist_shuffle;
|
||||||
|
|
||||||
int play_list(char *dir, char *file, int start_index,
|
int play_list(char *dir, char *file, int start_index,
|
||||||
bool shuffled_index, int start_offset, int random_seed );
|
bool shuffled_index, int start_offset, int random_seed );
|
||||||
char* playlist_next(int steps, int* id);
|
char* playlist_peek(int steps);
|
||||||
|
int playlist_next(int steps);
|
||||||
void randomise_playlist( unsigned int seed );
|
void randomise_playlist( unsigned int seed );
|
||||||
void sort_playlist(bool start_current);
|
void sort_playlist(bool start_current);
|
||||||
void empty_playlist(void);
|
void empty_playlist(void);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue