summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 165c13847b..ebe82cc457 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -378,6 +378,14 @@ int playlist_next(int steps)
378 return index; 378 return index;
379} 379}
380 380
381/* Returns false if 'steps' is out of bounds, else true */
382bool playlist_check(int steps)
383{
384 bool queue;
385 int index = get_next_index(steps, &queue);
386 return (index >= 0);
387}
388
381char* playlist_peek(int steps) 389char* playlist_peek(int steps)
382{ 390{
383 int seek; 391 int seek;
diff --git a/apps/playlist.h b/apps/playlist.h
index 57a23f2a8f..ea77886bb7 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -55,6 +55,7 @@ int play_list(char *dir, char *file, int start_index,
55char* playlist_peek(int steps); 55char* playlist_peek(int steps);
56char* playlist_name(char *name, int name_size); 56char* playlist_name(char *name, int name_size);
57int playlist_next(int steps); 57int playlist_next(int steps);
58bool playlist_check(int steps);
58void randomise_playlist( unsigned int seed ); 59void randomise_playlist( unsigned int seed );
59void sort_playlist(bool start_current); 60void sort_playlist(bool start_current);
60void add_indices_to_playlist(void); 61void add_indices_to_playlist(void);
diff --git a/apps/wps.c b/apps/wps.c
index fded51fe13..0fbe8d713e 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -915,7 +915,6 @@ int wps_show(void)
915 break; 915 break;
916#endif 916#endif
917 if (!id3 || (id3->elapsed < 3*1000)) { 917 if (!id3 || (id3->elapsed < 3*1000)) {
918 mpeg_stop();
919 mpeg_prev(); 918 mpeg_prev();
920 } 919 }
921 else { 920 else {
@@ -935,7 +934,6 @@ int wps_show(void)
935 if ( lastbutton != BUTTON_RIGHT ) 934 if ( lastbutton != BUTTON_RIGHT )
936 break; 935 break;
937#endif 936#endif
938 mpeg_stop();
939 mpeg_next(); 937 mpeg_next();
940 break; 938 break;
941 939
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 718d5c4c62..015d6a9e2a 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -77,6 +77,7 @@ static enum
77#endif 77#endif
78 78
79extern char* playlist_peek(int steps); 79extern char* playlist_peek(int steps);
80extern bool playlist_check(int steps);
80extern int playlist_next(int steps); 81extern int playlist_next(int steps);
81extern int playlist_amount(void); 82extern int playlist_amount(void);
82extern void update_file_pos( int id, int pos ); 83extern void update_file_pos( int id, int pos );
@@ -1415,7 +1416,7 @@ static void mpeg_thread(void)
1415 } 1416 }
1416 } 1417 }
1417 else { 1418 else {
1418 if (!playlist_peek(1)) 1419 if (!playlist_check(1))
1419 break; 1420 break;
1420 1421
1421 /* stop the current stream */ 1422 /* stop the current stream */
@@ -1450,8 +1451,10 @@ static void mpeg_thread(void)
1450 1451
1451 case MPEG_PREV: { 1452 case MPEG_PREV: {
1452 DEBUGF("MPEG_PREV\n"); 1453 DEBUGF("MPEG_PREV\n");
1453 if (!playlist_peek(-1)) 1454
1455 if (!playlist_check(-1))
1454 break; 1456 break;
1457
1455 /* stop the current stream */ 1458 /* stop the current stream */
1456 play_pending = false; 1459 play_pending = false;
1457 playing = false; 1460 playing = false;