From a2e5d9563f9dec84907f4f2060af6dfad895c4ba Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Mon, 20 Mar 2023 22:15:33 -0400 Subject: [Feature] resume TSR plugins after interruption WIP save tsr plugin path for later resume tsr plugin when user stops the interrupting plugin expand return of tsr_exit function to allow continue, suspend, terminate tsr plugins check parameter at start to determine if the plugin is being resumed Change-Id: I6fc70de664c7771e7dbc9a1af7a831e7b50b1d15 --- apps/plugin.h | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'apps/plugin.h') diff --git a/apps/plugin.h b/apps/plugin.h index c54ef180ec..3eb4101cbe 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -162,7 +162,7 @@ int plugin_open(const char *plugin, const char *parameter); * when this happens please take the opportunity to sort in * any new functions "waiting" at the end of the list. */ -#define PLUGIN_API_VERSION 266 +#define PLUGIN_API_VERSION 267 /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ @@ -179,6 +179,12 @@ enum plugin_status { PLUGIN_ERROR = -1, }; +enum plugin_tsr_status { + PLUGIN_TSR_CONTINUE = 0, /* TSR continues running */ + PLUGIN_TSR_SUSPEND, /* TSR exits but will restart later */ + PLUGIN_TSR_TERMINATE, /* TSR exits and will not be restarted */ +}; + /* NOTE: To support backwards compatibility, only add new functions at the end of the structure. Every time you add a new function, remember to increase PLUGIN_API_VERSION. If you make changes to the @@ -195,6 +201,8 @@ struct plugin_api { /* lcd */ void (*splash)(int ticks, const char *str); void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); + void (*splash_progress)(int current, int total, const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4); + void (*splash_progress_set_delay)(long delay_ticks); #ifdef HAVE_LCD_CONTRAST void (*lcd_set_contrast)(int x); #endif @@ -488,6 +496,8 @@ struct plugin_api { void (*set_dirfilter)(int l_dirfilter); void (*onplay_show_playlist_menu)(const char* path, void (*playlist_insert_cb)); + void (*onplay_show_playlist_cat_menu)(const char* track_name, int attr, + void (*add_to_pl_cb)); bool (*browse_id3)(struct mp3entry *id3, int playlist_display_index, int playlist_amount, struct tm *modified); @@ -660,6 +670,7 @@ struct plugin_api { void* (*buflib_get_data)(struct buflib_context* ctx, int handle); /* sound */ + void (*adjust_volume)(int steps); void (*sound_set)(int setting, int value); int (*sound_current)(int setting); /*stub*/ int (*sound_default)(int setting); @@ -769,6 +780,7 @@ struct plugin_api { bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); #endif #endif + bool (*tagtree_subentries_do_action)(bool (*action_cb)(const char *file_name)); #endif /* HAVE_TAGCACHE */ #ifdef HAVE_ALBUMART @@ -782,6 +794,7 @@ struct plugin_api { int (*playlist_resume)(void); void (*playlist_resume_track)(int start_index, unsigned int crc, unsigned long elapsed, unsigned long offset); + void (*playlist_set_modified)(struct playlist_info *playlist, bool modified); void (*playlist_start)(int start_index, unsigned long elapsed, unsigned long offset); int (*playlist_add)(const char *filename); @@ -932,29 +945,20 @@ struct plugin_api { 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)); + void (*plugin_tsr)(int (*exit_callback)(bool reenter)); char* (*plugin_get_current_filename)(void); size_t (*plugin_reserve_buffer)(size_t buffer_size); /* reboot and poweroff */ void (*sys_poweroff)(void); void (*sys_reboot)(void); /* pathfuncs */ + void (*fix_path_part)(char* path, int offset, int count); #ifdef HAVE_MULTIVOLUME int (*path_strip_volume)(const char *name, const char **nameptr, bool greedy); #endif /* new stuff at the end, sort into place next time the API gets incompatible */ - - void (*splash_progress)(int current, int total, const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4); - void (*splash_progress_set_delay)(long delay_ticks); - void (*fix_path_part)(char* path, int offset, int count); - void (*onplay_show_playlist_cat_menu)(const char* track_name, int attr, - void (*add_to_pl_cb)); -#ifdef HAVE_TAGCACHE - bool (*tagtree_subentries_do_action)(bool (*action_cb)(const char *file_name)); -#endif - void (*adjust_volume)(int steps); - void (*playlist_set_modified)(struct playlist_info *playlist, bool modified); + }; /* plugin header */ -- cgit v1.2.3