From 6e44209a4c60995b8e6c6736f14d6d88bf906ac5 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 12 Mar 2007 13:41:52 +0000 Subject: Make the Play / Pause option restart playback if its stopped also git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12738 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugin.c | 3 +++ apps/plugin.h | 5 ++++- apps/plugins/lib/playback_control.c | 11 ++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/plugin.c b/apps/plugin.c index a2d7129f06..5fc837f656 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -484,6 +484,9 @@ static const struct plugin_api rockbox_api = { detect_flashed_ramimage, detect_flashed_romimage, #endif + playlist_resume, + playlist_start, + &global_status, }; int plugin_load(const char* plugin, void* parameter) diff --git a/apps/plugin.h b/apps/plugin.h index c14b06f487..e16959681c 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -110,7 +110,7 @@ #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 47 +#define PLUGIN_API_VERSION 48 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any @@ -598,6 +598,9 @@ struct plugin_api { bool (*detect_flashed_ramimage)(void); bool (*detect_flashed_romimage)(void); #endif + int (*playlist_resume)(void); + int (*playlist_start)(int start_index, int offset); + struct system_status *global_status; }; /* plugin header */ diff --git a/apps/plugins/lib/playback_control.c b/apps/plugins/lib/playback_control.c index 27460bbc3b..8a1381a1e7 100644 --- a/apps/plugins/lib/playback_control.c +++ b/apps/plugins/lib/playback_control.c @@ -29,7 +29,16 @@ bool prevtrack(void) bool play(void) { - if (api->audio_status() & AUDIO_STATUS_PAUSE) + int audio_status = api->audio_status(); + if (!audio_status && api->global_status->resume_index != -1) + { + if (api->playlist_resume() != -1) + { + api->playlist_start(api->global_status->resume_index, + api->global_status->resume_offset); + } + } + else if (audio_status & AUDIO_STATUS_PAUSE) api->audio_resume(); else api->audio_pause(); -- cgit v1.2.3