From 23e5f77ab0c5f80de4091b365165276cfe9899dd Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Wed, 24 Jul 2024 18:39:06 +0200 Subject: Remove mp3info function & remove list_do_action from plugin_api Change-Id: Ia9a2d6889679832f23b19a989927277ba886cba4 --- apps/plugin.c | 20 +++++++++----------- apps/plugin.h | 27 ++++++++++++--------------- apps/plugins/lib/id3.c | 2 +- apps/plugins/pictureflow/pictureflow.c | 2 +- apps/plugins/playing_time.c | 5 +++-- apps/plugins/properties.c | 4 ++-- apps/plugins/vbrfix.c | 4 ++-- 7 files changed, 30 insertions(+), 34 deletions(-) (limited to 'apps') diff --git a/apps/plugin.c b/apps/plugin.c index bd849dad50..20b438999b 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -352,7 +352,6 @@ static const struct plugin_api rockbox_api = { yesno_pop, /* action handling */ - list_do_action, get_custom_action, get_action, #ifdef HAVE_TOUCHSCREEN @@ -422,6 +421,7 @@ static const struct plugin_api rockbox_api = { crc_32, crc_32r, filetype_get_attr, + filetype_get_plugin, /* dir */ FS_PREFIX(opendir), @@ -582,6 +582,9 @@ static const struct plugin_api rockbox_api = { utf8length, utf8seek, + /* language */ + lang_is_rtl, + /* the buflib memory management library */ buflib_init, buflib_available, @@ -665,7 +668,7 @@ static const struct plugin_api rockbox_api = { /* metadata */ get_metadata, - mp3info, + get_codec_string, count_mp3_frames, create_xing_header, #ifdef HAVE_TAGCACHE @@ -677,6 +680,7 @@ static const struct plugin_api rockbox_api = { tagcache_search_finish, tagcache_get_numeric, tagcache_get_stat, + tagcache_commit_finalize, #if defined(HAVE_TC_RAMCACHE) tagcache_is_in_ram, #if defined(HAVE_DIRCACHE) @@ -694,6 +698,9 @@ static const struct plugin_api rockbox_api = { playlist_get_current, playlist_get_resume_info, playlist_get_track_info, + playlist_get_first_index, + playlist_get_display_index, + playlist_entries_iterate, playlist_amount, playlist_resume, playlist_resume_track, @@ -833,15 +840,6 @@ static const struct plugin_api rockbox_api = { /* new stuff at the end, sort into place next time the API gets incompatible */ -#ifdef HAVE_TAGCACHE - tagcache_commit_finalize, -#endif - playlist_get_first_index, - playlist_get_display_index, - filetype_get_plugin, - playlist_entries_iterate, - lang_is_rtl, - get_codec_string, }; static int plugin_buffer_handle; diff --git a/apps/plugin.h b/apps/plugin.h index 66c895d0db..135a068898 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -163,7 +163,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 270 +#define PLUGIN_API_VERSION 271 /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ @@ -405,8 +405,6 @@ struct plugin_api { bool (*yesno_pop)(const char* text); /* action handling */ - bool (*list_do_action)(int context, int timeout, - struct gui_synclist *lists, int *action); int (*get_custom_action)(int context,int timeout, const struct button_mapping* (*get_context_map)(int)); int (*get_action)(int context, int timeout); @@ -479,6 +477,7 @@ struct plugin_api { uint32_t (*crc_32r)(const void *src, uint32_t len, uint32_t crc32); int (*filetype_get_attr)(const char* file); + char* (*filetype_get_plugin)(int attr, char *buffer, size_t buffer_len); /* dir */ DIR * (*opendir)(const char *dirname); @@ -662,6 +661,9 @@ struct plugin_api { unsigned long (*utf8length)(const unsigned char *utf8); int (*utf8seek)(const unsigned char* utf8, int offset); + /* language */ + int (*lang_is_rtl)(void); + /* the buflib memory management library */ void (*buflib_init)(struct buflib_context* ctx, void* buf, size_t size); size_t (*buflib_available)(struct buflib_context* ctx); @@ -761,7 +763,7 @@ struct plugin_api { /* metadata */ bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname); - bool (*mp3info)(struct mp3entry *entry, const char *filename); + const char* (*get_codec_string)(int codectype); int (*count_mp3_frames)(int fd, int startpos, int filesize, void (*progressfunc)(int), unsigned char* buf, size_t buflen); @@ -782,6 +784,7 @@ struct plugin_api { void (*tagcache_search_finish)(struct tagcache_search *tcs); long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag); struct tagcache_stat* (*tagcache_get_stat)(void); + void (*tagcache_commit_finalize)(void); #if defined(HAVE_TC_RAMCACHE) bool (*tagcache_is_in_ram)(void); #if defined(HAVE_DIRCACHE) @@ -801,6 +804,11 @@ struct plugin_api { int (*playlist_get_resume_info)(int *resume_index); int (*playlist_get_track_info)(struct playlist_info* playlist, int index, struct playlist_track_info* info); + int (*playlist_get_first_index)(const struct playlist_info* playlist); + int (*playlist_get_display_index)(void); + bool (*playlist_entries_iterate)(const char *filename, + struct playlist_insert_context *pl_context, + bool (*action_cb)(const char *file_name)); int (*playlist_amount)(void); int (*playlist_resume)(void); void (*playlist_resume_track)(int start_index, unsigned int crc, @@ -969,17 +977,6 @@ struct plugin_api { #endif /* new stuff at the end, sort into place next time the API gets incompatible */ -#ifdef HAVE_TAGCACHE - void (*tagcache_commit_finalize)(void); -#endif - int (*playlist_get_first_index)(const struct playlist_info* playlist); - int (*playlist_get_display_index)(void); - char* (*filetype_get_plugin)(int attr, char *buffer, size_t buffer_len); - bool (*playlist_entries_iterate)(const char *filename, - struct playlist_insert_context *pl_context, - bool (*action_cb)(const char *file_name)); - int (*lang_is_rtl)(void); - const char* (*get_codec_string)(int codectype); }; /* plugin header */ diff --git a/apps/plugins/lib/id3.c b/apps/plugins/lib/id3.c index b0202b1d9c..6af715b1fb 100644 --- a/apps/plugins/lib/id3.c +++ b/apps/plugins/lib/id3.c @@ -35,5 +35,5 @@ bool retrieve_id3(struct mp3entry *id3, const char* file) } #endif - return !rb->mp3info(id3, file); + return rb->get_metadata(id3, -1, file); } diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 87ad1a403f..e5492cf01c 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -4040,7 +4040,7 @@ static int show_id3_info(const char *selected_file) i = 0; do { file_name = i == 0 ? selected_file : get_track_filename(i); - if (rb->mp3info(&id3, file_name)) + if (!rb->get_metadata(&id3, -1, file_name)) return 0; if (is_multiple_tracks) diff --git a/apps/plugins/playing_time.c b/apps/plugins/playing_time.c index f8b4b006a9..1da0d437c0 100644 --- a/apps/plugins/playing_time.c +++ b/apps/plugins/playing_time.c @@ -350,7 +350,7 @@ static bool playing_time(void) continue; if (rb->playlist_get_track_info(NULL, index, &pltrack) < 0 - || rb->mp3info(&id3, pltrack.filename)) + || !rb->get_metadata(&id3, -1, pltrack.filename)) { error_count++; continue; @@ -392,7 +392,8 @@ static bool playing_time(void) rb->gui_synclist_draw(&pt_lists); rb->gui_synclist_speak_item(&pt_lists); while (true) { - if (rb->list_do_action(CONTEXT_LIST, HZ/2, &pt_lists, &key) == 0 + key = rb->get_action(CONTEXT_LIST, HZ/2); + if (rb->gui_synclist_do_button(&pt_lists, &key) == 0 && key!=ACTION_NONE && key!=ACTION_UNKNOWN) { bool usb = rb->default_event_handler(key) == SYS_USB_CONNECTED; diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 73ec64be80..dc55b8128b 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c @@ -130,7 +130,7 @@ static bool file_properties(const char* selected_file) rb->snprintf(str_time, sizeof str_time, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec); - if (props_type != PROPS_PLAYLIST && !rb->mp3info(&id3, selected_file)) + if (props_type != PROPS_PLAYLIST && rb->get_metadata(&id3, -1, selected_file)) props_type = PROPS_ID3; found = true; break; @@ -416,7 +416,7 @@ static bool determine_file_or_dir(void) bool mul_id3_add(const char *file_name) { - if (!file_name || rb->mp3info(&id3, file_name)) + if (!file_name || !rb->get_metadata(&id3, -1, file_name)) skipped_count++; else { diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c index 5aaf2ffada..622a0a4f07 100644 --- a/apps/plugins/vbrfix.c +++ b/apps/plugins/vbrfix.c @@ -155,8 +155,8 @@ static bool vbr_fix(const char *selected_file) xingupdate(0); - rc = rb->mp3info(&entry, selected_file); - if(rc) { + rc = rb->get_metadata(&entry, -1, selected_file); + if(!rc) { fileerror(rc); return true; } -- cgit v1.2.3