summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugin.c105
-rw-r--r--apps/plugin.h113
-rw-r--r--apps/plugins/vbrfix.c2
-rw-r--r--apps/talk.c2
4 files changed, 97 insertions, 125 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index 413caf87a1..e5a496c567 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -88,19 +88,25 @@ static const struct plugin_api rockbox_api = {
88 lcd_puts, 88 lcd_puts,
89 lcd_puts_scroll, 89 lcd_puts_scroll,
90 lcd_stop_scroll, 90 lcd_stop_scroll,
91 lcd_set_contrast,
91#ifdef HAVE_LCD_CHARCELLS 92#ifdef HAVE_LCD_CHARCELLS
92 lcd_define_pattern, 93 lcd_define_pattern,
93 lcd_get_locked_pattern, 94 lcd_get_locked_pattern,
94 lcd_unlock_pattern, 95 lcd_unlock_pattern,
95 lcd_putc, 96 lcd_putc,
97 lcd_put_cursor,
98 lcd_remove_cursor,
99 lcd_icon,
96#else 100#else
97 lcd_putsxy, 101 lcd_putsxy,
102 lcd_puts_style,
98 lcd_bitmap, 103 lcd_bitmap,
99 lcd_drawline, 104 lcd_drawline,
100 lcd_clearline, 105 lcd_clearline,
101 lcd_drawpixel, 106 lcd_drawpixel,
102 lcd_clearpixel, 107 lcd_clearpixel,
103 lcd_setfont, 108 lcd_setfont,
109 font_get,
104 lcd_clearrect, 110 lcd_clearrect,
105 lcd_fillrect, 111 lcd_fillrect,
106 lcd_drawrect, 112 lcd_drawrect,
@@ -109,14 +115,21 @@ static const struct plugin_api rockbox_api = {
109 lcd_update, 115 lcd_update,
110 lcd_update_rect, 116 lcd_update_rect,
111 scrollbar, 117 scrollbar,
118 checkbox,
119 &lcd_framebuffer[0][0],
120 lcd_blit,
112#ifndef SIMULATOR 121#ifndef SIMULATOR
113 lcd_roll, 122 lcd_roll,
114#endif 123#endif
115#endif 124#endif
125 backlight_on,
126 backlight_off,
116 127
117 /* button */ 128 /* button */
118 button_get, 129 button_get,
119 button_get_w_tmo, 130 button_get_w_tmo,
131 button_status,
132 button_clear_queue,
120 133
121 /* file */ 134 /* file */
122 (open_func)PREFIX(open), 135 (open_func)PREFIX(open),
@@ -131,6 +144,7 @@ static const struct plugin_api rockbox_api = {
131 PREFIX(filesize), 144 PREFIX(filesize),
132 fprintf, 145 fprintf,
133 read_line, 146 read_line,
147 settings_parseline,
134 148
135 /* dir */ 149 /* dir */
136 PREFIX(opendir), 150 PREFIX(opendir),
@@ -139,14 +153,21 @@ static const struct plugin_api rockbox_api = {
139 153
140 /* kernel */ 154 /* kernel */
141 PREFIX(sleep), 155 PREFIX(sleep),
156 yield,
142 usb_screen, 157 usb_screen,
143 &current_tick, 158 &current_tick,
159 default_event_handler,
160 create_thread,
161 remove_thread,
144 162
145 /* strings and memory */ 163 /* strings and memory */
146 snprintf, 164 snprintf,
147 strcpy, 165 strcpy,
166 strncpy,
148 strlen, 167 strlen,
149 strrchr, 168 strrchr,
169 strcmp,
170 strcasecmp,
150 memset, 171 memset,
151 memcpy, 172 memcpy,
152#ifndef SIMULATOR 173#ifndef SIMULATOR
@@ -154,12 +175,31 @@ static const struct plugin_api rockbox_api = {
154#endif 175#endif
155 176
156 /* sound */ 177 /* sound */
178 mpeg_sound_set,
157#ifndef SIMULATOR 179#ifndef SIMULATOR
180 mp3_play_data,
181 mp3_play_pause,
182 mp3_play_stop,
183 mp3_is_playing,
184 bitswap,
158#ifdef HAVE_MAS3587F 185#ifdef HAVE_MAS3587F
159 mas_codec_readreg, 186 mas_codec_readreg,
160#endif 187#endif
161#endif 188#endif
162 189
190 /* playback control */
191 mpeg_play,
192 mpeg_stop,
193 mpeg_pause,
194 mpeg_resume,
195 mpeg_next,
196 mpeg_prev,
197 mpeg_ff_rewind,
198 mpeg_next_track,
199 playlist_amount,
200 mpeg_status,
201 mpeg_has_changed_track,
202
163 /* misc */ 203 /* misc */
164 srand, 204 srand,
165 rand, 205 rand,
@@ -170,54 +210,21 @@ static const struct plugin_api rockbox_api = {
170 atoi, 210 atoi,
171 get_time, 211 get_time,
172 plugin_get_buffer, 212 plugin_get_buffer,
213 plugin_get_mp3_buffer,
214#ifndef SIMULATOR
215 plugin_register_timer,
216 plugin_unregister_timer,
217#endif
218 plugin_tsr,
173 219
174 /* new stuff at the end, sort into place next time the API gets incompatible */ 220 /* new stuff at the end, sort into place next time the API gets incompatible */
175 221
176#ifndef HAVE_LCD_CHARCELLS
177 &lcd_framebuffer[0][0],
178 lcd_blit,
179#endif
180 yield,
181 222
182 plugin_get_mp3_buffer,
183 mpeg_sound_set,
184#ifndef SIMULATOR
185 mp3_play_data,
186 mp3_play_pause,
187 mp3_play_stop,
188 mp3_is_playing,
189 bitswap,
190#endif
191 &global_settings, 223 &global_settings,
192 backlight_set_timeout, 224 backlight_set_timeout,
193#ifndef SIMULATOR 225#ifndef SIMULATOR
194 ata_sleep, 226 ata_sleep,
195#endif 227#endif
196#ifdef HAVE_LCD_BITMAP
197 checkbox,
198#endif
199#ifndef SIMULATOR
200 plugin_register_timer,
201 plugin_unregister_timer,
202#endif
203 plugin_tsr,
204 create_thread,
205 remove_thread,
206 lcd_set_contrast,
207 mpeg_play,
208 mpeg_stop,
209 mpeg_pause,
210 mpeg_resume,
211 mpeg_next,
212 mpeg_prev,
213 mpeg_ff_rewind,
214 mpeg_next_track,
215 playlist_amount,
216 mpeg_status,
217 mpeg_has_changed_track,
218#ifdef HAVE_LCD_BITMAP
219 font_get,
220#endif
221#if defined(DEBUG) || defined(SIMULATOR) 228#if defined(DEBUG) || defined(SIMULATOR)
222 debugf, 229 debugf,
223#endif 230#endif
@@ -238,26 +245,6 @@ static const struct plugin_api rockbox_api = {
238 set_time, 245 set_time,
239 reset_poweroff_timer, 246 reset_poweroff_timer,
240 247
241 backlight_on,
242 backlight_off,
243
244#ifdef HAVE_LCD_CHARCELLS
245 lcd_icon,
246#endif
247#ifdef HAVE_LCD_BITMAP
248 lcd_puts_style,
249#endif
250#ifdef HAVE_LCD_CHARCELLS
251 lcd_put_cursor,
252 lcd_remove_cursor,
253#endif
254 settings_parseline,
255 strcmp,
256 button_status,
257 button_clear_queue,
258 strncpy,
259 strcasecmp,
260 default_event_handler
261}; 248};
262 249
263int plugin_load(char* plugin, void* parameter) 250int plugin_load(char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 74700879b4..51607a53e6 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -60,12 +60,12 @@
60#endif 60#endif
61 61
62/* increase this every time the api struct changes */ 62/* increase this every time the api struct changes */
63#define PLUGIN_API_VERSION 24 63#define PLUGIN_API_VERSION 25
64 64
65/* update this to latest version if a change to the api struct breaks 65/* update this to latest version if a change to the api struct breaks
66 backwards compatibility (and please take the opportunity to sort in any 66 backwards compatibility (and please take the opportunity to sort in any
67 new function which are "waiting" at the end of the function table) */ 67 new function which are "waiting" at the end of the function table) */
68#define PLUGIN_MIN_API_VERSION 19 68#define PLUGIN_MIN_API_VERSION 25
69 69
70/* plugin return codes */ 70/* plugin return codes */
71enum plugin_status { 71enum plugin_status {
@@ -114,13 +114,18 @@ struct plugin_api {
114 void (*lcd_puts)(int x, int y, unsigned char *string); 114 void (*lcd_puts)(int x, int y, unsigned char *string);
115 void (*lcd_puts_scroll)(int x, int y, unsigned char* string); 115 void (*lcd_puts_scroll)(int x, int y, unsigned char* string);
116 void (*lcd_stop_scroll)(void); 116 void (*lcd_stop_scroll)(void);
117 void (*lcd_set_contrast)(int x);
117#ifdef HAVE_LCD_CHARCELLS 118#ifdef HAVE_LCD_CHARCELLS
118 void (*lcd_define_pattern)(int which,char *pattern); 119 void (*lcd_define_pattern)(int which,char *pattern);
119 unsigned char (*lcd_get_locked_pattern)(void); 120 unsigned char (*lcd_get_locked_pattern)(void);
120 void (*lcd_unlock_pattern)(unsigned char pat); 121 void (*lcd_unlock_pattern)(unsigned char pat);
121 void (*lcd_putc)(int x, int y, unsigned short ch); 122 void (*lcd_putc)(int x, int y, unsigned short ch);
123 void (*lcd_put_cursor)(int x, int y, char cursor_char);
124 void (*lcd_remove_cursor)(void);
125 void (*lcd_icon)(int icon, bool enable);
122#else 126#else
123 void (*lcd_putsxy)(int x, int y, const unsigned char *string); 127 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
128 void (*lcd_puts_style)(int x, int y, unsigned char *str, int style);
124 void (*lcd_bitmap)(const unsigned char *src, int x, int y, 129 void (*lcd_bitmap)(const unsigned char *src, int x, int y,
125 int nx, int ny, bool clear); 130 int nx, int ny, bool clear);
126 void (*lcd_drawline)(int x1, int y1, int x2, int y2); 131 void (*lcd_drawline)(int x1, int y1, int x2, int y2);
@@ -128,6 +133,7 @@ struct plugin_api {
128 void (*lcd_drawpixel)(int x, int y); 133 void (*lcd_drawpixel)(int x, int y);
129 void (*lcd_clearpixel)(int x, int y); 134 void (*lcd_clearpixel)(int x, int y);
130 void (*lcd_setfont)(int font); 135 void (*lcd_setfont)(int font);
136 struct font* (*font_get)(int font);
131 void (*lcd_clearrect)(int x, int y, int nx, int ny); 137 void (*lcd_clearrect)(int x, int y, int nx, int ny);
132 void (*lcd_fillrect)(int x, int y, int nx, int ny); 138 void (*lcd_fillrect)(int x, int y, int nx, int ny);
133 void (*lcd_drawrect)(int x, int y, int nx, int ny); 139 void (*lcd_drawrect)(int x, int y, int nx, int ny);
@@ -137,14 +143,21 @@ struct plugin_api {
137 void (*lcd_update_rect)(int x, int y, int width, int height); 143 void (*lcd_update_rect)(int x, int y, int width, int height);
138 void (*scrollbar)(int x, int y, int width, int height, int items, 144 void (*scrollbar)(int x, int y, int width, int height, int items,
139 int min_shown, int max_shown, int orientation); 145 int min_shown, int max_shown, int orientation);
146 void (*checkbox)(int x, int y, int width, int height, bool checked);
147 unsigned char* lcd_framebuffer;
148 void (*lcd_blit) (unsigned char* p_data, int x, int y, int width, int height, int stride);
140#ifndef SIMULATOR 149#ifndef SIMULATOR
141 void (*lcd_roll)(int pixels); 150 void (*lcd_roll)(int pixels);
142#endif 151#endif
143#endif 152#endif
153 void (*backlight_on)(void);
154 void (*backlight_off)(void);
144 155
145 /* button */ 156 /* button */
146 int (*button_get)(bool block); 157 int (*button_get)(bool block);
147 int (*button_get_w_tmo)(int ticks); 158 int (*button_get_w_tmo)(int ticks);
159 int (*button_status)(void);
160 void (*button_clear_queue)(void);
148 161
149 /* file */ 162 /* file */
150 int (*open)(const char* pathname, int flags); 163 int (*open)(const char* pathname, int flags);
@@ -159,6 +172,7 @@ struct plugin_api {
159 int (*filesize)(int fd); 172 int (*filesize)(int fd);
160 int (*fprintf)(int fd, const char *fmt, ...); 173 int (*fprintf)(int fd, const char *fmt, ...);
161 int (*read_line)(int fd, char* buffer, int buffer_size); 174 int (*read_line)(int fd, char* buffer, int buffer_size);
175 bool (*settings_parseline)(char* line, char** name, char** value);
162 176
163 /* dir */ 177 /* dir */
164 DIR* (*opendir)(const char* name); 178 DIR* (*opendir)(const char* name);
@@ -167,14 +181,21 @@ struct plugin_api {
167 181
168 /* kernel */ 182 /* kernel */
169 void (*sleep)(int ticks); 183 void (*sleep)(int ticks);
184 void (*yield)(void);
170 void (*usb_screen)(void); 185 void (*usb_screen)(void);
171 long* current_tick; 186 long* current_tick;
187 int (*default_event_handler)(int event);
188 int (*create_thread)(void* function, void* stack, int stack_size, char *name);
189 void (*remove_thread)(int threadnum);
172 190
173 /* strings and memory */ 191 /* strings and memory */
174 int (*snprintf)(char *buf, size_t size, const char *fmt, ...); 192 int (*snprintf)(char *buf, size_t size, const char *fmt, ...);
175 char* (*strcpy)(char *dst, const char *src); 193 char* (*strcpy)(char *dst, const char *src);
194 char *(*strncpy)(char *dst, const char *src, size_t length);
176 size_t (*strlen)(const char *str); 195 size_t (*strlen)(const char *str);
177 char * (*strrchr)(const char *s, int c); 196 char * (*strrchr)(const char *s, int c);
197 int (*strcmp)(const char *, const char *);
198 int (*strcasecmp)(const char *, const char *);
178 void* (*memset)(void *dst, int c, size_t length); 199 void* (*memset)(void *dst, int c, size_t length);
179 void* (*memcpy)(void *out, const void *in, size_t n); 200 void* (*memcpy)(void *out, const void *in, size_t n);
180#ifndef SIMULATOR 201#ifndef SIMULATOR
@@ -182,12 +203,31 @@ struct plugin_api {
182#endif 203#endif
183 204
184 /* sound */ 205 /* sound */
206 void (*mpeg_sound_set)(int setting, int value);
185#ifndef SIMULATOR 207#ifndef SIMULATOR
208 void (*mp3_play_data)(unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size));
209 void (*mp3_play_pause)(bool play);
210 void (*mp3_play_stop)(void);
211 bool (*mp3_is_playing)(void);
212 void (*bitswap)(unsigned char *data, int length);
186#ifdef HAVE_MAS3587F 213#ifdef HAVE_MAS3587F
187 int (*mas_codec_readreg)(int reg); 214 int (*mas_codec_readreg)(int reg);
188#endif 215#endif
189#endif 216#endif
190 217
218 /* playback control */
219 void (*mpeg_play)(int offset);
220 void (*mpeg_stop)(void);
221 void (*mpeg_pause)(void);
222 void (*mpeg_resume)(void);
223 void (*mpeg_next)(void);
224 void (*mpeg_prev)(void);
225 void (*mpeg_ff_rewind)(int newtime);
226 struct mp3entry* (*mpeg_next_track)(void);
227 int (*playlist_amount)(void);
228 int (*mpeg_status)(void);
229 bool (*mpeg_has_changed_track)(void);
230
191 /* misc */ 231 /* misc */
192 void (*srand)(unsigned int seed); 232 void (*srand)(unsigned int seed);
193 int (*rand)(void); 233 int (*rand)(void);
@@ -199,61 +239,26 @@ struct plugin_api {
199 int (*atoi)(const char *str); 239 int (*atoi)(const char *str);
200 struct tm* (*get_time)(void); 240 struct tm* (*get_time)(void);
201 void* (*plugin_get_buffer)(int* buffer_size); 241 void* (*plugin_get_buffer)(int* buffer_size);
202
203 /* new stuff, sort in next time the API gets broken! */
204#ifndef HAVE_LCD_CHARCELLS
205 unsigned char* lcd_framebuffer;
206 void (*lcd_blit) (unsigned char* p_data, int x, int y, int width, int height, int stride);
207#endif
208 void (*yield)(void);
209
210 void* (*plugin_get_mp3_buffer)(int* buffer_size); 242 void* (*plugin_get_mp3_buffer)(int* buffer_size);
211 void (*mpeg_sound_set)(int setting, int value);
212#ifndef SIMULATOR 243#ifndef SIMULATOR
213 void (*mp3_play_data)(unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size)); 244 int (*plugin_register_timer)(int cycles, int prio, void (*timer_callback)(void));
214 void (*mp3_play_pause)(bool play); 245 void (*plugin_unregister_timer)(void);
215 void (*mp3_play_stop)(void);
216 bool (*mp3_is_playing)(void);
217 void (*bitswap)(unsigned char *data, int length);
218#endif 246#endif
247 void (*plugin_tsr)(void (*exit_callback)(void));
248
249 /* new stuff, sort in next time the API gets broken! */
250
219 struct user_settings* global_settings; 251 struct user_settings* global_settings;
220 void (*backlight_set_timeout)(int index); 252 void (*backlight_set_timeout)(int index);
221#ifndef SIMULATOR 253#ifndef SIMULATOR
222 int (*ata_sleep)(void); 254 int (*ata_sleep)(void);
223#endif 255#endif
224#ifdef HAVE_LCD_BITMAP
225 void (*checkbox)(int x, int y, int width, int height, bool checked);
226#endif
227#ifndef SIMULATOR
228 int (*plugin_register_timer)(int cycles, int prio, void (*timer_callback)(void));
229 void (*plugin_unregister_timer)(void);
230#endif
231 void (*plugin_tsr)(void (*exit_callback)(void));
232 int (*create_thread)(void* function, void* stack, int stack_size, char *name);
233 void (*remove_thread)(int threadnum);
234 void (*lcd_set_contrast)(int x);
235 256
236 /* playback control */
237 void (*mpeg_play)(int offset);
238 void (*mpeg_stop)(void);
239 void (*mpeg_pause)(void);
240 void (*mpeg_resume)(void);
241 void (*mpeg_next)(void);
242 void (*mpeg_prev)(void);
243 void (*mpeg_ff_rewind)(int newtime);
244 struct mp3entry* (*mpeg_next_track)(void);
245 int (*playlist_amount)(void);
246 int (*mpeg_status)(void);
247 bool (*mpeg_has_changed_track)(void);
248
249#ifdef HAVE_LCD_BITMAP
250 struct font* (*font_get)(int font);
251#endif
252 257
253#if defined(DEBUG) || defined(SIMULATOR) 258#if defined(DEBUG) || defined(SIMULATOR)
254 void (*debugf)(char *fmt, ...); 259 void (*debugf)(char *fmt, ...);
255#endif 260#endif
256 bool (*mp3info)(struct mp3entry *entry, char *filename) ; 261 bool (*mp3info)(struct mp3entry *entry, char *filename, bool v1first);
257 int (*count_mp3_frames)(int fd, int startpos, int filesize, 262 int (*count_mp3_frames)(int fd, int startpos, int filesize,
258 void (*progressfunc)(int)); 263 void (*progressfunc)(int));
259 int (*create_xing_header)(int fd, int startpos, int filesize, 264 int (*create_xing_header)(int fd, int startpos, int filesize,
@@ -274,26 +279,6 @@ struct plugin_api {
274 int (*set_time)(struct tm *tm); 279 int (*set_time)(struct tm *tm);
275 void (*reset_poweroff_timer)(void); 280 void (*reset_poweroff_timer)(void);
276 281
277 void (*backlight_on)(void);
278 void (*backlight_off)(void);
279
280#ifdef HAVE_LCD_CHARCELLS
281 void (*lcd_icon)(int icon, bool enable);
282#endif
283#ifdef HAVE_LCD_BITMAP
284 void (*lcd_puts_style)(int x, int y, unsigned char *str, int style);
285#endif
286#ifdef HAVE_LCD_CHARCELLS
287 void (*lcd_put_cursor)(int x, int y, char cursor_char);
288 void (*lcd_remove_cursor)(void);
289#endif
290 bool (*settings_parseline)(char* line, char** name, char** value);
291 int (*strcmp)(const char *, const char *);
292 int (*button_status)(void);
293 void (*button_clear_queue)(void);
294 char *(*strncpy)(char *dst, const char *src, size_t length);
295 int (*strcasecmp)(const char *, const char *);
296 int (*default_event_handler)(int event);
297}; 282};
298 283
299/* defined by the plugin loader (plugin.c) */ 284/* defined by the plugin loader (plugin.c) */
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c
index 1beca2669d..0077340ec9 100644
--- a/apps/plugins/vbrfix.c
+++ b/apps/plugins/vbrfix.c
@@ -145,7 +145,7 @@ static bool vbr_fix(char *selected_file)
145 145
146 xingupdate(0); 146 xingupdate(0);
147 147
148 rc = rb->mp3info(&entry, selected_file); 148 rc = rb->mp3info(&entry, selected_file, false);
149 if(rc < 0) { 149 if(rc < 0) {
150 fileerror(rc); 150 fileerror(rc);
151 return true; 151 return true;
diff --git a/apps/talk.c b/apps/talk.c
index 462ab85dd1..51e8ae7f01 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -390,7 +390,7 @@ int talk_file(char* filename, bool enqueue)
390 if (p_thumbnail == NULL || size_for_thumbnail <= 0) 390 if (p_thumbnail == NULL || size_for_thumbnail <= 0)
391 return -1; 391 return -1;
392 392
393 if(mp3info(&info, filename)) /* use this to find real start */ 393 if(mp3info(&info, filename, false)) /* use this to find real start */
394 { 394 {
395 return 0; /* failed to open, or invalid */ 395 return 0; /* failed to open, or invalid */
396 } 396 }