summaryrefslogtreecommitdiff
path: root/apps/plugin.h
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2019-07-20 04:46:14 -0500
committerWilliam Wilgus <me.theuser@yahoo.com>2019-07-20 04:50:57 -0500
commit6392e05476ab45f973dea611082d4dbcfe3db7cf (patch)
tree822bf4f073114560137caff34ea45f25a6fac009 /apps/plugin.h
parent55eb1c54ebe33faa8b1eb8c527d5644961ca78dc (diff)
downloadrockbox-6392e05476ab45f973dea611082d4dbcfe3db7cf.tar.gz
rockbox-6392e05476ab45f973dea611082d4dbcfe3db7cf.zip
Plugin API
Reorganize Plugin functions in prep for API bump Stub in sound_current add sleep_timer Change-Id: I74b3a433c86bd6cec43a7c45ae0d2db95c97bb60
Diffstat (limited to 'apps/plugin.h')
-rw-r--r--apps/plugin.h229
1 files changed, 120 insertions, 109 deletions
diff --git a/apps/plugin.h b/apps/plugin.h
index 50f71914e9..083dac0335 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -189,13 +189,14 @@ enum plugin_status {
189 version 189 version
190 */ 190 */
191struct plugin_api { 191struct plugin_api {
192 /* let's put these at the top */
193 const char *rbversion; 192 const char *rbversion;
194 struct user_settings* global_settings; 193 struct user_settings* global_settings;
195 struct system_status *global_status; 194 struct system_status *global_status;
196 unsigned char **language_strings; 195 unsigned char **language_strings;
197 196
198 /* lcd */ 197 /* lcd */
198 void (*splash)(int ticks, const char *str);
199 void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
199#ifdef HAVE_LCD_CONTRAST 200#ifdef HAVE_LCD_CONTRAST
200 void (*lcd_set_contrast)(int x); 201 void (*lcd_set_contrast)(int x);
201#endif 202#endif
@@ -307,27 +308,6 @@ struct plugin_api {
307 int min_shown, int max_shown, 308 int min_shown, int max_shown,
308 unsigned flags); 309 unsigned flags);
309#endif /* HAVE_LCD_BITMAP */ 310#endif /* HAVE_LCD_BITMAP */
310 /* backlight */
311 /* The backlight_* functions must be present in the API regardless whether
312 * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has
313 * no backlight but can be modded to have backlight (it's prepared on the
314 * PCB). This makes backlight an all-target feature API wise, and keeps API
315 * compatible between stock and modded Ondio.
316 * For OLED targets like the Sansa Clip, the backlight_* functions control
317 * the display enable, which has essentially the same effect. */
318 void (*backlight_on)(void);
319 void (*backlight_off)(void);
320 void (*backlight_set_timeout)(int index);
321#ifdef HAVE_BACKLIGHT_BRIGHTNESS
322 void (*backlight_set_brightness)(int val);
323#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
324
325#if CONFIG_CHARGING
326 void (*backlight_set_timeout_plugged)(int index);
327#endif
328 bool (*is_backlight_on)(bool ignore_always_off);
329 void (*splash)(int ticks, const char *str);
330 void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
331 311
332#ifdef HAVE_REMOTE_LCD 312#ifdef HAVE_REMOTE_LCD
333 /* remote lcd */ 313 /* remote lcd */
@@ -355,16 +335,7 @@ struct plugin_api {
355 fb_remote_data* lcd_remote_framebuffer; 335 fb_remote_data* lcd_remote_framebuffer;
356 void (*lcd_remote_update)(void); 336 void (*lcd_remote_update)(void);
357 void (*lcd_remote_update_rect)(int x, int y, int width, int height); 337 void (*lcd_remote_update_rect)(int x, int y, int width, int height);
358 338#if (LCD_REMOTE_DEPTH > 1)
359 void (*remote_backlight_on)(void);
360 void (*remote_backlight_off)(void);
361 void (*remote_backlight_set_timeout)(int index);
362#if CONFIG_CHARGING
363 void (*remote_backlight_set_timeout_plugged)(int index);
364#endif
365#endif /* HAVE_REMOTE_LCD */
366 struct screen* screens[NB_SCREENS];
367#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
368 void (*lcd_remote_set_foreground)(unsigned foreground); 339 void (*lcd_remote_set_foreground)(unsigned foreground);
369 unsigned (*lcd_remote_get_foreground)(void); 340 unsigned (*lcd_remote_get_foreground)(void);
370 void (*lcd_remote_set_background)(unsigned background); 341 void (*lcd_remote_set_background)(unsigned background);
@@ -375,6 +346,9 @@ struct plugin_api {
375 void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, 346 void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y,
376 int width, int height); 347 int width, int height);
377#endif 348#endif
349#endif /* HAVE_REMOTE_LCD */
350 struct screen* screens[NB_SCREENS];
351
378 void (*viewport_set_defaults)(struct viewport *vp, 352 void (*viewport_set_defaults)(struct viewport *vp,
379 const enum screen_type screen); 353 const enum screen_type screen);
380#ifdef HAVE_LCD_BITMAP 354#ifdef HAVE_LCD_BITMAP
@@ -384,6 +358,36 @@ struct plugin_api {
384 void (*viewport_set_fullscreen)(struct viewport *vp, 358 void (*viewport_set_fullscreen)(struct viewport *vp,
385 const enum screen_type screen); 359 const enum screen_type screen);
386#endif 360#endif
361
362 /* lcd backlight */
363 /* The backlight_* functions must be present in the API regardless whether
364 * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has
365 * no backlight but can be modded to have backlight (it's prepared on the
366 * PCB). This makes backlight an all-target feature API wise, and keeps API
367 * compatible between stock and modded Ondio.
368 * For OLED targets like the Sansa Clip, the backlight_* functions control
369 * the display enable, which has essentially the same effect. */
370 bool (*is_backlight_on)(bool ignore_always_off);
371 void (*backlight_on)(void);
372 void (*backlight_off)(void);
373 void (*backlight_set_timeout)(int index);
374#ifdef HAVE_BACKLIGHT_BRIGHTNESS
375 void (*backlight_set_brightness)(int val);
376#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
377
378#if CONFIG_CHARGING
379 void (*backlight_set_timeout_plugged)(int index);
380#endif
381
382#ifdef HAVE_REMOTE_LCD
383 void (*remote_backlight_on)(void);
384 void (*remote_backlight_off)(void);
385 void (*remote_backlight_set_timeout)(int index);
386#if CONFIG_CHARGING
387 void (*remote_backlight_set_timeout_plugged)(int index);
388#endif
389#endif /* HAVE_REMOTE_LCD */
390
387 /* list */ 391 /* list */
388 void (*gui_synclist_init)(struct gui_synclist * lists, 392 void (*gui_synclist_init)(struct gui_synclist * lists,
389 list_get_name callback_get_item_name, void * data, 393 list_get_name callback_get_item_name, void * data,
@@ -413,6 +417,15 @@ struct plugin_api {
413 int count, void* data); 417 int count, void* data);
414 bool (*simplelist_show_list)(struct simplelist_info *info); 418 bool (*simplelist_show_list)(struct simplelist_info *info);
415 419
420 /* action handling */
421 int (*get_custom_action)(int context,int timeout,
422 const struct button_mapping* (*get_context_map)(int));
423 int (*get_action)(int context, int timeout);
424#ifdef HAVE_TOUCHSCREEN
425 int (*action_get_touchscreen_press)(short *x, short *y);
426#endif
427 bool (*action_userabort)(int timeout);
428
416 /* button */ 429 /* button */
417 long (*button_get)(bool block); 430 long (*button_get)(bool block);
418 long (*button_get_w_tmo)(int ticks); 431 long (*button_get_w_tmo)(int ticks);
@@ -486,6 +499,12 @@ struct plugin_api {
486 char *title, enum themable_icons icon, 499 char *title, enum themable_icons icon,
487 const char *root, const char *selected); 500 const char *root, const char *selected);
488 int (*rockbox_browse)(struct browse_context *browse); 501 int (*rockbox_browse)(struct browse_context *browse);
502 struct tree_context* (*tree_get_context)(void);
503 struct entry* (*tree_get_entries)(struct tree_context* t);
504 struct entry* (*tree_get_entry_at)(struct tree_context* t, int index);
505
506 void (*set_current_file)(const char* path);
507 void (*set_dirfilter)(int l_dirfilter);
489 508
490 /* talking */ 509 /* talking */
491 int (*talk_id)(int32_t id, bool enqueue); 510 int (*talk_id)(int32_t id, bool enqueue);
@@ -532,8 +551,14 @@ struct plugin_api {
532 void (*mutex_lock)(struct mutex *m); 551 void (*mutex_lock)(struct mutex *m);
533 void (*mutex_unlock)(struct mutex *m); 552 void (*mutex_unlock)(struct mutex *m);
534#endif 553#endif
535 554#ifdef HAVE_SEMAPHORE_OBJECTS
555 void (*semaphore_init)(struct semaphore *s, int max, int start);
556 int (*semaphore_wait)(struct semaphore *s, int timeout);
557 void (*semaphore_release)(struct semaphore *s);
558#endif
536 void (*reset_poweroff_timer)(void); 559 void (*reset_poweroff_timer)(void);
560 void (*set_sleeptimer_duration)(int minutes);
561 int (*get_sleep_timer)(void);
537#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 562#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
538 int (*system_memory_guard)(int newmode); 563 int (*system_memory_guard)(int newmode);
539 long *cpu_frequency; 564 long *cpu_frequency;
@@ -582,10 +607,6 @@ struct plugin_api {
582 void (*queue_reply)(struct event_queue *q, intptr_t retval); 607 void (*queue_reply)(struct event_queue *q, intptr_t retval);
583#endif /* CONFIG_CODEC == SWCODEC */ 608#endif /* CONFIG_CODEC == SWCODEC */
584 609
585 void (*usb_acknowledge)(long id);
586#ifdef USB_ENABLE_HID
587 void (*usb_hid_send)(usage_page_t usage_page, int id);
588#endif
589#ifdef RB_PROFILE 610#ifdef RB_PROFILE
590 void (*profile_thread)(void); 611 void (*profile_thread)(void);
591 void (*profstop)(void); 612 void (*profstop)(void);
@@ -658,6 +679,7 @@ struct plugin_api {
658 679
659 /* sound */ 680 /* sound */
660 void (*sound_set)(int setting, int value); 681 void (*sound_set)(int setting, int value);
682 int (*sound_current)(int setting); /*stub*/
661 int (*sound_default)(int setting); 683 int (*sound_default)(int setting);
662 int (*sound_min)(int setting); 684 int (*sound_min)(int setting);
663 int (*sound_max)(int setting); 685 int (*sound_max)(int setting);
@@ -667,6 +689,10 @@ struct plugin_api {
667 int (*sound_enum_hw_eq_band_setting)(unsigned int band, 689 int (*sound_enum_hw_eq_band_setting)(unsigned int band,
668 unsigned int band_setting); 690 unsigned int band_setting);
669#endif /* AUDIOHW_HAVE_EQ */ 691#endif /* AUDIOHW_HAVE_EQ */
692#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
693 (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
694 void (*sound_set_pitch)(int32_t pitch);
695#endif
670#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 696#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
671 void (*mp3_play_data)(const void* start, size_t size, 697 void (*mp3_play_data)(const void* start, size_t size,
672 mp3_play_callback_t get_more); 698 mp3_play_callback_t get_more);
@@ -743,7 +769,48 @@ struct plugin_api {
743 void (*pcmbuf_fade)(bool fade, bool in); 769 void (*pcmbuf_fade)(bool fade, bool in);
744 void (*system_sound_play)(enum system_sound sound); 770 void (*system_sound_play)(enum system_sound sound);
745 void (*keyclick_click)(bool rawbutton, int action); 771 void (*keyclick_click)(bool rawbutton, int action);
746#endif /* CONFIG_CODEC == SWCODC */ 772#endif /* CONFIG_CODEC == SWCODEC */
773
774#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
775 unsigned short (*peak_meter_scale_value)(unsigned short val,
776 int meterwidth);
777 void (*peak_meter_set_use_dbfs)(bool use);
778 bool (*peak_meter_get_use_dbfs)(void);
779#endif
780
781 /* metadata */
782 bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
783 bool (*mp3info)(struct mp3entry *entry, const char *filename);
784 int (*count_mp3_frames)(int fd, int startpos, int filesize,
785 void (*progressfunc)(int),
786 unsigned char* buf, size_t buflen);
787 int (*create_xing_header)(int fd, long startpos, long filesize,
788 unsigned char *buf, unsigned long num_frames,
789 unsigned long rec_time, unsigned long header_template,
790 void (*progressfunc)(int), bool generate_toc,
791 unsigned char* tempbuf, size_t tempbuf_len);
792 unsigned long (*find_next_frame)(int fd, long *offset,
793 long max_offset, unsigned long reference_header);
794#ifdef HAVE_TAGCACHE
795 bool (*tagcache_search)(struct tagcache_search *tcs, int tag);
796 void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs,
797 void *buffer, long length);
798 bool (*tagcache_search_add_filter)(struct tagcache_search *tcs,
799 int tag, int seek);
800 bool (*tagcache_get_next)(struct tagcache_search *tcs);
801 bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid,
802 int tag, char *buf, long size);
803 void (*tagcache_search_finish)(struct tagcache_search *tcs);
804 long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
805#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
806 bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
807#endif
808#endif /* HAVE_TAGCACHE */
809
810#ifdef HAVE_ALBUMART
811 bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string,
812 char *buf, int buflen);
813#endif
747 814
748 /* playback control */ 815 /* playback control */
749 int (*playlist_amount)(void); 816 int (*playlist_amount)(void);
@@ -777,10 +844,6 @@ struct plugin_api {
777#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) 844#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
778 unsigned long (*mpeg_get_last_header)(void); 845 unsigned long (*mpeg_get_last_header)(void);
779#endif 846#endif
780#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
781 (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
782 void (*sound_set_pitch)(int32_t pitch);
783#endif
784 847
785 /* MAS communication */ 848 /* MAS communication */
786#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) 849#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
@@ -795,7 +858,7 @@ struct plugin_api {
795 void (*i2c_end)(void); 858 void (*i2c_end)(void);
796 int (*i2c_write)(int address, const unsigned char* buf, int count ); 859 int (*i2c_write)(int address, const unsigned char* buf, int count );
797#endif 860#endif
798#endif 861#endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */
799 862
800 /* menu */ 863 /* menu */
801 struct menu_table *(*root_menu_get_options)(int *nb_options); 864 struct menu_table *(*root_menu_get_options)(int *nb_options);
@@ -805,7 +868,7 @@ struct plugin_api {
805 char* (*root_menu_write_to_cfg)(void* setting, char*buf, int buf_len); 868 char* (*root_menu_write_to_cfg)(void* setting, char*buf, int buf_len);
806 void (*root_menu_load_from_cfg)(void* setting, char *value); 869 void (*root_menu_load_from_cfg)(void* setting, char *value);
807 870
808 /* scroll bar */ 871 /* statusbars */
809 struct gui_syncstatusbar *statusbars; 872 struct gui_syncstatusbar *statusbars;
810 void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw); 873 void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw);
811 874
@@ -838,14 +901,6 @@ struct plugin_api {
838 bool (*set_color)(struct screen *display, char *title, 901 bool (*set_color)(struct screen *display, char *title,
839 unsigned *color, unsigned banned_color); 902 unsigned *color, unsigned banned_color);
840#endif 903#endif
841 /* action handling */
842 int (*get_custom_action)(int context,int timeout,
843 const struct button_mapping* (*get_context_map)(int));
844 int (*get_action)(int context, int timeout);
845#ifdef HAVE_TOUCHSCREEN
846 int (*action_get_touchscreen_press)(short *x, short *y);
847#endif
848 bool (*action_userabort)(int timeout);
849 904
850 /* power */ 905 /* power */
851 int (*battery_level)(void); 906 int (*battery_level)(void);
@@ -860,7 +915,10 @@ struct plugin_api {
860#endif 915#endif
861 /* usb */ 916 /* usb */
862 bool (*usb_inserted)(void); 917 bool (*usb_inserted)(void);
863 918 void (*usb_acknowledge)(long id);
919#ifdef USB_ENABLE_HID
920 void (*usb_hid_send)(usage_page_t usage_page, int id);
921#endif
864 /* misc */ 922 /* misc */
865#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 923#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
866 int * (*__errno)(void); 924 int * (*__errno)(void);
@@ -876,14 +934,7 @@ struct plugin_api {
876#if CONFIG_RTC 934#if CONFIG_RTC
877 time_t (*mktime)(struct tm *t); 935 time_t (*mktime)(struct tm *t);
878#endif 936#endif
879 void* (*plugin_get_buffer)(size_t *buffer_size); 937
880 void* (*plugin_get_audio_buffer)(size_t *buffer_size);
881 void (*plugin_release_audio_buffer)(void);
882 void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
883 char* (*plugin_get_current_filename)(void);
884#ifdef PLUGIN_USE_IRAM
885 void (*audio_hard_stop)(void);
886#endif
887#if defined(DEBUG) || defined(SIMULATOR) 938#if defined(DEBUG) || defined(SIMULATOR)
888 void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); 939 void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
889#endif 940#endif
@@ -904,25 +955,7 @@ struct plugin_api {
904 int count, 955 int count,
905 bool signd); 956 bool signd);
906#endif /* CONFIG_CODEC == SWCODEC */ 957#endif /* CONFIG_CODEC == SWCODEC */
907 bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
908 bool (*mp3info)(struct mp3entry *entry, const char *filename);
909 int (*count_mp3_frames)(int fd, int startpos, int filesize,
910 void (*progressfunc)(int),
911 unsigned char* buf, size_t buflen);
912 int (*create_xing_header)(int fd, long startpos, long filesize,
913 unsigned char *buf, unsigned long num_frames,
914 unsigned long rec_time, unsigned long header_template,
915 void (*progressfunc)(int), bool generate_toc,
916 unsigned char* tempbuf, size_t tempbuf_len);
917 unsigned long (*find_next_frame)(int fd, long *offset,
918 long max_offset, unsigned long reference_header);
919 958
920#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
921 unsigned short (*peak_meter_scale_value)(unsigned short val,
922 int meterwidth);
923 void (*peak_meter_set_use_dbfs)(bool use);
924 bool (*peak_meter_get_use_dbfs)(void);
925#endif
926#ifdef HAVE_LCD_BITMAP 959#ifdef HAVE_LCD_BITMAP
927 int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize, 960 int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize,
928 int format, const struct custom_format *cformat); 961 int format, const struct custom_format *cformat);
@@ -937,12 +970,6 @@ struct plugin_api {
937 void (*screen_dump_set_hook)(void (*hook)(int fh)); 970 void (*screen_dump_set_hook)(void (*hook)(int fh));
938#endif 971#endif
939 int (*show_logo)(void); 972 int (*show_logo)(void);
940 struct tree_context* (*tree_get_context)(void);
941 struct entry* (*tree_get_entries)(struct tree_context* t);
942 struct entry* (*tree_get_entry_at)(struct tree_context* t, int index);
943
944 void (*set_current_file)(const char* path);
945 void (*set_dirfilter)(int l_dirfilter);
946 973
947#ifdef HAVE_WHEEL_POSITION 974#ifdef HAVE_WHEEL_POSITION
948 int (*wheel_status)(void); 975 int (*wheel_status)(void);
@@ -958,32 +985,16 @@ struct plugin_api {
958 985
959 void (*led)(bool on); 986 void (*led)(bool on);
960 987
961#ifdef HAVE_TAGCACHE 988 /*plugin*/
962 bool (*tagcache_search)(struct tagcache_search *tcs, int tag); 989 void* (*plugin_get_buffer)(size_t *buffer_size);
963 void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs, 990 void* (*plugin_get_audio_buffer)(size_t *buffer_size);
964 void *buffer, long length); 991 void (*plugin_release_audio_buffer)(void);
965 bool (*tagcache_search_add_filter)(struct tagcache_search *tcs, 992 void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
966 int tag, int seek); 993 char* (*plugin_get_current_filename)(void);
967 bool (*tagcache_get_next)(struct tagcache_search *tcs); 994#ifdef PLUGIN_USE_IRAM
968 bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid, 995 void (*audio_hard_stop)(void);
969 int tag, char *buf, long size);
970 void (*tagcache_search_finish)(struct tagcache_search *tcs);
971 long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
972#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
973 bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
974#endif
975#endif
976
977#ifdef HAVE_ALBUMART
978 bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string,
979 char *buf, int buflen);
980#endif 996#endif
981 997
982#ifdef HAVE_SEMAPHORE_OBJECTS
983 void (*semaphore_init)(struct semaphore *s, int max, int start);
984 int (*semaphore_wait)(struct semaphore *s, int timeout);
985 void (*semaphore_release)(struct semaphore *s);
986#endif
987 998
988 /* new stuff at the end, sort into place next time 999 /* new stuff at the end, sort into place next time
989 the API gets incompatible */ 1000 the API gets incompatible */