diff options
| author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-07 21:38:51 +0000 |
|---|---|---|
| committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-04-07 21:38:51 +0000 |
| commit | 39d9d8bab1e46c83df4a35f50d9217b6912b7097 (patch) | |
| tree | e84916e2263ae7da193549973b93bf3d6fad6939 | |
| parent | 4df825be4325919a843cdb1181bc435645212a51 (diff) | |
| download | rockbox-39d9d8bab1e46c83df4a35f50d9217b6912b7097.zip rockbox-39d9d8bab1e46c83df4a35f50d9217b6912b7097.tar.gz rockbox-39d9d8bab1e46c83df4a35f50d9217b6912b7097.tar.bz2 rockbox-39d9d8bab1e46c83df4a35f50d9217b6912b7097.tar.xz | |
Fix red and yellow. Move resume_index from mp3entry to playlist_info struct. Bump codec api.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29691 a1c6a512-1295-4272-9138-f99709370657
| -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 a520f40..1ab391c 100644 --- a/apps/metadata.h +++ b/apps/metadata.h @@ -266,7 +266,6 @@ struct mp3entry { /* resume related */ unsigned long offset; /* bytes played */ - int index; /* playlist index */ #ifdef HAVE_TAGCACHE unsigned char autoresumable; /* caches result of autoresumable() */ diff --git a/apps/mpeg.c b/apps/mpeg.c index 690e530..62947e0 100644 --- a/apps/mpeg.c +++ b/apps/mpeg.c @@ -2751,7 +2751,6 @@ void audio_next(void) continue; } index = playlist_next(steps); - taginfo.index = index; current_track_counter++; is_playing = true; playing = true; @@ -2780,7 +2779,6 @@ void audio_prev(void) continue; } index = playlist_next(steps); - taginfo.index = index; current_track_counter++; is_playing = true; playing = true; diff --git a/apps/playback.c b/apps/playback.c index 4575530..632fd05 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -233,15 +233,6 @@ static void audio_stop_playback(void); /**************************************/ -/** Playlist callback */ - -/* This callback is required to update the resume index in case of changing - * a playlist and pausing/resuming before the next track change. */ -void playback_set_playlist_index(int index) -{ - thistrack_id3->index = index; -} - /** Pcmbuf callbacks */ /* Between the codec and PCM track change, we need to keep updating the @@ -2216,7 +2207,7 @@ static void audio_thread(void) /* PCM track change done */ LOGFQUEUE("audio < Q_AUDIO_TRACK_CHANGED"); /* Set new playlist position for resuming. */ - thistrack_id3->index = playlist_get_index(); + playlist_update_resume_index(); if (filling != STATE_ENDING) audio_finalise_track_change(); else if (playing) diff --git a/apps/playback.h b/apps/playback.h index 3597ff5..76c3946 100644 --- a/apps/playback.h +++ b/apps/playback.h @@ -67,7 +67,6 @@ long audio_filebufused(void); void audio_pre_ff_rewind(void); void audio_skip(int direction); void audio_hard_stop(void); /* Stops audio from serving playback */ -void playback_set_playlist_index(int index); #ifdef HAVE_CROSSFADE void audio_set_crossfade(int enable); #endif diff --git a/apps/playlist.c b/apps/playlist.c index c15c394..6c1d97a 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -821,7 +821,7 @@ static int add_track_to_playlist(struct playlist_info* playlist, playlist->num_inserted_tracks++; /* Update index for resume. */ - playback_set_playlist_index(playlist->index); + playlist_update_resume_index(); return insert_position; } @@ -924,7 +924,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist, } /* Update index for resume. */ - playback_set_playlist_index(playlist->index); + playlist_update_resume_index(); return 0; } @@ -986,7 +986,7 @@ static int randomise_playlist(struct playlist_info* playlist, } /* Update index for resume. */ - playback_set_playlist_index(playlist->index); + playlist_update_resume_index(); return 0; } @@ -1029,7 +1029,7 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current, } /* Update index for resume. */ - playback_set_playlist_index(playlist->index); + playlist_update_resume_index(); return 0; } @@ -1205,7 +1205,7 @@ static void find_and_set_playlist_index(struct playlist_info* playlist, } /* Update index for resume. */ - playback_set_playlist_index(playlist->index); + playlist_update_resume_index(); } /* @@ -2633,15 +2633,24 @@ int playlist_get_index(void) return current_playlist.index; } +/* Update resume index within playlist_info structure. */ +void playlist_update_resume_index(void) +{ + struct playlist_info* playlist = ¤t_playlist; + playlist->resume_index = playlist->index; +} + /* Update resume info for current playing song. Returns -1 on error. */ int playlist_update_resume_info(const struct mp3entry* id3) { + struct playlist_info* playlist = ¤t_playlist; + if (id3) { - if (global_status.resume_index != id3->index || + if (global_status.resume_index != playlist->resume_index || global_status.resume_offset != id3->offset) { - global_status.resume_index = id3->index; + global_status.resume_index = playlist->resume_index; global_status.resume_offset = id3->offset; status_save(); } @@ -3190,7 +3199,7 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index) #endif /* Update index for resume. */ - playback_set_playlist_index(playlist->index); + playlist_update_resume_index(); return result; } diff --git a/apps/playlist.h b/apps/playlist.h index e582620..a0e3b57 100644 --- a/apps/playlist.h +++ b/apps/playlist.h @@ -90,6 +90,7 @@ struct playlist_info int buffer_end_pos; /* last position where buffer was written */ int index; /* index of current playing track */ int first_index; /* index of first song in playlist */ + int resume_index; /* index of playing track to resume */ int amount; /* number of tracks in the index */ int last_insert_pos; /* last position we inserted a track */ int seed; /* shuffle seed */ @@ -175,5 +176,6 @@ int playlist_directory_tracksearch(const char* dirname, bool recurse, int (*callback)(char*, void*), void* context); int playlist_remove_all_tracks(struct playlist_info *playlist); +void playlist_update_resume_index(void); #endif /* __PLAYLIST_H__ */ diff --git a/apps/plugin.h b/apps/plugin.h index 13b66e1..4537c66 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -145,12 +145,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 202 +#define PLUGIN_API_VERSION 203 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 202 +#define PLUGIN_MIN_API_VERSION 203 /* plugin return codes */ /* internal returns start at 0x100 to make exit(1..255) work */ |