summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-07 21:38:51 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-07 21:38:51 +0000
commit39d9d8bab1e46c83df4a35f50d9217b6912b7097 (patch)
treee84916e2263ae7da193549973b93bf3d6fad6939
parent4df825be4325919a843cdb1181bc435645212a51 (diff)
downloadrockbox-39d9d8bab1e46c83df4a35f50d9217b6912b7097.tar.gz
rockbox-39d9d8bab1e46c83df4a35f50d9217b6912b7097.tar.bz2
rockbox-39d9d8bab1e46c83df4a35f50d9217b6912b7097.zip
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.h1
-rw-r--r--apps/mpeg.c2
-rw-r--r--apps/playback.c11
-rw-r--r--apps/playback.h1
-rw-r--r--apps/playlist.c25
-rw-r--r--apps/playlist.h2
-rw-r--r--apps/plugin.h4
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 {
/* 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 690e530d9b..62947e0ae7 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 457553067e..632fd05d3d 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 3597ff542f..76c394603f 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 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,
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 = &current_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 = &current_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 e5826202fb..a0e3b579f7 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 13b66e1202..4537c6670b 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 */