1
0
Fork 0
forked from len0rd/rockbox

Better handling of next/prev

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3528 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2003-04-11 00:29:15 +00:00
parent 9c1f29f9fb
commit 9d860e19d2
4 changed files with 14 additions and 4 deletions

View file

@ -378,6 +378,14 @@ int playlist_next(int steps)
return index; return index;
} }
/* Returns false if 'steps' is out of bounds, else true */
bool playlist_check(int steps)
{
bool queue;
int index = get_next_index(steps, &queue);
return (index >= 0);
}
char* playlist_peek(int steps) char* playlist_peek(int steps)
{ {
int seek; int seek;

View file

@ -55,6 +55,7 @@ int play_list(char *dir, char *file, int start_index,
char* playlist_peek(int steps); char* playlist_peek(int steps);
char* playlist_name(char *name, int name_size); char* playlist_name(char *name, int name_size);
int playlist_next(int steps); int playlist_next(int steps);
bool playlist_check(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 add_indices_to_playlist(void); void add_indices_to_playlist(void);

View file

@ -915,7 +915,6 @@ int wps_show(void)
break; break;
#endif #endif
if (!id3 || (id3->elapsed < 3*1000)) { if (!id3 || (id3->elapsed < 3*1000)) {
mpeg_stop();
mpeg_prev(); mpeg_prev();
} }
else { else {
@ -935,7 +934,6 @@ int wps_show(void)
if ( lastbutton != BUTTON_RIGHT ) if ( lastbutton != BUTTON_RIGHT )
break; break;
#endif #endif
mpeg_stop();
mpeg_next(); mpeg_next();
break; break;

View file

@ -77,6 +77,7 @@ static enum
#endif #endif
extern char* playlist_peek(int steps); extern char* playlist_peek(int steps);
extern bool playlist_check(int steps);
extern int playlist_next(int steps); extern int playlist_next(int steps);
extern int playlist_amount(void); extern int playlist_amount(void);
extern void update_file_pos( int id, int pos ); extern void update_file_pos( int id, int pos );
@ -1415,7 +1416,7 @@ static void mpeg_thread(void)
} }
} }
else { else {
if (!playlist_peek(1)) if (!playlist_check(1))
break; break;
/* stop the current stream */ /* stop the current stream */
@ -1450,8 +1451,10 @@ static void mpeg_thread(void)
case MPEG_PREV: { case MPEG_PREV: {
DEBUGF("MPEG_PREV\n"); DEBUGF("MPEG_PREV\n");
if (!playlist_peek(-1))
if (!playlist_check(-1))
break; break;
/* stop the current stream */ /* stop the current stream */
play_pending = false; play_pending = false;
playing = false; playing = false;