diff options
-rw-r--r-- | apps/metadata.h | 1 | ||||
-rw-r--r-- | apps/mpeg.c | 2 | ||||
-rw-r--r-- | apps/playback.c | 11 | ||||
-rw-r--r-- | apps/playback.h | 1 | ||||
-rw-r--r-- | apps/playlist.c | 25 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/plugin.h | 4 |
7 files changed, 22 insertions, 24 deletions
diff --git a/apps/metadata.h b/apps/metadata.h index a520f40989..1ab391cbba 100644 --- a/apps/metadata.h +++ b/apps/metadata.h | |||
@@ -266,7 +266,6 @@ struct mp3entry { | |||
266 | 266 | ||
267 | /* resume related */ | 267 | /* resume related */ |
268 | unsigned long offset; /* bytes played */ | 268 | unsigned long offset; /* bytes played */ |
269 | int index; /* playlist index */ | ||
270 | 269 | ||
271 | #ifdef HAVE_TAGCACHE | 270 | #ifdef HAVE_TAGCACHE |
272 | unsigned char autoresumable; /* caches result of autoresumable() */ | 271 | unsigned char autoresumable; /* caches result of autoresumable() */ |
diff --git a/apps/mpeg.c b/apps/mpeg.c index 690e530d9b..62947e0ae7 100644 --- a/apps/mpeg.c +++ b/apps/mpeg.c | |||
@@ -2751,7 +2751,6 @@ void audio_next(void) | |||
2751 | continue; | 2751 | continue; |
2752 | } | 2752 | } |
2753 | index = playlist_next(steps); | 2753 | index = playlist_next(steps); |
2754 | taginfo.index = index; | ||
2755 | current_track_counter++; | 2754 | current_track_counter++; |
2756 | is_playing = true; | 2755 | is_playing = true; |
2757 | playing = true; | 2756 | playing = true; |
@@ -2780,7 +2779,6 @@ void audio_prev(void) | |||
2780 | continue; | 2779 | continue; |
2781 | } | 2780 | } |
2782 | index = playlist_next(steps); | 2781 | index = playlist_next(steps); |
2783 | taginfo.index = index; | ||
2784 | current_track_counter++; | 2782 | current_track_counter++; |
2785 | is_playing = true; | 2783 | is_playing = true; |
2786 | playing = true; | 2784 | playing = true; |
diff --git a/apps/playback.c b/apps/playback.c index 457553067e..632fd05d3d 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -233,15 +233,6 @@ static void audio_stop_playback(void); | |||
233 | 233 | ||
234 | /**************************************/ | 234 | /**************************************/ |
235 | 235 | ||
236 | /** Playlist callback */ | ||
237 | |||
238 | /* This callback is required to update the resume index in case of changing | ||
239 | * a playlist and pausing/resuming before the next track change. */ | ||
240 | void playback_set_playlist_index(int index) | ||
241 | { | ||
242 | thistrack_id3->index = index; | ||
243 | } | ||
244 | |||
245 | /** Pcmbuf callbacks */ | 236 | /** Pcmbuf callbacks */ |
246 | 237 | ||
247 | /* Between the codec and PCM track change, we need to keep updating the | 238 | /* Between the codec and PCM track change, we need to keep updating the |
@@ -2216,7 +2207,7 @@ static void audio_thread(void) | |||
2216 | /* PCM track change done */ | 2207 | /* PCM track change done */ |
2217 | LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED"); | 2208 | LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED"); |
2218 | /* Set new playlist position for resuming. */ | 2209 | /* Set new playlist position for resuming. */ |
2219 | thistrack_id3->index = playlist_get_index(); | 2210 | playlist_update_resume_index(); |
2220 | if (filling != STATE_ENDING) | 2211 | if (filling != STATE_ENDING) |
2221 | audio_finalise_track_change(); | 2212 | audio_finalise_track_change(); |
2222 | else if (playing) | 2213 | else if (playing) |
diff --git a/apps/playback.h b/apps/playback.h index 3597ff542f..76c394603f 100644 --- a/apps/playback.h +++ b/apps/playback.h | |||
@@ -67,7 +67,6 @@ long audio_filebufused(void); | |||
67 | void audio_pre_ff_rewind(void); | 67 | void audio_pre_ff_rewind(void); |
68 | void audio_skip(int direction); | 68 | void audio_skip(int direction); |
69 | void audio_hard_stop(void); /* Stops audio from serving playback */ | 69 | void audio_hard_stop(void); /* Stops audio from serving playback */ |
70 | void playback_set_playlist_index(int index); | ||
71 | #ifdef HAVE_CROSSFADE | 70 | #ifdef HAVE_CROSSFADE |
72 | void audio_set_crossfade(int enable); | 71 | void audio_set_crossfade(int enable); |
73 | #endif | 72 | #endif |
diff --git a/apps/playlist.c b/apps/playlist.c index c15c394b4c..6c1d97a6ef 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -821,7 +821,7 @@ static int add_track_to_playlist(struct playlist_info* playlist, | |||
821 | playlist->num_inserted_tracks++; | 821 | playlist->num_inserted_tracks++; |
822 | 822 | ||
823 | /* Update index for resume. */ | 823 | /* Update index for resume. */ |
824 | playback_set_playlist_index(playlist->index); | 824 | playlist_update_resume_index(); |
825 | 825 | ||
826 | return insert_position; | 826 | return insert_position; |
827 | } | 827 | } |
@@ -924,7 +924,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist, | |||
924 | } | 924 | } |
925 | 925 | ||
926 | /* Update index for resume. */ | 926 | /* Update index for resume. */ |
927 | playback_set_playlist_index(playlist->index); | 927 | playlist_update_resume_index(); |
928 | 928 | ||
929 | return 0; | 929 | return 0; |
930 | } | 930 | } |
@@ -986,7 +986,7 @@ static int randomise_playlist(struct playlist_info* playlist, | |||
986 | } | 986 | } |
987 | 987 | ||
988 | /* Update index for resume. */ | 988 | /* Update index for resume. */ |
989 | playback_set_playlist_index(playlist->index); | 989 | playlist_update_resume_index(); |
990 | 990 | ||
991 | return 0; | 991 | return 0; |
992 | } | 992 | } |
@@ -1029,7 +1029,7 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current, | |||
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | /* Update index for resume. */ | 1031 | /* Update index for resume. */ |
1032 | playback_set_playlist_index(playlist->index); | 1032 | playlist_update_resume_index(); |
1033 | 1033 | ||
1034 | return 0; | 1034 | return 0; |
1035 | } | 1035 | } |
@@ -1205,7 +1205,7 @@ static void find_and_set_playlist_index(struct playlist_info* playlist, | |||
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | /* Update index for resume. */ | 1207 | /* Update index for resume. */ |
1208 | playback_set_playlist_index(playlist->index); | 1208 | playlist_update_resume_index(); |
1209 | } | 1209 | } |
1210 | 1210 | ||
1211 | /* | 1211 | /* |
@@ -2633,15 +2633,24 @@ int playlist_get_index(void) | |||
2633 | return current_playlist.index; | 2633 | return current_playlist.index; |
2634 | } | 2634 | } |
2635 | 2635 | ||
2636 | /* Update resume index within playlist_info structure. */ | ||
2637 | void playlist_update_resume_index(void) | ||
2638 | { | ||
2639 | struct playlist_info* playlist = ¤t_playlist; | ||
2640 | playlist->resume_index = playlist->index; | ||
2641 | } | ||
2642 | |||
2636 | /* Update resume info for current playing song. Returns -1 on error. */ | 2643 | /* Update resume info for current playing song. Returns -1 on error. */ |
2637 | int playlist_update_resume_info(const struct mp3entry* id3) | 2644 | int playlist_update_resume_info(const struct mp3entry* id3) |
2638 | { | 2645 | { |
2646 | struct playlist_info* playlist = ¤t_playlist; | ||
2647 | |||
2639 | if (id3) | 2648 | if (id3) |
2640 | { | 2649 | { |
2641 | if (global_status.resume_index != id3->index || | 2650 | if (global_status.resume_index != playlist->resume_index || |
2642 | global_status.resume_offset != id3->offset) | 2651 | global_status.resume_offset != id3->offset) |
2643 | { | 2652 | { |
2644 | global_status.resume_index = id3->index; | 2653 | global_status.resume_index = playlist->resume_index; |
2645 | global_status.resume_offset = id3->offset; | 2654 | global_status.resume_offset = id3->offset; |
2646 | status_save(); | 2655 | status_save(); |
2647 | } | 2656 | } |
@@ -3190,7 +3199,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index) | |||
3190 | #endif | 3199 | #endif |
3191 | 3200 | ||
3192 | /* Update index for resume. */ | 3201 | /* Update index for resume. */ |
3193 | playback_set_playlist_index(playlist->index); | 3202 | playlist_update_resume_index(); |
3194 | 3203 | ||
3195 | return result; | 3204 | return result; |
3196 | } | 3205 | } |
diff --git a/apps/playlist.h b/apps/playlist.h index e5826202fb..a0e3b579f7 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -90,6 +90,7 @@ struct playlist_info | |||
90 | int buffer_end_pos; /* last position where buffer was written */ | 90 | int buffer_end_pos; /* last position where buffer was written */ |
91 | int index; /* index of current playing track */ | 91 | int index; /* index of current playing track */ |
92 | int first_index; /* index of first song in playlist */ | 92 | int first_index; /* index of first song in playlist */ |
93 | int resume_index; /* index of playing track to resume */ | ||
93 | int amount; /* number of tracks in the index */ | 94 | int amount; /* number of tracks in the index */ |
94 | int last_insert_pos; /* last position we inserted a track */ | 95 | int last_insert_pos; /* last position we inserted a track */ |
95 | int seed; /* shuffle seed */ | 96 | int seed; /* shuffle seed */ |
@@ -175,5 +176,6 @@ int playlist_directory_tracksearch(const char* dirname, bool recurse, | |||
175 | int (*callback)(char*, void*), | 176 | int (*callback)(char*, void*), |
176 | void* context); | 177 | void* context); |
177 | int playlist_remove_all_tracks(struct playlist_info *playlist); | 178 | int playlist_remove_all_tracks(struct playlist_info *playlist); |
179 | void playlist_update_resume_index(void); | ||
178 | 180 | ||
179 | #endif /* __PLAYLIST_H__ */ | 181 | #endif /* __PLAYLIST_H__ */ |
diff --git a/apps/plugin.h b/apps/plugin.h index 13b66e1202..4537c6670b 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -145,12 +145,12 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
145 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 145 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
146 | 146 | ||
147 | /* increase this every time the api struct changes */ | 147 | /* increase this every time the api struct changes */ |
148 | #define PLUGIN_API_VERSION 202 | 148 | #define PLUGIN_API_VERSION 203 |
149 | 149 | ||
150 | /* update this to latest version if a change to the api struct breaks | 150 | /* update this to latest version if a change to the api struct breaks |
151 | backwards compatibility (and please take the opportunity to sort in any | 151 | backwards compatibility (and please take the opportunity to sort in any |
152 | new function which are "waiting" at the end of the function table) */ | 152 | new function which are "waiting" at the end of the function table) */ |
153 | #define PLUGIN_MIN_API_VERSION 202 | 153 | #define PLUGIN_MIN_API_VERSION 203 |
154 | 154 | ||
155 | /* plugin return codes */ | 155 | /* plugin return codes */ |
156 | /* internal returns start at 0x100 to make exit(1..255) work */ | 156 | /* internal returns start at 0x100 to make exit(1..255) work */ |