diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs.c | 2 | ||||
-rw-r--r-- | apps/plugin.c | 19 | ||||
-rw-r--r-- | apps/plugin.h | 9 | ||||
-rw-r--r-- | apps/plugins/random_folder_advance_config.c | 3 |
4 files changed, 20 insertions, 13 deletions
diff --git a/apps/codecs.c b/apps/codecs.c index 18022d9df3..e84cdf88aa 100644 --- a/apps/codecs.c +++ b/apps/codecs.c | |||
@@ -71,8 +71,6 @@ extern unsigned char codecbuf[]; | |||
71 | 71 | ||
72 | static size_t codec_size; | 72 | static size_t codec_size; |
73 | 73 | ||
74 | extern void* plugin_get_audio_buffer(size_t *buffer_size); | ||
75 | |||
76 | struct codec_api ci = { | 74 | struct codec_api ci = { |
77 | 75 | ||
78 | 0, /* filesize */ | 76 | 0, /* filesize */ |
diff --git a/apps/plugin.c b/apps/plugin.c index f9179f3f08..93779d7a6c 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -129,6 +129,10 @@ static int close_wrapper(int fd); | |||
129 | static int creat_wrapper(const char *pathname, mode_t mode); | 129 | static int creat_wrapper(const char *pathname, mode_t mode); |
130 | #endif | 130 | #endif |
131 | 131 | ||
132 | static void* plugin_get_audio_buffer(size_t *buffer_size); | ||
133 | static void plugin_release_audio_buffer(void); | ||
134 | static void plugin_tsr(bool (*exit_callback)(bool)); | ||
135 | |||
132 | static const struct plugin_api rockbox_api = { | 136 | static const struct plugin_api rockbox_api = { |
133 | 137 | ||
134 | /* lcd */ | 138 | /* lcd */ |
@@ -692,8 +696,8 @@ static const struct plugin_api rockbox_api = { | |||
692 | mktime, | 696 | mktime, |
693 | #endif | 697 | #endif |
694 | plugin_get_buffer, | 698 | plugin_get_buffer, |
695 | plugin_get_audio_buffer, | 699 | plugin_get_audio_buffer, /* defined in plugin.c */ |
696 | plugin_tsr, | 700 | plugin_tsr, /* defined in plugin.c */ |
697 | plugin_get_current_filename, | 701 | plugin_get_current_filename, |
698 | #if defined(DEBUG) || defined(SIMULATOR) | 702 | #if defined(DEBUG) || defined(SIMULATOR) |
699 | debugf, | 703 | debugf, |
@@ -800,6 +804,7 @@ static const struct plugin_api rockbox_api = { | |||
800 | 804 | ||
801 | /* new stuff at the end, sort into place next time | 805 | /* new stuff at the end, sort into place next time |
802 | the API gets incompatible */ | 806 | the API gets incompatible */ |
807 | plugin_release_audio_buffer, /* defined in plugin.c */ | ||
803 | }; | 808 | }; |
804 | 809 | ||
805 | static int plugin_buffer_handle; | 810 | static int plugin_buffer_handle; |
@@ -994,7 +999,7 @@ void* plugin_get_buffer(size_t *buffer_size) | |||
994 | Playback gets stopped, to avoid conflicts. | 999 | Playback gets stopped, to avoid conflicts. |
995 | Talk buffer is stolen as well. | 1000 | Talk buffer is stolen as well. |
996 | */ | 1001 | */ |
997 | void* plugin_get_audio_buffer(size_t *buffer_size) | 1002 | static void* plugin_get_audio_buffer(size_t *buffer_size) |
998 | { | 1003 | { |
999 | /* dummy ops with no callbacks, needed because by | 1004 | /* dummy ops with no callbacks, needed because by |
1000 | * default buflib buffers can be moved around which must be avoided */ | 1005 | * default buflib buffers can be moved around which must be avoided */ |
@@ -1004,10 +1009,16 @@ void* plugin_get_audio_buffer(size_t *buffer_size) | |||
1004 | return core_get_data(plugin_buffer_handle); | 1009 | return core_get_data(plugin_buffer_handle); |
1005 | } | 1010 | } |
1006 | 1011 | ||
1012 | static void plugin_release_audio_buffer(void) | ||
1013 | { | ||
1014 | if (plugin_buffer_handle > 0) | ||
1015 | plugin_buffer_handle = core_free(plugin_buffer_handle); | ||
1016 | } | ||
1017 | |||
1007 | /* The plugin wants to stay resident after leaving its main function, e.g. | 1018 | /* The plugin wants to stay resident after leaving its main function, e.g. |
1008 | runs from timer or own thread. The callback is registered to later | 1019 | runs from timer or own thread. The callback is registered to later |
1009 | instruct it to free its resources before a new plugin gets loaded. */ | 1020 | instruct it to free its resources before a new plugin gets loaded. */ |
1010 | void plugin_tsr(bool (*exit_callback)(bool)) | 1021 | static void plugin_tsr(bool (*exit_callback)(bool)) |
1011 | { | 1022 | { |
1012 | pfn_tsr_exit = exit_callback; /* remember the callback for later */ | 1023 | pfn_tsr_exit = exit_callback; /* remember the callback for later */ |
1013 | } | 1024 | } |
diff --git a/apps/plugin.h b/apps/plugin.h index 874f6e0069..6a15f86919 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -160,7 +160,7 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
160 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 160 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
161 | 161 | ||
162 | /* increase this every time the api struct changes */ | 162 | /* increase this every time the api struct changes */ |
163 | #define PLUGIN_API_VERSION 228 | 163 | #define PLUGIN_API_VERSION 229 |
164 | 164 | ||
165 | /* update this to latest version if a change to the api struct breaks | 165 | /* update this to latest version if a change to the api struct breaks |
166 | backwards compatibility (and please take the opportunity to sort in any | 166 | backwards compatibility (and please take the opportunity to sort in any |
@@ -976,6 +976,7 @@ struct plugin_api { | |||
976 | 976 | ||
977 | /* new stuff at the end, sort into place next time | 977 | /* new stuff at the end, sort into place next time |
978 | the API gets incompatible */ | 978 | the API gets incompatible */ |
979 | void (*plugin_release_audio_buffer)(void); | ||
979 | }; | 980 | }; |
980 | 981 | ||
981 | /* plugin header */ | 982 | /* plugin header */ |
@@ -1006,12 +1007,6 @@ extern unsigned char plugin_end_addr[]; | |||
1006 | #endif /* PLUGIN */ | 1007 | #endif /* PLUGIN */ |
1007 | 1008 | ||
1008 | int plugin_load(const char* plugin, const void* parameter); | 1009 | int plugin_load(const char* plugin, const void* parameter); |
1009 | void* plugin_get_audio_buffer(size_t *buffer_size); | ||
1010 | |||
1011 | /* plugin_tsr, | ||
1012 | callback returns true to allow the new plugin to load, | ||
1013 | reenter means the currently running plugin is being reloaded */ | ||
1014 | void plugin_tsr(bool (*exit_callback)(bool reenter)); | ||
1015 | 1010 | ||
1016 | /* defined by the plugin */ | 1011 | /* defined by the plugin */ |
1017 | extern const struct plugin_api *rb; | 1012 | extern const struct plugin_api *rb; |
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 0b3532dde0..add1fc5724 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c | |||
@@ -541,6 +541,9 @@ static int start_shuffled_play(void) | |||
541 | } | 541 | } |
542 | } | 542 | } |
543 | rb->splash(HZ, "Done"); | 543 | rb->splash(HZ, "Done"); |
544 | /* the core needs the audio buffer back in order to start playback. */ | ||
545 | list = NULL; | ||
546 | rb->plugin_release_audio_buffer(); | ||
544 | rb->playlist_start(0, 0, 0); | 547 | rb->playlist_start(0, 0, 0); |
545 | return 1; | 548 | return 1; |
546 | } | 549 | } |