diff options
-rw-r--r-- | apps/playlist.c | 8 | ||||
-rw-r--r-- | apps/playlist.h | 1 | ||||
-rw-r--r-- | apps/wps.c | 2 | ||||
-rw-r--r-- | firmware/mpeg.c | 7 |
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 */ | ||
382 | bool playlist_check(int steps) | ||
383 | { | ||
384 | bool queue; | ||
385 | int index = get_next_index(steps, &queue); | ||
386 | return (index >= 0); | ||
387 | } | ||
388 | |||
381 | char* playlist_peek(int steps) | 389 | char* 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, | |||
55 | char* playlist_peek(int steps); | 55 | char* playlist_peek(int steps); |
56 | char* playlist_name(char *name, int name_size); | 56 | char* playlist_name(char *name, int name_size); |
57 | int playlist_next(int steps); | 57 | int playlist_next(int steps); |
58 | bool playlist_check(int steps); | ||
58 | void randomise_playlist( unsigned int seed ); | 59 | void randomise_playlist( unsigned int seed ); |
59 | void sort_playlist(bool start_current); | 60 | void sort_playlist(bool start_current); |
60 | void add_indices_to_playlist(void); | 61 | void 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 | ||
79 | extern char* playlist_peek(int steps); | 79 | extern char* playlist_peek(int steps); |
80 | extern bool playlist_check(int steps); | ||
80 | extern int playlist_next(int steps); | 81 | extern int playlist_next(int steps); |
81 | extern int playlist_amount(void); | 82 | extern int playlist_amount(void); |
82 | extern void update_file_pos( int id, int pos ); | 83 | extern 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; |