--- ../rockbox-devel-1/apps/onplay.c 2005-08-31 11:05:04.000000000 -0400 +++ apps/onplay.c 2005-10-06 11:09:02.981728000 -0400 @@ -35,6 +35,7 @@ #include "keyboard.h" #include "mp3data.h" #include "id3.h" +#include "metadata.h" #include "screens.h" #include "tree.h" #include "buffer.h" @@ -503,6 +504,11 @@ return true; } +bool show_id3_info(void) +{ + return browse_id3_file(selected_file); +} + static bool exit_to_main; /* catch MENU_EXIT_MENU within context menu to call the main menu afterwards */ @@ -593,6 +599,14 @@ } } + if (!(attr & ATTR_DIRECTORY) && context == CONTEXT_TREE && + probe_file_format(selected_file) != AFMT_UNKNOWN) + { + items[i].desc = ID2P(LANG_MENU_SHOW_ID3_INFO); + items[i].function = show_id3_info; + i++; + } + if (!(attr & ATTR_DIRECTORY) && attr) { items[i].desc = ID2P(LANG_ONPLAY_OPEN_WITH); --- ../rockbox-devel-1/apps/screens.c 2005-10-06 11:59:56.864931900 -0400 +++ apps/screens.c 2005-10-06 11:09:03.044019600 -0400 @@ -41,6 +41,7 @@ #include "talk.h" #include "misc.h" #include "id3.h" +#include "metadata.h" #include "screens.h" #include "debug.h" #include "led.h" @@ -1320,10 +1321,9 @@ return line + LINES_PER_ID3_ITEM; } -bool browse_id3(void) +bool browse_id3_entry(const struct mp3entry *id3, const bool is_playing) { char buf[64]; - const struct mp3entry* id3 = audio_current_track(); #if CONFIG_CODEC == SWCODEC const int id3_items = 13 + id3->num_tags; #else @@ -1343,7 +1343,7 @@ int button; bool exit = false; - if (!id3 || (!(audio_status() & AUDIO_STATUS_PLAY))) + if (!id3) { return false; } @@ -1402,9 +1402,17 @@ wps_format_time(buf, sizeof(buf), id3->length); line = draw_id3_item(line, top, str(LANG_ID3_LENGHT), buf); - snprintf(buf, sizeof(buf), "%d/%d", playlist_get_display_index(), - playlist_amount()); - line = draw_id3_item(line, top, str(LANG_ID3_PLAYLIST), buf); + if (is_playing) + { + snprintf(buf, sizeof(buf), "%d/%d", playlist_get_display_index(), + playlist_amount()); + body = buf; + } + else + { + body = NULL; + } + line = draw_id3_item(line, top, str(LANG_ID3_PLAYLIST), body); snprintf(buf, sizeof(buf), "%d kbps%s", id3->bitrate, id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) ""); @@ -1508,6 +1516,46 @@ return false; } +bool browse_id3(void) +{ + return browse_id3_entry( audio_current_track(), true ); +} + +bool browse_id3_file(const char* filename) +{ + bool ret; + bool v1first = false; /* FIXME: is this an option? */ + struct track_info track; + +#if CONFIG_CODEC == SWCODEC + memset( &(track.id3), 0, sizeof(struct mp3entry) ); + + unsigned int filetype = probe_file_format(filename); + if (filetype == AFMT_UNKNOWN) + { + return false; + } + track.id3.codectype = filetype; + + int fd = open(filename, O_RDONLY); + if (fd < 0) + { + return false; + } + + ret = get_metadata(&track, fd, filename, v1first); +#else + ret = mp3info( &(track.id3), filename, v1first ); +#endif + + if (ret) + { + return browse_id3_entry( &(track.id3), false); + } + + return false; +} + bool set_rating(void) { struct mp3entry* id3 = audio_current_track(); --- ../rockbox-devel-1/apps/screens.h 2005-07-05 11:21:02.000000000 -0400 +++ apps/screens.h 2005-10-06 11:09:03.075165400 -0400 @@ -55,6 +55,7 @@ bool shutdown_screen(void); bool browse_id3(void); +bool browse_id3_file(const char* filename); bool set_rating(void); #endif