diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 5 | ||||
-rw-r--r-- | apps/playback.c | 4 | ||||
-rw-r--r-- | apps/playlist.c | 11 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/tree.c | 10 |
5 files changed, 19 insertions, 13 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index b5b9b4d7a6..83fea8c73c 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -218,7 +218,7 @@ void draw_playlist_viewer_list(struct gui_wps *gwps, struct playlistviewer *view | |||
218 | int x, length, alignment = SKIN_TOKEN_ALIGN_LEFT; | 218 | int x, length, alignment = SKIN_TOKEN_ALIGN_LEFT; |
219 | 219 | ||
220 | struct mp3entry *pid3; | 220 | struct mp3entry *pid3; |
221 | char buf[MAX_PATH*2], tempbuf[MAX_PATH]; | 221 | char buf[MAX_PATH*2], tempbuf[MAX_PATH], filename_buf[MAX_PATH + 1]; |
222 | const char *filename; | 222 | const char *filename; |
223 | #if CONFIG_TUNER | 223 | #if CONFIG_TUNER |
224 | if (current_screen() == GO_TO_FM) | 224 | if (current_screen() == GO_TO_FM) |
@@ -249,7 +249,8 @@ void draw_playlist_viewer_list(struct gui_wps *gwps, struct playlistviewer *view | |||
249 | else | 249 | else |
250 | #endif | 250 | #endif |
251 | { | 251 | { |
252 | filename = playlist_peek(i-cur_pos); | 252 | filename = playlist_peek(i-cur_pos, filename_buf, |
253 | sizeof(filename_buf)); | ||
253 | if (i == cur_pos) | 254 | if (i == cur_pos) |
254 | { | 255 | { |
255 | pid3 = state->id3; | 256 | pid3 = state->id3; |
diff --git a/apps/playback.c b/apps/playback.c index e8a6efc109..4c55c857bc 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1113,6 +1113,7 @@ static bool audio_loadcodec(bool start_play) | |||
1113 | actually loaded by the buffering thread. */ | 1113 | actually loaded by the buffering thread. */ |
1114 | static bool audio_load_track(size_t offset, bool start_play) | 1114 | static bool audio_load_track(size_t offset, bool start_play) |
1115 | { | 1115 | { |
1116 | char name_buf[MAX_PATH + 1]; | ||
1116 | const char *trackname; | 1117 | const char *trackname; |
1117 | int fd = -1; | 1118 | int fd = -1; |
1118 | 1119 | ||
@@ -1140,7 +1141,8 @@ static bool audio_load_track(size_t offset, bool start_play) | |||
1140 | 1141 | ||
1141 | logf("Buffering track: r%d/w%d", track_ridx, track_widx); | 1142 | logf("Buffering track: r%d/w%d", track_ridx, track_widx); |
1142 | /* Get track name from current playlist read position. */ | 1143 | /* Get track name from current playlist read position. */ |
1143 | while ((trackname = playlist_peek(last_peek_offset)) != NULL) | 1144 | while ((trackname = playlist_peek(last_peek_offset, name_buf, |
1145 | sizeof(name_buf))) != NULL) | ||
1144 | { | 1146 | { |
1145 | /* Handle broken playlists. */ | 1147 | /* Handle broken playlists. */ |
1146 | fd = open(trackname, O_RDONLY); | 1148 | fd = open(trackname, O_RDONLY); |
diff --git a/apps/playlist.c b/apps/playlist.c index 2896f62e76..df39ecfd64 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -144,7 +144,6 @@ struct directory_search_context { | |||
144 | }; | 144 | }; |
145 | 145 | ||
146 | static struct playlist_info current_playlist; | 146 | static struct playlist_info current_playlist; |
147 | static char now_playing[MAX_PATH+1]; | ||
148 | 147 | ||
149 | static void empty_playlist(struct playlist_info* playlist, bool resume); | 148 | static void empty_playlist(struct playlist_info* playlist, bool resume); |
150 | static void new_playlist(struct playlist_info* playlist, const char *dir, | 149 | static void new_playlist(struct playlist_info* playlist, const char *dir, |
@@ -2456,7 +2455,7 @@ bool playlist_check(int steps) | |||
2456 | 2455 | ||
2457 | /* get trackname of track that is "steps" away from current playing track. | 2456 | /* get trackname of track that is "steps" away from current playing track. |
2458 | NULL is used to identify end of playlist */ | 2457 | NULL is used to identify end of playlist */ |
2459 | const char* playlist_peek(int steps) | 2458 | const char* playlist_peek(int steps, char* buf, size_t buf_size) |
2460 | { | 2459 | { |
2461 | struct playlist_info* playlist = ¤t_playlist; | 2460 | struct playlist_info* playlist = ¤t_playlist; |
2462 | int seek; | 2461 | int seek; |
@@ -2471,11 +2470,11 @@ const char* playlist_peek(int steps) | |||
2471 | control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK; | 2470 | control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK; |
2472 | seek = playlist->indices[index] & PLAYLIST_SEEK_MASK; | 2471 | seek = playlist->indices[index] & PLAYLIST_SEEK_MASK; |
2473 | 2472 | ||
2474 | if (get_filename(playlist, index, seek, control_file, now_playing, | 2473 | if (get_filename(playlist, index, seek, control_file, buf, |
2475 | MAX_PATH+1) < 0) | 2474 | buf_size) < 0) |
2476 | return NULL; | 2475 | return NULL; |
2477 | 2476 | ||
2478 | temp_ptr = now_playing; | 2477 | temp_ptr = buf; |
2479 | 2478 | ||
2480 | if (!playlist->in_ram || control_file) | 2479 | if (!playlist->in_ram || control_file) |
2481 | { | 2480 | { |
@@ -2494,7 +2493,7 @@ const char* playlist_peek(int steps) | |||
2494 | /* Even though this is an invalid file, we still need to pass a | 2493 | /* Even though this is an invalid file, we still need to pass a |
2495 | file name to the caller because NULL is used to indicate end | 2494 | file name to the caller because NULL is used to indicate end |
2496 | of playlist */ | 2495 | of playlist */ |
2497 | return now_playing; | 2496 | return buf; |
2498 | } | 2497 | } |
2499 | } | 2498 | } |
2500 | 2499 | ||
diff --git a/apps/playlist.h b/apps/playlist.h index 3ff32c7682..fb30b7ac8c 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -127,7 +127,7 @@ int playlist_add(const char *filename); | |||
127 | int playlist_shuffle(int random_seed, int start_index); | 127 | int playlist_shuffle(int random_seed, int start_index); |
128 | void playlist_start(int start_index, int offset); | 128 | void playlist_start(int start_index, int offset); |
129 | bool playlist_check(int steps); | 129 | bool playlist_check(int steps); |
130 | const char *playlist_peek(int steps); | 130 | const char *playlist_peek(int steps, char* buf, size_t buf_size); |
131 | int playlist_next(int steps); | 131 | int playlist_next(int steps); |
132 | bool playlist_next_dir(int direction); | 132 | bool playlist_next_dir(int direction); |
133 | int playlist_get_resume_info(int *resume_index); | 133 | int playlist_get_resume_info(int *resume_index); |
diff --git a/apps/tree.c b/apps/tree.c index c2ec4ca3ec..f8874f684e 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1075,6 +1075,7 @@ bool bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1075 | lastdir[0]='\0'; | 1075 | lastdir[0]='\0'; |
1076 | if (playlist_create(resume_file, NULL) != -1) | 1076 | if (playlist_create(resume_file, NULL) != -1) |
1077 | { | 1077 | { |
1078 | char filename_buf[MAX_PATH + 1]; | ||
1078 | const char* peek_filename; | 1079 | const char* peek_filename; |
1079 | resume_directory(resume_file); | 1080 | resume_directory(resume_file); |
1080 | if (global_settings.playlist_shuffle) | 1081 | if (global_settings.playlist_shuffle) |
@@ -1082,13 +1083,15 @@ bool bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1082 | 1083 | ||
1083 | /* Check if the file is at the same spot in the directory, | 1084 | /* Check if the file is at the same spot in the directory, |
1084 | else search for it */ | 1085 | else search for it */ |
1085 | peek_filename = playlist_peek(index); | 1086 | peek_filename = playlist_peek(index, filename_buf, |
1087 | sizeof(filename_buf)); | ||
1086 | 1088 | ||
1087 | if (peek_filename == NULL) | 1089 | if (peek_filename == NULL) |
1088 | { | 1090 | { |
1089 | /* playlist has shrunk, search from the top */ | 1091 | /* playlist has shrunk, search from the top */ |
1090 | index = 0; | 1092 | index = 0; |
1091 | peek_filename = playlist_peek(index); | 1093 | peek_filename = playlist_peek(index, filename_buf, |
1094 | sizeof(filename_buf)); | ||
1092 | if (peek_filename == NULL) | 1095 | if (peek_filename == NULL) |
1093 | return false; | 1096 | return false; |
1094 | } | 1097 | } |
@@ -1097,7 +1100,8 @@ bool bookmark_play(char *resume_file, int index, int offset, int seed, | |||
1097 | { | 1100 | { |
1098 | for ( i=0; i < playlist_amount(); i++ ) | 1101 | for ( i=0; i < playlist_amount(); i++ ) |
1099 | { | 1102 | { |
1100 | peek_filename = playlist_peek(i); | 1103 | peek_filename = playlist_peek(i, filename_buf, |
1104 | sizeof(filename_buf)); | ||
1101 | 1105 | ||
1102 | if (peek_filename == NULL) | 1106 | if (peek_filename == NULL) |
1103 | return false; | 1107 | return false; |