diff options
Diffstat (limited to 'apps/plugin.c')
-rw-r--r-- | apps/plugin.c | 19 |
1 files changed, 15 insertions, 4 deletions
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 | } |