Remove mp3info function & remove list_do_action from plugin_api

Change-Id: Ia9a2d6889679832f23b19a989927277ba886cba4
This commit is contained in:
Christian Soffke 2024-07-24 18:39:06 +02:00
parent 13830439fa
commit 23e5f77ab0
12 changed files with 31 additions and 57 deletions

View file

@ -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;

View file

@ -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 */

View file

@ -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);
}

View file

@ -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)

View file

@ -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;

View file

@ -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
{

View file

@ -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;
}

View file

@ -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>

View file

@ -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

View file

@ -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;
}

View file

@ -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

View file

@ -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);