Plugin API

Reorganize Plugin functions in prep for API bump

Stub in sound_current

add sleep_timer

Change-Id: I74b3a433c86bd6cec43a7c45ae0d2db95c97bb60
This commit is contained in:
William Wilgus 2019-07-20 04:46:14 -05:00
parent 55eb1c54eb
commit 6392e05476
2 changed files with 239 additions and 200 deletions

View file

@ -84,7 +84,7 @@ char *plugin_get_current_filename(void);
static void* plugin_get_audio_buffer(size_t *buffer_size); static void* plugin_get_audio_buffer(size_t *buffer_size);
static void plugin_release_audio_buffer(void); static void plugin_release_audio_buffer(void);
static void plugin_tsr(bool (*exit_callback)(bool)); static void plugin_tsr(bool (*exit_callback)(bool));
int sound_current(int setting); /*stub*/
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE #ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
/* File handle leak prophylaxis */ /* File handle leak prophylaxis */
@ -182,6 +182,8 @@ static const struct plugin_api rockbox_api = {
language_strings, language_strings,
/* lcd */ /* lcd */
splash,
splashf,
#ifdef HAVE_LCD_CONTRAST #ifdef HAVE_LCD_CONTRAST
lcd_set_contrast, lcd_set_contrast,
#endif #endif
@ -203,7 +205,7 @@ static const struct plugin_api rockbox_api = {
lcd_remove_cursor, lcd_remove_cursor,
lcd_icon, lcd_icon,
lcd_double_height, lcd_double_height,
#else #else /* HAVE_LCD_BITMAP */
&lcd_static_framebuffer[0][0], &lcd_static_framebuffer[0][0],
lcd_set_viewport, lcd_set_viewport,
lcd_set_framebuffer, lcd_set_framebuffer,
@ -274,20 +276,6 @@ static const struct plugin_api rockbox_api = {
gui_scrollbar_draw, gui_scrollbar_draw,
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
backlight_on,
backlight_off,
backlight_set_timeout,
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
backlight_set_brightness,
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#if CONFIG_CHARGING
backlight_set_timeout_plugged,
#endif
is_backlight_on,
splash,
splashf,
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
/* remote lcd */ /* remote lcd */
lcd_remote_set_contrast, lcd_remote_set_contrast,
@ -311,20 +299,7 @@ static const struct plugin_api rockbox_api = {
&lcd_remote_static_framebuffer[0][0], &lcd_remote_static_framebuffer[0][0],
lcd_remote_update, lcd_remote_update,
lcd_remote_update_rect, lcd_remote_update_rect,
#if (LCD_REMOTE_DEPTH > 1)
remote_backlight_on,
remote_backlight_off,
remote_backlight_set_timeout,
#if CONFIG_CHARGING
remote_backlight_set_timeout_plugged,
#endif
#endif /* HAVE_REMOTE_LCD */
#if NB_SCREENS == 2
{&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]},
#else
{&screens[SCREEN_MAIN]},
#endif
#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
lcd_remote_set_foreground, lcd_remote_set_foreground,
lcd_remote_get_foreground, lcd_remote_get_foreground,
lcd_remote_set_background, lcd_remote_set_background,
@ -332,6 +307,13 @@ static const struct plugin_api rockbox_api = {
lcd_remote_bitmap_part, lcd_remote_bitmap_part,
lcd_remote_bitmap, lcd_remote_bitmap,
#endif #endif
#endif /* HAVE_REMOTE_LCD */
#if NB_SCREENS == 2
{&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]},
#else
{&screens[SCREEN_MAIN]},
#endif
viewport_set_defaults, viewport_set_defaults,
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
viewportmanager_theme_enable, viewportmanager_theme_enable,
@ -339,6 +321,35 @@ static const struct plugin_api rockbox_api = {
viewport_set_fullscreen, viewport_set_fullscreen,
#endif #endif
/* lcd backlight */
/* The backlight_* functions must be present in the API regardless whether
* HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has
* no backlight but can be modded to have backlight (it's prepared on the
* PCB). This makes backlight an all-target feature API wise, and keeps API
* compatible between stock and modded Ondio.
* For OLED targets like the Sansa Clip, the backlight_* functions control
* the display enable, which has essentially the same effect. */
is_backlight_on,
backlight_on,
backlight_off,
backlight_set_timeout,
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
backlight_set_brightness,
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#if CONFIG_CHARGING
backlight_set_timeout_plugged,
#endif
#ifdef HAVE_REMOTE_LCD
remote_backlight_on,
remote_backlight_off,
remote_backlight_set_timeout,
#if CONFIG_CHARGING
remote_backlight_set_timeout_plugged,
#endif
#endif /* HAVE_REMOTE_LCD */
/* list */ /* list */
gui_synclist_init, gui_synclist_init,
gui_synclist_set_nb_items, gui_synclist_set_nb_items,
@ -358,6 +369,14 @@ static const struct plugin_api rockbox_api = {
simplelist_info_init, simplelist_info_init,
simplelist_show_list, simplelist_show_list,
/* action handling */
get_custom_action,
get_action,
#ifdef HAVE_TOUCHSCREEN
action_get_touchscreen_press,
#endif
action_userabort,
/* button */ /* button */
button_get, button_get,
button_get_w_tmo, button_get_w_tmo,
@ -426,6 +445,11 @@ static const struct plugin_api rockbox_api = {
/* browsing */ /* browsing */
browse_context_init, browse_context_init,
rockbox_browse, rockbox_browse,
tree_get_context,
tree_get_entries,
tree_get_entry_at,
set_current_file,
set_dirfilter,
/* talking */ /* talking */
talk_id, talk_id,
@ -464,8 +488,14 @@ static const struct plugin_api rockbox_api = {
mutex_lock, mutex_lock,
mutex_unlock, mutex_unlock,
#endif #endif
#ifdef HAVE_SEMAPHORE_OBJECTS
semaphore_init,
semaphore_wait,
semaphore_release,
#endif
reset_poweroff_timer, reset_poweroff_timer,
set_sleeptimer_duration, /*stub*/
get_sleep_timer, /*stub*/
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
system_memory_guard, system_memory_guard,
&cpu_frequency, &cpu_frequency,
@ -507,10 +537,7 @@ static const struct plugin_api rockbox_api = {
queue_send, queue_send,
queue_reply, queue_reply,
#endif #endif
usb_acknowledge,
#ifdef USB_ENABLE_HID
usb_hid_send,
#endif
#ifdef RB_PROFILE #ifdef RB_PROFILE
profile_thread, profile_thread,
profstop, profstop,
@ -578,6 +605,7 @@ static const struct plugin_api rockbox_api = {
/* sound */ /* sound */
sound_set, sound_set,
sound_current, /*stub*/
sound_default, sound_default,
sound_min, sound_min,
sound_max, sound_max,
@ -586,6 +614,10 @@ static const struct plugin_api rockbox_api = {
#ifdef AUDIOHW_HAVE_EQ #ifdef AUDIOHW_HAVE_EQ
sound_enum_hw_eq_band_setting, sound_enum_hw_eq_band_setting,
#endif #endif
#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
(CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
sound_set_pitch,
#endif
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
mp3_play_data, mp3_play_data,
mp3_play_pause, mp3_play_pause,
@ -650,6 +682,37 @@ static const struct plugin_api rockbox_api = {
system_sound_play, system_sound_play,
keyclick_click, keyclick_click,
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
peak_meter_scale_value,
peak_meter_set_use_dbfs,
peak_meter_get_use_dbfs,
#endif
/* metadata */
get_metadata,
mp3info,
count_mp3_frames,
create_xing_header,
find_next_frame,
#ifdef HAVE_TAGCACHE
tagcache_search,
tagcache_search_set_uniqbuf,
tagcache_search_add_filter,
tagcache_get_next,
tagcache_retrieve,
tagcache_search_finish,
tagcache_get_numeric,
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
tagcache_fill_tags,
#endif
#endif /* HAVE_TAGCACHE */
#ifdef HAVE_ALBUMART
search_albumart_files,
#endif
/* playback control */ /* playback control */
playlist_amount, playlist_amount,
playlist_resume, playlist_resume,
@ -677,10 +740,6 @@ static const struct plugin_api rockbox_api = {
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
mpeg_get_last_header, mpeg_get_last_header,
#endif #endif
#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
(CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
sound_set_pitch,
#endif
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
/* MAS communication */ /* MAS communication */
@ -722,14 +781,6 @@ static const struct plugin_api rockbox_api = {
set_color, set_color,
#endif #endif
/* action handling */
get_custom_action,
get_action,
#ifdef HAVE_TOUCHSCREEN
action_get_touchscreen_press,
#endif
action_userabort,
/* power */ /* power */
battery_level, battery_level,
battery_level_safe, battery_level_safe,
@ -741,8 +792,12 @@ static const struct plugin_api rockbox_api = {
charging_state, charging_state,
# endif # endif
#endif #endif
/* usb */
usb_inserted, usb_inserted,
usb_acknowledge,
#ifdef USB_ENABLE_HID
usb_hid_send,
#endif
/* misc */ /* misc */
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
__errno, __errno,
@ -757,14 +812,7 @@ static const struct plugin_api rockbox_api = {
#if CONFIG_RTC #if CONFIG_RTC
mktime, mktime,
#endif #endif
plugin_get_buffer,
plugin_get_audio_buffer, /* defined in plugin.c */
plugin_release_audio_buffer, /* defined in plugin.c */
plugin_tsr, /* defined in plugin.c */
plugin_get_current_filename,
#ifdef PLUGIN_USE_IRAM
audio_hard_stop,
#endif
#if defined(DEBUG) || defined(SIMULATOR) #if defined(DEBUG) || defined(SIMULATOR)
debugf, debugf,
#endif #endif
@ -781,16 +829,7 @@ static const struct plugin_api rockbox_api = {
remove_array_ptr, remove_array_ptr,
round_value_to_list32, round_value_to_list32,
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
get_metadata,
mp3info,
count_mp3_frames,
create_xing_header,
find_next_frame,
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
peak_meter_scale_value,
peak_meter_set_use_dbfs,
peak_meter_get_use_dbfs,
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
read_bmp_file, read_bmp_file,
read_bmp_fd, read_bmp_fd,
@ -801,11 +840,6 @@ static const struct plugin_api rockbox_api = {
screen_dump_set_hook, screen_dump_set_hook,
#endif #endif
show_logo, show_logo,
tree_get_context,
tree_get_entries,
tree_get_entry_at,
set_current_file,
set_dirfilter,
#ifdef HAVE_WHEEL_POSITION #ifdef HAVE_WHEEL_POSITION
wheel_status, wheel_status,
@ -819,27 +853,15 @@ static const struct plugin_api rockbox_api = {
detect_flashed_romimage, detect_flashed_romimage,
#endif #endif
led, led,
#ifdef HAVE_TAGCACHE
tagcache_search,
tagcache_search_set_uniqbuf,
tagcache_search_add_filter,
tagcache_get_next,
tagcache_retrieve,
tagcache_search_finish,
tagcache_get_numeric,
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
tagcache_fill_tags,
#endif
#endif
#ifdef HAVE_ALBUMART /*plugin*/
search_albumart_files, plugin_get_buffer,
#endif plugin_get_audio_buffer, /* defined in plugin.c */
plugin_release_audio_buffer, /* defined in plugin.c */
#ifdef HAVE_SEMAPHORE_OBJECTS plugin_tsr, /* defined in plugin.c */
semaphore_init, plugin_get_current_filename,
semaphore_wait, #ifdef PLUGIN_USE_IRAM
semaphore_release, audio_hard_stop,
#endif #endif
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
@ -1060,3 +1082,9 @@ char *plugin_get_current_filename(void)
{ {
return current_plugin; return current_plugin;
} }
int sound_current(int setting) /*stub*/
{
(void) setting;
return 0;
}

View file

@ -189,13 +189,14 @@ enum plugin_status {
version version
*/ */
struct plugin_api { struct plugin_api {
/* let's put these at the top */
const char *rbversion; const char *rbversion;
struct user_settings* global_settings; struct user_settings* global_settings;
struct system_status *global_status; struct system_status *global_status;
unsigned char **language_strings; unsigned char **language_strings;
/* lcd */ /* lcd */
void (*splash)(int ticks, const char *str);
void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
#ifdef HAVE_LCD_CONTRAST #ifdef HAVE_LCD_CONTRAST
void (*lcd_set_contrast)(int x); void (*lcd_set_contrast)(int x);
#endif #endif
@ -307,27 +308,6 @@ struct plugin_api {
int min_shown, int max_shown, int min_shown, int max_shown,
unsigned flags); unsigned flags);
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
/* backlight */
/* The backlight_* functions must be present in the API regardless whether
* HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has
* no backlight but can be modded to have backlight (it's prepared on the
* PCB). This makes backlight an all-target feature API wise, and keeps API
* compatible between stock and modded Ondio.
* For OLED targets like the Sansa Clip, the backlight_* functions control
* the display enable, which has essentially the same effect. */
void (*backlight_on)(void);
void (*backlight_off)(void);
void (*backlight_set_timeout)(int index);
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void (*backlight_set_brightness)(int val);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#if CONFIG_CHARGING
void (*backlight_set_timeout_plugged)(int index);
#endif
bool (*is_backlight_on)(bool ignore_always_off);
void (*splash)(int ticks, const char *str);
void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
/* remote lcd */ /* remote lcd */
@ -355,16 +335,7 @@ struct plugin_api {
fb_remote_data* lcd_remote_framebuffer; fb_remote_data* lcd_remote_framebuffer;
void (*lcd_remote_update)(void); void (*lcd_remote_update)(void);
void (*lcd_remote_update_rect)(int x, int y, int width, int height); void (*lcd_remote_update_rect)(int x, int y, int width, int height);
#if (LCD_REMOTE_DEPTH > 1)
void (*remote_backlight_on)(void);
void (*remote_backlight_off)(void);
void (*remote_backlight_set_timeout)(int index);
#if CONFIG_CHARGING
void (*remote_backlight_set_timeout_plugged)(int index);
#endif
#endif /* HAVE_REMOTE_LCD */
struct screen* screens[NB_SCREENS];
#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
void (*lcd_remote_set_foreground)(unsigned foreground); void (*lcd_remote_set_foreground)(unsigned foreground);
unsigned (*lcd_remote_get_foreground)(void); unsigned (*lcd_remote_get_foreground)(void);
void (*lcd_remote_set_background)(unsigned background); void (*lcd_remote_set_background)(unsigned background);
@ -375,6 +346,9 @@ struct plugin_api {
void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y,
int width, int height); int width, int height);
#endif #endif
#endif /* HAVE_REMOTE_LCD */
struct screen* screens[NB_SCREENS];
void (*viewport_set_defaults)(struct viewport *vp, void (*viewport_set_defaults)(struct viewport *vp,
const enum screen_type screen); const enum screen_type screen);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
@ -384,6 +358,36 @@ struct plugin_api {
void (*viewport_set_fullscreen)(struct viewport *vp, void (*viewport_set_fullscreen)(struct viewport *vp,
const enum screen_type screen); const enum screen_type screen);
#endif #endif
/* lcd backlight */
/* The backlight_* functions must be present in the API regardless whether
* HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has
* no backlight but can be modded to have backlight (it's prepared on the
* PCB). This makes backlight an all-target feature API wise, and keeps API
* compatible between stock and modded Ondio.
* For OLED targets like the Sansa Clip, the backlight_* functions control
* the display enable, which has essentially the same effect. */
bool (*is_backlight_on)(bool ignore_always_off);
void (*backlight_on)(void);
void (*backlight_off)(void);
void (*backlight_set_timeout)(int index);
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
void (*backlight_set_brightness)(int val);
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
#if CONFIG_CHARGING
void (*backlight_set_timeout_plugged)(int index);
#endif
#ifdef HAVE_REMOTE_LCD
void (*remote_backlight_on)(void);
void (*remote_backlight_off)(void);
void (*remote_backlight_set_timeout)(int index);
#if CONFIG_CHARGING
void (*remote_backlight_set_timeout_plugged)(int index);
#endif
#endif /* HAVE_REMOTE_LCD */
/* list */ /* list */
void (*gui_synclist_init)(struct gui_synclist * lists, void (*gui_synclist_init)(struct gui_synclist * lists,
list_get_name callback_get_item_name, void * data, list_get_name callback_get_item_name, void * data,
@ -413,6 +417,15 @@ struct plugin_api {
int count, void* data); int count, void* data);
bool (*simplelist_show_list)(struct simplelist_info *info); bool (*simplelist_show_list)(struct simplelist_info *info);
/* action handling */
int (*get_custom_action)(int context,int timeout,
const struct button_mapping* (*get_context_map)(int));
int (*get_action)(int context, int timeout);
#ifdef HAVE_TOUCHSCREEN
int (*action_get_touchscreen_press)(short *x, short *y);
#endif
bool (*action_userabort)(int timeout);
/* button */ /* button */
long (*button_get)(bool block); long (*button_get)(bool block);
long (*button_get_w_tmo)(int ticks); long (*button_get_w_tmo)(int ticks);
@ -486,6 +499,12 @@ struct plugin_api {
char *title, enum themable_icons icon, char *title, enum themable_icons icon,
const char *root, const char *selected); const char *root, const char *selected);
int (*rockbox_browse)(struct browse_context *browse); int (*rockbox_browse)(struct browse_context *browse);
struct tree_context* (*tree_get_context)(void);
struct entry* (*tree_get_entries)(struct tree_context* t);
struct entry* (*tree_get_entry_at)(struct tree_context* t, int index);
void (*set_current_file)(const char* path);
void (*set_dirfilter)(int l_dirfilter);
/* talking */ /* talking */
int (*talk_id)(int32_t id, bool enqueue); int (*talk_id)(int32_t id, bool enqueue);
@ -532,8 +551,14 @@ struct plugin_api {
void (*mutex_lock)(struct mutex *m); void (*mutex_lock)(struct mutex *m);
void (*mutex_unlock)(struct mutex *m); void (*mutex_unlock)(struct mutex *m);
#endif #endif
#ifdef HAVE_SEMAPHORE_OBJECTS
void (*semaphore_init)(struct semaphore *s, int max, int start);
int (*semaphore_wait)(struct semaphore *s, int timeout);
void (*semaphore_release)(struct semaphore *s);
#endif
void (*reset_poweroff_timer)(void); void (*reset_poweroff_timer)(void);
void (*set_sleeptimer_duration)(int minutes);
int (*get_sleep_timer)(void);
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int (*system_memory_guard)(int newmode); int (*system_memory_guard)(int newmode);
long *cpu_frequency; long *cpu_frequency;
@ -582,10 +607,6 @@ struct plugin_api {
void (*queue_reply)(struct event_queue *q, intptr_t retval); void (*queue_reply)(struct event_queue *q, intptr_t retval);
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
void (*usb_acknowledge)(long id);
#ifdef USB_ENABLE_HID
void (*usb_hid_send)(usage_page_t usage_page, int id);
#endif
#ifdef RB_PROFILE #ifdef RB_PROFILE
void (*profile_thread)(void); void (*profile_thread)(void);
void (*profstop)(void); void (*profstop)(void);
@ -658,6 +679,7 @@ struct plugin_api {
/* sound */ /* sound */
void (*sound_set)(int setting, int value); void (*sound_set)(int setting, int value);
int (*sound_current)(int setting); /*stub*/
int (*sound_default)(int setting); int (*sound_default)(int setting);
int (*sound_min)(int setting); int (*sound_min)(int setting);
int (*sound_max)(int setting); int (*sound_max)(int setting);
@ -667,6 +689,10 @@ struct plugin_api {
int (*sound_enum_hw_eq_band_setting)(unsigned int band, int (*sound_enum_hw_eq_band_setting)(unsigned int band,
unsigned int band_setting); unsigned int band_setting);
#endif /* AUDIOHW_HAVE_EQ */ #endif /* AUDIOHW_HAVE_EQ */
#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
(CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
void (*sound_set_pitch)(int32_t pitch);
#endif
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
void (*mp3_play_data)(const void* start, size_t size, void (*mp3_play_data)(const void* start, size_t size,
mp3_play_callback_t get_more); mp3_play_callback_t get_more);
@ -743,7 +769,48 @@ struct plugin_api {
void (*pcmbuf_fade)(bool fade, bool in); void (*pcmbuf_fade)(bool fade, bool in);
void (*system_sound_play)(enum system_sound sound); void (*system_sound_play)(enum system_sound sound);
void (*keyclick_click)(bool rawbutton, int action); void (*keyclick_click)(bool rawbutton, int action);
#endif /* CONFIG_CODEC == SWCODC */ #endif /* CONFIG_CODEC == SWCODEC */
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
unsigned short (*peak_meter_scale_value)(unsigned short val,
int meterwidth);
void (*peak_meter_set_use_dbfs)(bool use);
bool (*peak_meter_get_use_dbfs)(void);
#endif
/* metadata */
bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
bool (*mp3info)(struct mp3entry *entry, const char *filename);
int (*count_mp3_frames)(int fd, int startpos, int filesize,
void (*progressfunc)(int),
unsigned char* buf, size_t buflen);
int (*create_xing_header)(int fd, long startpos, long filesize,
unsigned char *buf, unsigned long num_frames,
unsigned long rec_time, unsigned long header_template,
void (*progressfunc)(int), bool generate_toc,
unsigned char* tempbuf, size_t tempbuf_len);
unsigned long (*find_next_frame)(int fd, long *offset,
long max_offset, unsigned long reference_header);
#ifdef HAVE_TAGCACHE
bool (*tagcache_search)(struct tagcache_search *tcs, int tag);
void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs,
void *buffer, long length);
bool (*tagcache_search_add_filter)(struct tagcache_search *tcs,
int tag, int seek);
bool (*tagcache_get_next)(struct tagcache_search *tcs);
bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid,
int tag, char *buf, long size);
void (*tagcache_search_finish)(struct tagcache_search *tcs);
long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
#endif
#endif /* HAVE_TAGCACHE */
#ifdef HAVE_ALBUMART
bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string,
char *buf, int buflen);
#endif
/* playback control */ /* playback control */
int (*playlist_amount)(void); int (*playlist_amount)(void);
@ -777,10 +844,6 @@ struct plugin_api {
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
unsigned long (*mpeg_get_last_header)(void); unsigned long (*mpeg_get_last_header)(void);
#endif #endif
#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
(CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
void (*sound_set_pitch)(int32_t pitch);
#endif
/* MAS communication */ /* MAS communication */
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
@ -795,7 +858,7 @@ struct plugin_api {
void (*i2c_end)(void); void (*i2c_end)(void);
int (*i2c_write)(int address, const unsigned char* buf, int count ); int (*i2c_write)(int address, const unsigned char* buf, int count );
#endif #endif
#endif #endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */
/* menu */ /* menu */
struct menu_table *(*root_menu_get_options)(int *nb_options); struct menu_table *(*root_menu_get_options)(int *nb_options);
@ -805,7 +868,7 @@ struct plugin_api {
char* (*root_menu_write_to_cfg)(void* setting, char*buf, int buf_len); char* (*root_menu_write_to_cfg)(void* setting, char*buf, int buf_len);
void (*root_menu_load_from_cfg)(void* setting, char *value); void (*root_menu_load_from_cfg)(void* setting, char *value);
/* scroll bar */ /* statusbars */
struct gui_syncstatusbar *statusbars; struct gui_syncstatusbar *statusbars;
void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw); void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw);
@ -838,14 +901,6 @@ struct plugin_api {
bool (*set_color)(struct screen *display, char *title, bool (*set_color)(struct screen *display, char *title,
unsigned *color, unsigned banned_color); unsigned *color, unsigned banned_color);
#endif #endif
/* action handling */
int (*get_custom_action)(int context,int timeout,
const struct button_mapping* (*get_context_map)(int));
int (*get_action)(int context, int timeout);
#ifdef HAVE_TOUCHSCREEN
int (*action_get_touchscreen_press)(short *x, short *y);
#endif
bool (*action_userabort)(int timeout);
/* power */ /* power */
int (*battery_level)(void); int (*battery_level)(void);
@ -860,7 +915,10 @@ struct plugin_api {
#endif #endif
/* usb */ /* usb */
bool (*usb_inserted)(void); bool (*usb_inserted)(void);
void (*usb_acknowledge)(long id);
#ifdef USB_ENABLE_HID
void (*usb_hid_send)(usage_page_t usage_page, int id);
#endif
/* misc */ /* misc */
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
int * (*__errno)(void); int * (*__errno)(void);
@ -876,14 +934,7 @@ struct plugin_api {
#if CONFIG_RTC #if CONFIG_RTC
time_t (*mktime)(struct tm *t); time_t (*mktime)(struct tm *t);
#endif #endif
void* (*plugin_get_buffer)(size_t *buffer_size);
void* (*plugin_get_audio_buffer)(size_t *buffer_size);
void (*plugin_release_audio_buffer)(void);
void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
char* (*plugin_get_current_filename)(void);
#ifdef PLUGIN_USE_IRAM
void (*audio_hard_stop)(void);
#endif
#if defined(DEBUG) || defined(SIMULATOR) #if defined(DEBUG) || defined(SIMULATOR)
void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
#endif #endif
@ -904,25 +955,7 @@ struct plugin_api {
int count, int count,
bool signd); bool signd);
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
bool (*mp3info)(struct mp3entry *entry, const char *filename);
int (*count_mp3_frames)(int fd, int startpos, int filesize,
void (*progressfunc)(int),
unsigned char* buf, size_t buflen);
int (*create_xing_header)(int fd, long startpos, long filesize,
unsigned char *buf, unsigned long num_frames,
unsigned long rec_time, unsigned long header_template,
void (*progressfunc)(int), bool generate_toc,
unsigned char* tempbuf, size_t tempbuf_len);
unsigned long (*find_next_frame)(int fd, long *offset,
long max_offset, unsigned long reference_header);
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
unsigned short (*peak_meter_scale_value)(unsigned short val,
int meterwidth);
void (*peak_meter_set_use_dbfs)(bool use);
bool (*peak_meter_get_use_dbfs)(void);
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize, int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize,
int format, const struct custom_format *cformat); int format, const struct custom_format *cformat);
@ -937,12 +970,6 @@ struct plugin_api {
void (*screen_dump_set_hook)(void (*hook)(int fh)); void (*screen_dump_set_hook)(void (*hook)(int fh));
#endif #endif
int (*show_logo)(void); int (*show_logo)(void);
struct tree_context* (*tree_get_context)(void);
struct entry* (*tree_get_entries)(struct tree_context* t);
struct entry* (*tree_get_entry_at)(struct tree_context* t, int index);
void (*set_current_file)(const char* path);
void (*set_dirfilter)(int l_dirfilter);
#ifdef HAVE_WHEEL_POSITION #ifdef HAVE_WHEEL_POSITION
int (*wheel_status)(void); int (*wheel_status)(void);
@ -958,32 +985,16 @@ struct plugin_api {
void (*led)(bool on); void (*led)(bool on);
#ifdef HAVE_TAGCACHE /*plugin*/
bool (*tagcache_search)(struct tagcache_search *tcs, int tag); void* (*plugin_get_buffer)(size_t *buffer_size);
void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs, void* (*plugin_get_audio_buffer)(size_t *buffer_size);
void *buffer, long length); void (*plugin_release_audio_buffer)(void);
bool (*tagcache_search_add_filter)(struct tagcache_search *tcs, void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
int tag, int seek); char* (*plugin_get_current_filename)(void);
bool (*tagcache_get_next)(struct tagcache_search *tcs); #ifdef PLUGIN_USE_IRAM
bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid, void (*audio_hard_stop)(void);
int tag, char *buf, long size);
void (*tagcache_search_finish)(struct tagcache_search *tcs);
long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
#endif
#endif #endif
#ifdef HAVE_ALBUMART
bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string,
char *buf, int buflen);
#endif
#ifdef HAVE_SEMAPHORE_OBJECTS
void (*semaphore_init)(struct semaphore *s, int max, int start);
int (*semaphore_wait)(struct semaphore *s, int timeout);
void (*semaphore_release)(struct semaphore *s);
#endif
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */