summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-04-27 03:08:23 +0000
commitc537d5958e8b421ac4f9bef6c8b9e7425a6cf167 (patch)
tree7ed36518fb6524da7bbd913ba7619b85b5d15d23 /apps/playlist.c
parentdcf0f8de4a37ff1d2ea510aef75fa67977a8bdcc (diff)
Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 14ebb7a198..d17bf230a5 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -822,9 +822,6 @@ static int add_track_to_playlist(struct playlist_info* playlist,
playlist->amount++;
playlist->num_inserted_tracks++;
- /* Update index for resume. */
- playlist_update_resume_index();
-
return insert_position;
}
@@ -925,9 +922,6 @@ static int remove_track_from_playlist(struct playlist_info* playlist,
sync_control(playlist, false);
}
- /* Update index for resume. */
- playlist_update_resume_index();
-
return 0;
}
@@ -987,9 +981,6 @@ static int randomise_playlist(struct playlist_info* playlist,
playlist->first_index, NULL, NULL, NULL);
}
- /* Update index for resume. */
- playlist_update_resume_index();
-
return 0;
}
@@ -1030,9 +1021,6 @@ static int sort_playlist(struct playlist_info* playlist, bool start_current,
playlist->first_index, -1, NULL, NULL, NULL);
}
- /* Update index for resume. */
- playlist_update_resume_index();
-
return 0;
}
@@ -1205,9 +1193,6 @@ static void find_and_set_playlist_index(struct playlist_info* playlist,
break;
}
}
-
- /* Update index for resume. */
- playlist_update_resume_index();
}
/*
@@ -2486,6 +2471,12 @@ const char* playlist_peek(int steps, char* buf, size_t buf_size)
if (index < 0)
return NULL;
+#if CONFIG_CODEC == SWCODEC
+ /* Just testing - don't care about the file name */
+ if (!buf || !buf_size)
+ return "";
+#endif
+
control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK;
seek = playlist->indices[index] & PLAYLIST_SEEK_MASK;
@@ -2632,30 +2623,17 @@ int playlist_get_resume_info(int *resume_index)
return 0;
}
-/* Get current playlist index. */
-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 != playlist->resume_index ||
+ if (global_status.resume_index != playlist->index ||
global_status.resume_offset != id3->offset)
{
- global_status.resume_index = playlist->resume_index;
+ global_status.resume_index = playlist->index;
global_status.resume_offset = id3->offset;
status_save();
}
@@ -3203,9 +3181,6 @@ int playlist_move(struct playlist_info* playlist, int index, int new_index)
queue_post(&playlist_queue, PLAYLIST_LOAD_POINTERS, 0);
#endif
- /* Update index for resume. */
- playlist_update_resume_index();
-
return result;
}