Added possibility to select the priority of the ID3 tags
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4962 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
de0100fafb
commit
f4f4111536
9 changed files with 129 additions and 147 deletions
113
apps/plugin.c
113
apps/plugin.c
|
@ -88,19 +88,25 @@ static const struct plugin_api rockbox_api = {
|
||||||
lcd_puts,
|
lcd_puts,
|
||||||
lcd_puts_scroll,
|
lcd_puts_scroll,
|
||||||
lcd_stop_scroll,
|
lcd_stop_scroll,
|
||||||
|
lcd_set_contrast,
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
lcd_define_pattern,
|
lcd_define_pattern,
|
||||||
lcd_get_locked_pattern,
|
lcd_get_locked_pattern,
|
||||||
lcd_unlock_pattern,
|
lcd_unlock_pattern,
|
||||||
lcd_putc,
|
lcd_putc,
|
||||||
|
lcd_put_cursor,
|
||||||
|
lcd_remove_cursor,
|
||||||
|
lcd_icon,
|
||||||
#else
|
#else
|
||||||
lcd_putsxy,
|
lcd_putsxy,
|
||||||
|
lcd_puts_style,
|
||||||
lcd_bitmap,
|
lcd_bitmap,
|
||||||
lcd_drawline,
|
lcd_drawline,
|
||||||
lcd_clearline,
|
lcd_clearline,
|
||||||
lcd_drawpixel,
|
lcd_drawpixel,
|
||||||
lcd_clearpixel,
|
lcd_clearpixel,
|
||||||
lcd_setfont,
|
lcd_setfont,
|
||||||
|
font_get,
|
||||||
lcd_clearrect,
|
lcd_clearrect,
|
||||||
lcd_fillrect,
|
lcd_fillrect,
|
||||||
lcd_drawrect,
|
lcd_drawrect,
|
||||||
|
@ -109,14 +115,21 @@ static const struct plugin_api rockbox_api = {
|
||||||
lcd_update,
|
lcd_update,
|
||||||
lcd_update_rect,
|
lcd_update_rect,
|
||||||
scrollbar,
|
scrollbar,
|
||||||
|
checkbox,
|
||||||
|
&lcd_framebuffer[0][0],
|
||||||
|
lcd_blit,
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
lcd_roll,
|
lcd_roll,
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
backlight_on,
|
||||||
|
backlight_off,
|
||||||
|
|
||||||
/* button */
|
/* button */
|
||||||
button_get,
|
button_get,
|
||||||
button_get_w_tmo,
|
button_get_w_tmo,
|
||||||
|
button_status,
|
||||||
|
button_clear_queue,
|
||||||
|
|
||||||
/* file */
|
/* file */
|
||||||
(open_func)PREFIX(open),
|
(open_func)PREFIX(open),
|
||||||
|
@ -131,6 +144,7 @@ static const struct plugin_api rockbox_api = {
|
||||||
PREFIX(filesize),
|
PREFIX(filesize),
|
||||||
fprintf,
|
fprintf,
|
||||||
read_line,
|
read_line,
|
||||||
|
settings_parseline,
|
||||||
|
|
||||||
/* dir */
|
/* dir */
|
||||||
PREFIX(opendir),
|
PREFIX(opendir),
|
||||||
|
@ -139,14 +153,21 @@ static const struct plugin_api rockbox_api = {
|
||||||
|
|
||||||
/* kernel */
|
/* kernel */
|
||||||
PREFIX(sleep),
|
PREFIX(sleep),
|
||||||
|
yield,
|
||||||
usb_screen,
|
usb_screen,
|
||||||
¤t_tick,
|
¤t_tick,
|
||||||
|
default_event_handler,
|
||||||
|
create_thread,
|
||||||
|
remove_thread,
|
||||||
|
|
||||||
/* strings and memory */
|
/* strings and memory */
|
||||||
snprintf,
|
snprintf,
|
||||||
strcpy,
|
strcpy,
|
||||||
|
strncpy,
|
||||||
strlen,
|
strlen,
|
||||||
strrchr,
|
strrchr,
|
||||||
|
strcmp,
|
||||||
|
strcasecmp,
|
||||||
memset,
|
memset,
|
||||||
memcpy,
|
memcpy,
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
@ -154,32 +175,6 @@ static const struct plugin_api rockbox_api = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* sound */
|
/* sound */
|
||||||
#ifndef SIMULATOR
|
|
||||||
#ifdef HAVE_MAS3587F
|
|
||||||
mas_codec_readreg,
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* misc */
|
|
||||||
srand,
|
|
||||||
rand,
|
|
||||||
splash,
|
|
||||||
(qsort_func)qsort,
|
|
||||||
kbd_input,
|
|
||||||
mpeg_current_track,
|
|
||||||
atoi,
|
|
||||||
get_time,
|
|
||||||
plugin_get_buffer,
|
|
||||||
|
|
||||||
/* new stuff at the end, sort into place next time the API gets incompatible */
|
|
||||||
|
|
||||||
#ifndef HAVE_LCD_CHARCELLS
|
|
||||||
&lcd_framebuffer[0][0],
|
|
||||||
lcd_blit,
|
|
||||||
#endif
|
|
||||||
yield,
|
|
||||||
|
|
||||||
plugin_get_mp3_buffer,
|
|
||||||
mpeg_sound_set,
|
mpeg_sound_set,
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
mp3_play_data,
|
mp3_play_data,
|
||||||
|
@ -187,23 +182,12 @@ static const struct plugin_api rockbox_api = {
|
||||||
mp3_play_stop,
|
mp3_play_stop,
|
||||||
mp3_is_playing,
|
mp3_is_playing,
|
||||||
bitswap,
|
bitswap,
|
||||||
|
#ifdef HAVE_MAS3587F
|
||||||
|
mas_codec_readreg,
|
||||||
#endif
|
#endif
|
||||||
&global_settings,
|
|
||||||
backlight_set_timeout,
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
ata_sleep,
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
checkbox,
|
/* playback control */
|
||||||
#endif
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
plugin_register_timer,
|
|
||||||
plugin_unregister_timer,
|
|
||||||
#endif
|
|
||||||
plugin_tsr,
|
|
||||||
create_thread,
|
|
||||||
remove_thread,
|
|
||||||
lcd_set_contrast,
|
|
||||||
mpeg_play,
|
mpeg_play,
|
||||||
mpeg_stop,
|
mpeg_stop,
|
||||||
mpeg_pause,
|
mpeg_pause,
|
||||||
|
@ -215,8 +199,31 @@ static const struct plugin_api rockbox_api = {
|
||||||
playlist_amount,
|
playlist_amount,
|
||||||
mpeg_status,
|
mpeg_status,
|
||||||
mpeg_has_changed_track,
|
mpeg_has_changed_track,
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
font_get,
|
/* misc */
|
||||||
|
srand,
|
||||||
|
rand,
|
||||||
|
splash,
|
||||||
|
(qsort_func)qsort,
|
||||||
|
kbd_input,
|
||||||
|
mpeg_current_track,
|
||||||
|
atoi,
|
||||||
|
get_time,
|
||||||
|
plugin_get_buffer,
|
||||||
|
plugin_get_mp3_buffer,
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
plugin_register_timer,
|
||||||
|
plugin_unregister_timer,
|
||||||
|
#endif
|
||||||
|
plugin_tsr,
|
||||||
|
|
||||||
|
/* new stuff at the end, sort into place next time the API gets incompatible */
|
||||||
|
|
||||||
|
|
||||||
|
&global_settings,
|
||||||
|
backlight_set_timeout,
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
ata_sleep,
|
||||||
#endif
|
#endif
|
||||||
#if defined(DEBUG) || defined(SIMULATOR)
|
#if defined(DEBUG) || defined(SIMULATOR)
|
||||||
debugf,
|
debugf,
|
||||||
|
@ -238,26 +245,6 @@ static const struct plugin_api rockbox_api = {
|
||||||
set_time,
|
set_time,
|
||||||
reset_poweroff_timer,
|
reset_poweroff_timer,
|
||||||
|
|
||||||
backlight_on,
|
|
||||||
backlight_off,
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
|
||||||
lcd_icon,
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
lcd_puts_style,
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
|
||||||
lcd_put_cursor,
|
|
||||||
lcd_remove_cursor,
|
|
||||||
#endif
|
|
||||||
settings_parseline,
|
|
||||||
strcmp,
|
|
||||||
button_status,
|
|
||||||
button_clear_queue,
|
|
||||||
strncpy,
|
|
||||||
strcasecmp,
|
|
||||||
default_event_handler
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int plugin_load(char* plugin, void* parameter)
|
int plugin_load(char* plugin, void* parameter)
|
||||||
|
|
117
apps/plugin.h
117
apps/plugin.h
|
@ -60,12 +60,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 24
|
#define PLUGIN_API_VERSION 25
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
new function which are "waiting" at the end of the function table) */
|
new function which are "waiting" at the end of the function table) */
|
||||||
#define PLUGIN_MIN_API_VERSION 19
|
#define PLUGIN_MIN_API_VERSION 25
|
||||||
|
|
||||||
/* plugin return codes */
|
/* plugin return codes */
|
||||||
enum plugin_status {
|
enum plugin_status {
|
||||||
|
@ -114,13 +114,18 @@ struct plugin_api {
|
||||||
void (*lcd_puts)(int x, int y, unsigned char *string);
|
void (*lcd_puts)(int x, int y, unsigned char *string);
|
||||||
void (*lcd_puts_scroll)(int x, int y, unsigned char* string);
|
void (*lcd_puts_scroll)(int x, int y, unsigned char* string);
|
||||||
void (*lcd_stop_scroll)(void);
|
void (*lcd_stop_scroll)(void);
|
||||||
|
void (*lcd_set_contrast)(int x);
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
#ifdef HAVE_LCD_CHARCELLS
|
||||||
void (*lcd_define_pattern)(int which,char *pattern);
|
void (*lcd_define_pattern)(int which,char *pattern);
|
||||||
unsigned char (*lcd_get_locked_pattern)(void);
|
unsigned char (*lcd_get_locked_pattern)(void);
|
||||||
void (*lcd_unlock_pattern)(unsigned char pat);
|
void (*lcd_unlock_pattern)(unsigned char pat);
|
||||||
void (*lcd_putc)(int x, int y, unsigned short ch);
|
void (*lcd_putc)(int x, int y, unsigned short ch);
|
||||||
|
void (*lcd_put_cursor)(int x, int y, char cursor_char);
|
||||||
|
void (*lcd_remove_cursor)(void);
|
||||||
|
void (*lcd_icon)(int icon, bool enable);
|
||||||
#else
|
#else
|
||||||
void (*lcd_putsxy)(int x, int y, const unsigned char *string);
|
void (*lcd_putsxy)(int x, int y, const unsigned char *string);
|
||||||
|
void (*lcd_puts_style)(int x, int y, unsigned char *str, int style);
|
||||||
void (*lcd_bitmap)(const unsigned char *src, int x, int y,
|
void (*lcd_bitmap)(const unsigned char *src, int x, int y,
|
||||||
int nx, int ny, bool clear);
|
int nx, int ny, bool clear);
|
||||||
void (*lcd_drawline)(int x1, int y1, int x2, int y2);
|
void (*lcd_drawline)(int x1, int y1, int x2, int y2);
|
||||||
|
@ -128,6 +133,7 @@ struct plugin_api {
|
||||||
void (*lcd_drawpixel)(int x, int y);
|
void (*lcd_drawpixel)(int x, int y);
|
||||||
void (*lcd_clearpixel)(int x, int y);
|
void (*lcd_clearpixel)(int x, int y);
|
||||||
void (*lcd_setfont)(int font);
|
void (*lcd_setfont)(int font);
|
||||||
|
struct font* (*font_get)(int font);
|
||||||
void (*lcd_clearrect)(int x, int y, int nx, int ny);
|
void (*lcd_clearrect)(int x, int y, int nx, int ny);
|
||||||
void (*lcd_fillrect)(int x, int y, int nx, int ny);
|
void (*lcd_fillrect)(int x, int y, int nx, int ny);
|
||||||
void (*lcd_drawrect)(int x, int y, int nx, int ny);
|
void (*lcd_drawrect)(int x, int y, int nx, int ny);
|
||||||
|
@ -137,14 +143,21 @@ struct plugin_api {
|
||||||
void (*lcd_update_rect)(int x, int y, int width, int height);
|
void (*lcd_update_rect)(int x, int y, int width, int height);
|
||||||
void (*scrollbar)(int x, int y, int width, int height, int items,
|
void (*scrollbar)(int x, int y, int width, int height, int items,
|
||||||
int min_shown, int max_shown, int orientation);
|
int min_shown, int max_shown, int orientation);
|
||||||
|
void (*checkbox)(int x, int y, int width, int height, bool checked);
|
||||||
|
unsigned char* lcd_framebuffer;
|
||||||
|
void (*lcd_blit) (unsigned char* p_data, int x, int y, int width, int height, int stride);
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
void (*lcd_roll)(int pixels);
|
void (*lcd_roll)(int pixels);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
void (*backlight_on)(void);
|
||||||
|
void (*backlight_off)(void);
|
||||||
|
|
||||||
/* button */
|
/* button */
|
||||||
int (*button_get)(bool block);
|
int (*button_get)(bool block);
|
||||||
int (*button_get_w_tmo)(int ticks);
|
int (*button_get_w_tmo)(int ticks);
|
||||||
|
int (*button_status)(void);
|
||||||
|
void (*button_clear_queue)(void);
|
||||||
|
|
||||||
/* file */
|
/* file */
|
||||||
int (*open)(const char* pathname, int flags);
|
int (*open)(const char* pathname, int flags);
|
||||||
|
@ -159,6 +172,7 @@ struct plugin_api {
|
||||||
int (*filesize)(int fd);
|
int (*filesize)(int fd);
|
||||||
int (*fprintf)(int fd, const char *fmt, ...);
|
int (*fprintf)(int fd, const char *fmt, ...);
|
||||||
int (*read_line)(int fd, char* buffer, int buffer_size);
|
int (*read_line)(int fd, char* buffer, int buffer_size);
|
||||||
|
bool (*settings_parseline)(char* line, char** name, char** value);
|
||||||
|
|
||||||
/* dir */
|
/* dir */
|
||||||
DIR* (*opendir)(const char* name);
|
DIR* (*opendir)(const char* name);
|
||||||
|
@ -167,14 +181,21 @@ struct plugin_api {
|
||||||
|
|
||||||
/* kernel */
|
/* kernel */
|
||||||
void (*sleep)(int ticks);
|
void (*sleep)(int ticks);
|
||||||
|
void (*yield)(void);
|
||||||
void (*usb_screen)(void);
|
void (*usb_screen)(void);
|
||||||
long* current_tick;
|
long* current_tick;
|
||||||
|
int (*default_event_handler)(int event);
|
||||||
|
int (*create_thread)(void* function, void* stack, int stack_size, char *name);
|
||||||
|
void (*remove_thread)(int threadnum);
|
||||||
|
|
||||||
/* strings and memory */
|
/* strings and memory */
|
||||||
int (*snprintf)(char *buf, size_t size, const char *fmt, ...);
|
int (*snprintf)(char *buf, size_t size, const char *fmt, ...);
|
||||||
char* (*strcpy)(char *dst, const char *src);
|
char* (*strcpy)(char *dst, const char *src);
|
||||||
|
char *(*strncpy)(char *dst, const char *src, size_t length);
|
||||||
size_t (*strlen)(const char *str);
|
size_t (*strlen)(const char *str);
|
||||||
char * (*strrchr)(const char *s, int c);
|
char * (*strrchr)(const char *s, int c);
|
||||||
|
int (*strcmp)(const char *, const char *);
|
||||||
|
int (*strcasecmp)(const char *, const char *);
|
||||||
void* (*memset)(void *dst, int c, size_t length);
|
void* (*memset)(void *dst, int c, size_t length);
|
||||||
void* (*memcpy)(void *out, const void *in, size_t n);
|
void* (*memcpy)(void *out, const void *in, size_t n);
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
@ -182,32 +203,6 @@ struct plugin_api {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* sound */
|
/* sound */
|
||||||
#ifndef SIMULATOR
|
|
||||||
#ifdef HAVE_MAS3587F
|
|
||||||
int (*mas_codec_readreg)(int reg);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* misc */
|
|
||||||
void (*srand)(unsigned int seed);
|
|
||||||
int (*rand)(void);
|
|
||||||
void (*splash)(int ticks, bool center, char *fmt, ...);
|
|
||||||
void (*qsort)(void *base, size_t nmemb, size_t size,
|
|
||||||
int(*compar)(const void *, const void *));
|
|
||||||
int (*kbd_input)(char* buffer, int buflen);
|
|
||||||
struct mp3entry* (*mpeg_current_track)(void);
|
|
||||||
int (*atoi)(const char *str);
|
|
||||||
struct tm* (*get_time)(void);
|
|
||||||
void* (*plugin_get_buffer)(int* buffer_size);
|
|
||||||
|
|
||||||
/* new stuff, sort in next time the API gets broken! */
|
|
||||||
#ifndef HAVE_LCD_CHARCELLS
|
|
||||||
unsigned char* lcd_framebuffer;
|
|
||||||
void (*lcd_blit) (unsigned char* p_data, int x, int y, int width, int height, int stride);
|
|
||||||
#endif
|
|
||||||
void (*yield)(void);
|
|
||||||
|
|
||||||
void* (*plugin_get_mp3_buffer)(int* buffer_size);
|
|
||||||
void (*mpeg_sound_set)(int setting, int value);
|
void (*mpeg_sound_set)(int setting, int value);
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
void (*mp3_play_data)(unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size));
|
void (*mp3_play_data)(unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size));
|
||||||
|
@ -215,23 +210,10 @@ struct plugin_api {
|
||||||
void (*mp3_play_stop)(void);
|
void (*mp3_play_stop)(void);
|
||||||
bool (*mp3_is_playing)(void);
|
bool (*mp3_is_playing)(void);
|
||||||
void (*bitswap)(unsigned char *data, int length);
|
void (*bitswap)(unsigned char *data, int length);
|
||||||
|
#ifdef HAVE_MAS3587F
|
||||||
|
int (*mas_codec_readreg)(int reg);
|
||||||
#endif
|
#endif
|
||||||
struct user_settings* global_settings;
|
|
||||||
void (*backlight_set_timeout)(int index);
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
int (*ata_sleep)(void);
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
void (*checkbox)(int x, int y, int width, int height, bool checked);
|
|
||||||
#endif
|
|
||||||
#ifndef SIMULATOR
|
|
||||||
int (*plugin_register_timer)(int cycles, int prio, void (*timer_callback)(void));
|
|
||||||
void (*plugin_unregister_timer)(void);
|
|
||||||
#endif
|
|
||||||
void (*plugin_tsr)(void (*exit_callback)(void));
|
|
||||||
int (*create_thread)(void* function, void* stack, int stack_size, char *name);
|
|
||||||
void (*remove_thread)(int threadnum);
|
|
||||||
void (*lcd_set_contrast)(int x);
|
|
||||||
|
|
||||||
/* playback control */
|
/* playback control */
|
||||||
void (*mpeg_play)(int offset);
|
void (*mpeg_play)(int offset);
|
||||||
|
@ -246,14 +228,37 @@ struct plugin_api {
|
||||||
int (*mpeg_status)(void);
|
int (*mpeg_status)(void);
|
||||||
bool (*mpeg_has_changed_track)(void);
|
bool (*mpeg_has_changed_track)(void);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
/* misc */
|
||||||
struct font* (*font_get)(int font);
|
void (*srand)(unsigned int seed);
|
||||||
|
int (*rand)(void);
|
||||||
|
void (*splash)(int ticks, bool center, char *fmt, ...);
|
||||||
|
void (*qsort)(void *base, size_t nmemb, size_t size,
|
||||||
|
int(*compar)(const void *, const void *));
|
||||||
|
int (*kbd_input)(char* buffer, int buflen);
|
||||||
|
struct mp3entry* (*mpeg_current_track)(void);
|
||||||
|
int (*atoi)(const char *str);
|
||||||
|
struct tm* (*get_time)(void);
|
||||||
|
void* (*plugin_get_buffer)(int* buffer_size);
|
||||||
|
void* (*plugin_get_mp3_buffer)(int* buffer_size);
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
int (*plugin_register_timer)(int cycles, int prio, void (*timer_callback)(void));
|
||||||
|
void (*plugin_unregister_timer)(void);
|
||||||
#endif
|
#endif
|
||||||
|
void (*plugin_tsr)(void (*exit_callback)(void));
|
||||||
|
|
||||||
|
/* new stuff, sort in next time the API gets broken! */
|
||||||
|
|
||||||
|
struct user_settings* global_settings;
|
||||||
|
void (*backlight_set_timeout)(int index);
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
int (*ata_sleep)(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG) || defined(SIMULATOR)
|
#if defined(DEBUG) || defined(SIMULATOR)
|
||||||
void (*debugf)(char *fmt, ...);
|
void (*debugf)(char *fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
bool (*mp3info)(struct mp3entry *entry, char *filename) ;
|
bool (*mp3info)(struct mp3entry *entry, char *filename, bool v1first);
|
||||||
int (*count_mp3_frames)(int fd, int startpos, int filesize,
|
int (*count_mp3_frames)(int fd, int startpos, int filesize,
|
||||||
void (*progressfunc)(int));
|
void (*progressfunc)(int));
|
||||||
int (*create_xing_header)(int fd, int startpos, int filesize,
|
int (*create_xing_header)(int fd, int startpos, int filesize,
|
||||||
|
@ -274,26 +279,6 @@ struct plugin_api {
|
||||||
int (*set_time)(struct tm *tm);
|
int (*set_time)(struct tm *tm);
|
||||||
void (*reset_poweroff_timer)(void);
|
void (*reset_poweroff_timer)(void);
|
||||||
|
|
||||||
void (*backlight_on)(void);
|
|
||||||
void (*backlight_off)(void);
|
|
||||||
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
|
||||||
void (*lcd_icon)(int icon, bool enable);
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
|
||||||
void (*lcd_puts_style)(int x, int y, unsigned char *str, int style);
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_LCD_CHARCELLS
|
|
||||||
void (*lcd_put_cursor)(int x, int y, char cursor_char);
|
|
||||||
void (*lcd_remove_cursor)(void);
|
|
||||||
#endif
|
|
||||||
bool (*settings_parseline)(char* line, char** name, char** value);
|
|
||||||
int (*strcmp)(const char *, const char *);
|
|
||||||
int (*button_status)(void);
|
|
||||||
void (*button_clear_queue)(void);
|
|
||||||
char *(*strncpy)(char *dst, const char *src, size_t length);
|
|
||||||
int (*strcasecmp)(const char *, const char *);
|
|
||||||
int (*default_event_handler)(int event);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* defined by the plugin loader (plugin.c) */
|
/* defined by the plugin loader (plugin.c) */
|
||||||
|
|
|
@ -145,7 +145,7 @@ static bool vbr_fix(char *selected_file)
|
||||||
|
|
||||||
xingupdate(0);
|
xingupdate(0);
|
||||||
|
|
||||||
rc = rb->mp3info(&entry, selected_file);
|
rc = rb->mp3info(&entry, selected_file, false);
|
||||||
if(rc < 0) {
|
if(rc < 0) {
|
||||||
fileerror(rc);
|
fileerror(rc);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -390,7 +390,7 @@ int talk_file(char* filename, bool enqueue)
|
||||||
if (p_thumbnail == NULL || size_for_thumbnail <= 0)
|
if (p_thumbnail == NULL || size_for_thumbnail <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if(mp3info(&info, filename)) /* use this to find real start */
|
if(mp3info(&info, filename, false)) /* use this to find real start */
|
||||||
{
|
{
|
||||||
return 0; /* failed to open, or invalid */
|
return 0; /* failed to open, or invalid */
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ enum {
|
||||||
ID3_VER_2_4
|
ID3_VER_2_4
|
||||||
};
|
};
|
||||||
|
|
||||||
bool mp3info(struct mp3entry *entry, char *filename);
|
bool mp3info(struct mp3entry *entry, char *filename, bool v1first);
|
||||||
char* id3_get_genre(struct mp3entry* id3);
|
char* id3_get_genre(struct mp3entry* id3);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -96,6 +96,7 @@ void mpeg_error_clear(void);
|
||||||
/* in order to keep the recording here, I have to expose this */
|
/* in order to keep the recording here, I have to expose this */
|
||||||
void rec_tick(void);
|
void rec_tick(void);
|
||||||
void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
|
void playback_tick(void); /* FixMe: get rid of this, use mp3_get_playtime() */
|
||||||
|
void mpeg_id3_options(bool _v1first);
|
||||||
|
|
||||||
#define MPEG_STATUS_PLAY 1
|
#define MPEG_STATUS_PLAY 1
|
||||||
#define MPEG_STATUS_PAUSE 2
|
#define MPEG_STATUS_PAUSE 2
|
||||||
|
|
|
@ -798,13 +798,12 @@ static int getsonglength(int fd, struct mp3entry *entry)
|
||||||
* Checks all relevant information (such as ID3v1 tag, ID3v2 tag, length etc)
|
* Checks all relevant information (such as ID3v1 tag, ID3v2 tag, length etc)
|
||||||
* about an MP3 file and updates it's entry accordingly.
|
* about an MP3 file and updates it's entry accordingly.
|
||||||
*
|
*
|
||||||
* Arguments: entry - the entry to check and update with the new information
|
|
||||||
*
|
|
||||||
* Returns: void
|
|
||||||
*/
|
*/
|
||||||
bool mp3info(struct mp3entry *entry, char *filename)
|
bool mp3info(struct mp3entry *entry, char *filename, bool v1first)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
int v1found = false;
|
||||||
|
|
||||||
fd = open(filename, O_RDONLY);
|
fd = open(filename, O_RDONLY);
|
||||||
if(-1 == fd)
|
if(-1 == fd)
|
||||||
return true;
|
return true;
|
||||||
|
@ -819,7 +818,10 @@ bool mp3info(struct mp3entry *entry, char *filename)
|
||||||
entry->tracknum = 0;
|
entry->tracknum = 0;
|
||||||
entry->genre = 0xff;
|
entry->genre = 0xff;
|
||||||
|
|
||||||
if (entry->id3v2len)
|
if(v1first)
|
||||||
|
v1found = setid3v1title(fd, entry);
|
||||||
|
|
||||||
|
if (!v1found && entry->id3v2len)
|
||||||
setid3v2title(fd, entry);
|
setid3v2title(fd, entry);
|
||||||
entry->length = getsonglength(fd, entry);
|
entry->length = getsonglength(fd, entry);
|
||||||
|
|
||||||
|
@ -827,9 +829,9 @@ bool mp3info(struct mp3entry *entry, char *filename)
|
||||||
the true size of the MP3 stream */
|
the true size of the MP3 stream */
|
||||||
entry->filesize -= entry->first_frame_offset;
|
entry->filesize -= entry->first_frame_offset;
|
||||||
|
|
||||||
/* only seek to end of file if no id3v2 tags were found */
|
/* only seek to end of file if no id3v2 tags were found,
|
||||||
if (!entry->id3v2len) {
|
and we already haven't looked for a v1 tag */
|
||||||
if(!entry->title)
|
if (!v1first && !entry->id3v2len) {
|
||||||
setid3v1title(fd, entry);
|
setid3v1title(fd, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,7 +862,7 @@ int main(int argc, char **argv)
|
||||||
for(i=1; i<argc; i++) {
|
for(i=1; i<argc; i++) {
|
||||||
struct mp3entry mp3;
|
struct mp3entry mp3;
|
||||||
mp3.album = "Bogus";
|
mp3.album = "Bogus";
|
||||||
if(mp3info(&mp3, argv[i])) {
|
if(mp3info(&mp3, argv[i], false)) {
|
||||||
printf("Failed to get %s\n", argv[i]);
|
printf("Failed to get %s\n", argv[i]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,8 @@ struct id3tag
|
||||||
static struct id3tag *id3tags[MAX_ID3_TAGS];
|
static struct id3tag *id3tags[MAX_ID3_TAGS];
|
||||||
static struct id3tag _id3tags[MAX_ID3_TAGS];
|
static struct id3tag _id3tags[MAX_ID3_TAGS];
|
||||||
|
|
||||||
|
static bool v1first = false;
|
||||||
|
|
||||||
static unsigned int current_track_counter = 0;
|
static unsigned int current_track_counter = 0;
|
||||||
static unsigned int last_track_counter = 0;
|
static unsigned int last_track_counter = 0;
|
||||||
|
|
||||||
|
@ -736,7 +738,7 @@ static int add_track_to_tag_list(char *filename)
|
||||||
{
|
{
|
||||||
/* grab id3 tag of new file and
|
/* grab id3 tag of new file and
|
||||||
remember where in memory it starts */
|
remember where in memory it starts */
|
||||||
if(mp3info(&(t->id3), filename))
|
if(mp3info(&(t->id3), filename, v1first))
|
||||||
{
|
{
|
||||||
DEBUGF("Bad mp3\n");
|
DEBUGF("Bad mp3\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1985,6 +1987,11 @@ static void mpeg_thread(void)
|
||||||
static struct mp3entry taginfo;
|
static struct mp3entry taginfo;
|
||||||
#endif /* #ifdef SIMULATOR */
|
#endif /* #ifdef SIMULATOR */
|
||||||
|
|
||||||
|
void mpeg_id3_options(bool _v1first)
|
||||||
|
{
|
||||||
|
v1first = _v1first;
|
||||||
|
}
|
||||||
|
|
||||||
struct mp3entry* mpeg_current_track()
|
struct mp3entry* mpeg_current_track()
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
@ -2443,7 +2450,7 @@ void mpeg_play(int offset)
|
||||||
trackname = playlist_peek( steps );
|
trackname = playlist_peek( steps );
|
||||||
if (!trackname)
|
if (!trackname)
|
||||||
break;
|
break;
|
||||||
if(mp3info(&taginfo, trackname)) {
|
if(mp3info(&taginfo, trackname, v1first)) {
|
||||||
/* bad mp3, move on */
|
/* bad mp3, move on */
|
||||||
if(++steps > playlist_amount())
|
if(++steps > playlist_amount())
|
||||||
break;
|
break;
|
||||||
|
@ -2518,7 +2525,7 @@ void mpeg_next(void)
|
||||||
file = playlist_peek(steps);
|
file = playlist_peek(steps);
|
||||||
if(!file)
|
if(!file)
|
||||||
break;
|
break;
|
||||||
if(mp3info(&taginfo, file)) {
|
if(mp3info(&taginfo, file, v1first)) {
|
||||||
if(++steps > playlist_amount())
|
if(++steps > playlist_amount())
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
|
@ -2546,7 +2553,7 @@ void mpeg_prev(void)
|
||||||
file = playlist_peek(steps);
|
file = playlist_peek(steps);
|
||||||
if(!file)
|
if(!file)
|
||||||
break;
|
break;
|
||||||
if(mp3info(&taginfo, file)) {
|
if(mp3info(&taginfo, file, v1first)) {
|
||||||
steps--;
|
steps--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ void real_mpeg_play(char* fname)
|
||||||
static struct dither d0, d1;
|
static struct dither d0, d1;
|
||||||
int key=0;
|
int key=0;
|
||||||
|
|
||||||
mp3info(&mp3, fname);
|
mp3info(&mp3, fname, false); /* FIXME: honor the v1first setting */
|
||||||
|
|
||||||
init_sound(&sound);
|
init_sound(&sound);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue