summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-04-11 00:29:15 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-04-11 00:29:15 +0000
commit9d860e19d2aedc9dc672a037b7c2de728dd6477e (patch)
tree5d193eb0bac65aead2d5d80f40f1055d0fa7cadf
parent9c1f29f9fb7438b0d669e541291f5df674ef45fe (diff)
downloadrockbox-9d860e19d2aedc9dc672a037b7c2de728dd6477e.zip
rockbox-9d860e19d2aedc9dc672a037b7c2de728dd6477e.tar.gz
rockbox-9d860e19d2aedc9dc672a037b7c2de728dd6477e.tar.bz2
rockbox-9d860e19d2aedc9dc672a037b7c2de728dd6477e.tar.xz
Better handling of next/prev
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3528 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playlist.c8
-rw-r--r--apps/playlist.h1
-rw-r--r--apps/wps.c2
-rw-r--r--firmware/mpeg.c7
4 files changed, 14 insertions, 4 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 165c138..ebe82cc 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -378,6 +378,14 @@ int playlist_next(int steps)
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)
{
int seek;
diff --git a/apps/playlist.h b/apps/playlist.h
index 57a23f2..ea77886 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -55,6 +55,7 @@ int play_list(char *dir, char *file, int start_index,
char* playlist_peek(int steps);
char* playlist_name(char *name, int name_size);
int playlist_next(int steps);
+bool playlist_check(int steps);
void randomise_playlist( unsigned int seed );
void sort_playlist(bool start_current);
void add_indices_to_playlist(void);
diff --git a/apps/wps.c b/apps/wps.c
index fded51f..0fbe8d7 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -915,7 +915,6 @@ int wps_show(void)
break;
#endif
if (!id3 || (id3->elapsed < 3*1000)) {
- mpeg_stop();
mpeg_prev();
}
else {
@@ -935,7 +934,6 @@ int wps_show(void)
if ( lastbutton != BUTTON_RIGHT )
break;
#endif
- mpeg_stop();
mpeg_next();
break;
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 718d5c4..015d6a9 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -77,6 +77,7 @@ static enum
#endif
extern char* playlist_peek(int steps);
+extern bool playlist_check(int steps);
extern int playlist_next(int steps);
extern int playlist_amount(void);
extern void update_file_pos( int id, int pos );
@@ -1415,7 +1416,7 @@ static void mpeg_thread(void)
}
}
else {
- if (!playlist_peek(1))
+ if (!playlist_check(1))
break;
/* stop the current stream */
@@ -1450,8 +1451,10 @@ static void mpeg_thread(void)
case MPEG_PREV: {
DEBUGF("MPEG_PREV\n");
- if (!playlist_peek(-1))
+
+ if (!playlist_check(-1))
break;
+
/* stop the current stream */
play_pending = false;
playing = false;