diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2024-07-24 18:39:06 +0200 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2024-07-26 15:15:06 -0400 |
commit | 23e5f77ab0c5f80de4091b365165276cfe9899dd (patch) | |
tree | 4aaeed994a811fbfaa9f96e697a6178ad19c27c2 | |
parent | 13830439fae202247626e5ebfd7fe3d57d7c5628 (diff) | |
download | rockbox-23e5f77ab0.tar.gz rockbox-23e5f77ab0.zip |
Remove mp3info function & remove list_do_action from plugin_api
Change-Id: Ia9a2d6889679832f23b19a989927277ba886cba4
-rw-r--r-- | apps/plugin.c | 20 | ||||
-rw-r--r-- | apps/plugin.h | 27 | ||||
-rw-r--r-- | apps/plugins/lib/id3.c | 2 | ||||
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 2 | ||||
-rw-r--r-- | apps/plugins/playing_time.c | 5 | ||||
-rw-r--r-- | apps/plugins/properties.c | 4 | ||||
-rw-r--r-- | apps/plugins/vbrfix.c | 4 | ||||
-rw-r--r-- | docs/API | 8 | ||||
-rw-r--r-- | docs/PLUGIN_API | 7 | ||||
-rw-r--r-- | lib/rbcodec/metadata/id3tags.c | 2 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata.c | 6 | ||||
-rw-r--r-- | lib/rbcodec/metadata/metadata.h | 1 |
12 files changed, 31 insertions, 57 deletions
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; } @@ -197,14 +197,6 @@ Memory allocation each and returns a pointer to the allocated memory. The memory is set to zero. -ID3 - - #include <id3.h> - bool mp3info(mp3entry *entry, char *filename); - - Return FALSE if successful. The given mp3entry is then filled in with - whatever id3 info it could find about the given file. - Various #include <kernel.h> diff --git a/docs/PLUGIN_API b/docs/PLUGIN_API index 29a7829b32..4760ecede2 100644 --- a/docs/PLUGIN_API +++ b/docs/PLUGIN_API @@ -1324,13 +1324,6 @@ time_t mktime(struct tm *t) \return \description -bool mp3info(struct mp3entry *entry, const char *filename) - \group misc - \param entry - \param filename - \return FALSE if successfull - \description The given =entry= is filled in with whatever id3 info it could find about the given =filename= - void mutex_init(struct mutex *m) \group kernel/ system \param m diff --git a/lib/rbcodec/metadata/id3tags.c b/lib/rbcodec/metadata/id3tags.c index ba7695d569..1e792d9122 100644 --- a/lib/rbcodec/metadata/id3tags.c +++ b/lib/rbcodec/metadata/id3tags.c @@ -1200,7 +1200,7 @@ int main(int argc, char **argv) for(i=1; i<argc; i++) { struct mp3entry mp3; mp3.album = "Bogus"; - if(mp3info(&mp3, argv[i], false)) { + if(!get_metadata(&mp3, -1, argv[i])) { printf("Failed to get %s\n", argv[i]); return 0; } diff --git a/lib/rbcodec/metadata/metadata.c b/lib/rbcodec/metadata/metadata.c index 670c37fcfd..70179daa2f 100644 --- a/lib/rbcodec/metadata/metadata.c +++ b/lib/rbcodec/metadata/metadata.c @@ -399,12 +399,6 @@ unsigned int probe_file_format(const char *filename) return AFMT_UNKNOWN; } -/* Note, that this returns false for successful, true for error! */ -bool mp3info(struct mp3entry *entry, const char *filename) -{ - return !get_metadata(entry, -1, filename); -} - /* Get metadata for track - return false if parsing showed problems with the * file that would prevent playback. supply a filedescriptor <0 and the file will be opened * and closed automatically within the get_metadata call diff --git a/lib/rbcodec/metadata/metadata.h b/lib/rbcodec/metadata/metadata.h index ce1b153833..8a379ad396 100644 --- a/lib/rbcodec/metadata/metadata.h +++ b/lib/rbcodec/metadata/metadata.h @@ -326,7 +326,6 @@ struct mp3entry { unsigned int probe_file_format(const char *filename); bool get_metadata(struct mp3entry* id3, int fd, const char* trackname); bool get_metadata_ex(struct mp3entry* id3, int fd, const char* trackname, int flags); -bool mp3info(struct mp3entry *entry, const char *filename); void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig); void copy_mp3entry(struct mp3entry *dest, const struct mp3entry *orig); void wipe_mp3entry(struct mp3entry *id3); |