diff options
-rw-r--r-- | apps/plugin.c | 3 | ||||
-rw-r--r-- | apps/plugin.h | 5 | ||||
-rw-r--r-- | 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 = { | |||
484 | detect_flashed_ramimage, | 484 | detect_flashed_ramimage, |
485 | detect_flashed_romimage, | 485 | detect_flashed_romimage, |
486 | #endif | 486 | #endif |
487 | playlist_resume, | ||
488 | playlist_start, | ||
489 | &global_status, | ||
487 | }; | 490 | }; |
488 | 491 | ||
489 | int plugin_load(const char* plugin, void* parameter) | 492 | 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 @@ | |||
110 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 110 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
111 | 111 | ||
112 | /* increase this every time the api struct changes */ | 112 | /* increase this every time the api struct changes */ |
113 | #define PLUGIN_API_VERSION 47 | 113 | #define PLUGIN_API_VERSION 48 |
114 | 114 | ||
115 | /* update this to latest version if a change to the api struct breaks | 115 | /* update this to latest version if a change to the api struct breaks |
116 | backwards compatibility (and please take the opportunity to sort in any | 116 | backwards compatibility (and please take the opportunity to sort in any |
@@ -598,6 +598,9 @@ struct plugin_api { | |||
598 | bool (*detect_flashed_ramimage)(void); | 598 | bool (*detect_flashed_ramimage)(void); |
599 | bool (*detect_flashed_romimage)(void); | 599 | bool (*detect_flashed_romimage)(void); |
600 | #endif | 600 | #endif |
601 | int (*playlist_resume)(void); | ||
602 | int (*playlist_start)(int start_index, int offset); | ||
603 | struct system_status *global_status; | ||
601 | }; | 604 | }; |
602 | 605 | ||
603 | /* plugin header */ | 606 | /* 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) | |||
29 | 29 | ||
30 | bool play(void) | 30 | bool play(void) |
31 | { | 31 | { |
32 | if (api->audio_status() & AUDIO_STATUS_PAUSE) | 32 | int audio_status = api->audio_status(); |
33 | if (!audio_status && api->global_status->resume_index != -1) | ||
34 | { | ||
35 | if (api->playlist_resume() != -1) | ||
36 | { | ||
37 | api->playlist_start(api->global_status->resume_index, | ||
38 | api->global_status->resume_offset); | ||
39 | } | ||
40 | } | ||
41 | else if (audio_status & AUDIO_STATUS_PAUSE) | ||
33 | api->audio_resume(); | 42 | api->audio_resume(); |
34 | else | 43 | else |
35 | api->audio_pause(); | 44 | api->audio_pause(); |