diff options
author | Hardeep Sidhu <dyp@pobox.com> | 2003-07-25 23:04:59 +0000 |
---|---|---|
committer | Hardeep Sidhu <dyp@pobox.com> | 2003-07-25 23:04:59 +0000 |
commit | 48c2d0f929528cdd871e761b40662f8b616422f1 (patch) | |
tree | 9943480478e9de90bc258a325b0bdf3a50970926 /apps/plugin.h | |
parent | 7d889c87df474e683ad69d063375c3c9286e36ec (diff) | |
download | rockbox-48c2d0f929528cdd871e761b40662f8b616422f1.tar.gz rockbox-48c2d0f929528cdd871e761b40662f8b616422f1.zip |
Allow older versions of plugins to run so long as plugin api struct changes don't break backwards compatibility. Also added call to retrieve the portion of plugin buffer that is not being used by plugin.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3888 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugin.h')
-rw-r--r-- | apps/plugin.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index 3d6859b0d3..5bebcd701f 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -43,7 +43,11 @@ | |||
43 | #include "mpeg.h" | 43 | #include "mpeg.h" |
44 | 44 | ||
45 | /* increase this every time the api struct changes */ | 45 | /* increase this every time the api struct changes */ |
46 | #define PLUGIN_API_VERSION 6 | 46 | #define PLUGIN_API_VERSION 7 |
47 | |||
48 | /* update this to latest version if a change to the api struct breaks | ||
49 | backwards compatibility */ | ||
50 | #define PLUGIN_MIN_API_VERSION 6 | ||
47 | 51 | ||
48 | /* plugin return codes */ | 52 | /* plugin return codes */ |
49 | enum plugin_status { | 53 | enum plugin_status { |
@@ -75,6 +79,12 @@ do { \ | |||
75 | return _rc_; \ | 79 | return _rc_; \ |
76 | } while(0) | 80 | } while(0) |
77 | 81 | ||
82 | /* NOTE: To support backwards compatibility, only add new functions at | ||
83 | the end of the structure. Every time you add a new function, | ||
84 | remember to increase PLUGIN_API_VERSION. If you make changes to the | ||
85 | existing APIs then also update PLUGIN_MIN_API_VERSION to current | ||
86 | version | ||
87 | */ | ||
78 | struct plugin_api { | 88 | struct plugin_api { |
79 | /* these two fields must always be first, to ensure | 89 | /* these two fields must always be first, to ensure |
80 | TEST_PLUGIN_API will always work */ | 90 | TEST_PLUGIN_API will always work */ |
@@ -170,10 +180,12 @@ struct plugin_api { | |||
170 | struct mp3entry* (*mpeg_current_track)(void); | 180 | struct mp3entry* (*mpeg_current_track)(void); |
171 | int (*atoi)(const char *str); | 181 | int (*atoi)(const char *str); |
172 | struct tm* (*get_time)(void); | 182 | struct tm* (*get_time)(void); |
183 | void* (*plugin_get_buffer)(int* buffer_size); | ||
173 | }; | 184 | }; |
174 | 185 | ||
175 | /* defined by the plugin loader (plugin.c) */ | 186 | /* defined by the plugin loader (plugin.c) */ |
176 | int plugin_load(char* plugin, void* parameter); | 187 | int plugin_load(char* plugin, void* parameter); |
188 | void* plugin_get_buffer(int *buffer_size); | ||
177 | 189 | ||
178 | /* defined by the plugin */ | 190 | /* defined by the plugin */ |
179 | enum plugin_status plugin_start(struct plugin_api* rockbox, void* parameter) | 191 | enum plugin_status plugin_start(struct plugin_api* rockbox, void* parameter) |