diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2005-07-05 19:33:33 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2005-07-05 19:33:33 +0000 |
commit | 1e5119b77bda5f67ad032a9587ead2d311b0767a (patch) | |
tree | 8b83c755a9b7c065935e95db8e328d2e82db6e61 /apps/wps-display.c | |
parent | 3e33a0f8ee62dc37e6e028e5dcb39b91e0e0d154 (diff) | |
download | rockbox-1e5119b77bda5f67ad032a9587ead2d311b0767a.tar.gz rockbox-1e5119b77bda5f67ad032a9587ead2d311b0767a.zip |
Show the same information in the ID3 browser as in the WPS screen; use string version of tags if available, format time in the same way.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7029 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/wps-display.c')
-rw-r--r-- | apps/wps-display.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/apps/wps-display.c b/apps/wps-display.c index 10a4ca045f..71f88672ec 100644 --- a/apps/wps-display.c +++ b/apps/wps-display.c | |||
@@ -225,7 +225,7 @@ bool wps_load(const char* file, bool display) | |||
225 | /* reset image buffer */ | 225 | /* reset image buffer */ |
226 | img_buf_ptr = img_buf; | 226 | img_buf_ptr = img_buf; |
227 | img_buf_free = IMG_BUFSIZE; | 227 | img_buf_free = IMG_BUFSIZE; |
228 | 228 | ||
229 | /* set images to unloaded */ | 229 | /* set images to unloaded */ |
230 | for (i = 0; i < MAX_IMAGES; i++) { | 230 | for (i = 0; i < MAX_IMAGES; i++) { |
231 | img[i].loaded = false; | 231 | img[i].loaded = false; |
@@ -263,9 +263,9 @@ bool wps_load(const char* file, bool display) | |||
263 | } | 263 | } |
264 | if (any_defined_line) | 264 | if (any_defined_line) |
265 | { | 265 | { |
266 | #ifdef HAVE_LCD_BITMAP | 266 | #ifdef HAVE_LCD_BITMAP |
267 | wps_display_images(); | 267 | wps_display_images(); |
268 | #endif | 268 | #endif |
269 | lcd_update(); | 269 | lcd_update(); |
270 | sleep(HZ/2); | 270 | sleep(HZ/2); |
271 | } | 271 | } |
@@ -285,7 +285,7 @@ bool wps_load(const char* file, bool display) | |||
285 | * buf_size - size of buffer. | 285 | * buf_size - size of buffer. |
286 | * time - time to format, in milliseconds. | 286 | * time - time to format, in milliseconds. |
287 | */ | 287 | */ |
288 | static void format_time(char* buf, int buf_size, long time) | 288 | void wps_format_time(char* buf, int buf_size, long time) |
289 | { | 289 | { |
290 | if ( time < 3600000 ) { | 290 | if ( time < 3600000 ) { |
291 | snprintf(buf, buf_size, "%d:%02d", | 291 | snprintf(buf, buf_size, "%d:%02d", |
@@ -544,18 +544,19 @@ static char* get_tag(struct mp3entry* cid3, | |||
544 | 544 | ||
545 | case 'c': /* Current Time in Song */ | 545 | case 'c': /* Current Time in Song */ |
546 | *flags |= WPS_REFRESH_DYNAMIC; | 546 | *flags |= WPS_REFRESH_DYNAMIC; |
547 | format_time(buf, buf_size, id3->elapsed + ff_rewind_count); | 547 | wps_format_time(buf, buf_size, |
548 | id3->elapsed + ff_rewind_count); | ||
548 | return buf; | 549 | return buf; |
549 | 550 | ||
550 | case 'r': /* Remaining Time in Song */ | 551 | case 'r': /* Remaining Time in Song */ |
551 | *flags |= WPS_REFRESH_DYNAMIC; | 552 | *flags |= WPS_REFRESH_DYNAMIC; |
552 | format_time(buf, buf_size, | 553 | wps_format_time(buf, buf_size, |
553 | id3->length - id3->elapsed - ff_rewind_count); | 554 | id3->length - id3->elapsed - ff_rewind_count); |
554 | return buf; | 555 | return buf; |
555 | 556 | ||
556 | case 't': /* Total Time */ | 557 | case 't': /* Total Time */ |
557 | *flags |= WPS_REFRESH_STATIC; | 558 | *flags |= WPS_REFRESH_STATIC; |
558 | format_time(buf, buf_size, id3->length); | 559 | wps_format_time(buf, buf_size, id3->length); |
559 | return buf; | 560 | return buf; |
560 | 561 | ||
561 | #ifdef HAVE_LCD_BITMAP | 562 | #ifdef HAVE_LCD_BITMAP |
@@ -767,7 +768,7 @@ static void format_display(char* buf, | |||
767 | char* value = NULL; | 768 | char* value = NULL; |
768 | int level = 0; | 769 | int level = 0; |
769 | unsigned char tag_length; | 770 | unsigned char tag_length; |
770 | 771 | ||
771 | /* needed for images (ifdef is to kill a warning on player)*/ | 772 | /* needed for images (ifdef is to kill a warning on player)*/ |
772 | int n; | 773 | int n; |
773 | #ifdef HAVE_LCD_BITMAP | 774 | #ifdef HAVE_LCD_BITMAP |
@@ -823,7 +824,7 @@ static void format_display(char* buf, | |||
823 | temp_buf[pos - ptr] = 0; | 824 | temp_buf[pos - ptr] = 0; |
824 | n = atoi(temp_buf); | 825 | n = atoi(temp_buf); |
825 | ptr = pos+1; | 826 | ptr = pos+1; |
826 | 827 | ||
827 | /* check image number, and load state. */ | 828 | /* check image number, and load state. */ |
828 | if ((n < MAX_IMAGES) && (!img[n].loaded)) { | 829 | if ((n < MAX_IMAGES) && (!img[n].loaded)) { |
829 | /* Get filename */ | 830 | /* Get filename */ |
@@ -862,7 +863,7 @@ static void format_display(char* buf, | |||
862 | else | 863 | else |
863 | /* weird syntax, get out */ | 864 | /* weird syntax, get out */ |
864 | break; | 865 | break; |
865 | 866 | ||
866 | /* and load the image */ | 867 | /* and load the image */ |
867 | ret = read_bmp_file(imgname, &img[n].w, &img[n].h, img_buf_ptr, | 868 | ret = read_bmp_file(imgname, &img[n].w, &img[n].h, img_buf_ptr, |
868 | img_buf_free); | 869 | img_buf_free); |
@@ -887,7 +888,7 @@ static void format_display(char* buf, | |||
887 | } | 888 | } |
888 | fmt++; | 889 | fmt++; |
889 | break; | 890 | break; |
890 | 891 | ||
891 | 892 | ||
892 | case '%': | 893 | case '%': |
893 | case '|': | 894 | case '|': |
@@ -1068,7 +1069,7 @@ bool wps_refresh(struct mp3entry* id3, | |||
1068 | #ifdef HAVE_LCD_BITMAP | 1069 | #ifdef HAVE_LCD_BITMAP |
1069 | /* progress */ | 1070 | /* progress */ |
1070 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) { | 1071 | if (flags & refresh_mode & WPS_REFRESH_PLAYER_PROGRESS) { |
1071 | scrollbar(0, i*h + offset + 1, LCD_WIDTH, 6, | 1072 | scrollbar(0, i*h + offset + (h > 7 ? (h - 6) / 2 : 1), LCD_WIDTH, 6, |
1072 | id3->length?id3->length:1, 0, | 1073 | id3->length?id3->length:1, 0, |
1073 | id3->length?id3->elapsed + ff_rewind_count:0, | 1074 | id3->length?id3->elapsed + ff_rewind_count:0, |
1074 | HORIZONTAL); | 1075 | HORIZONTAL); |
@@ -1197,7 +1198,7 @@ bool wps_display(struct mp3entry* id3, | |||
1197 | yield(); | 1198 | yield(); |
1198 | wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL); | 1199 | wps_refresh(id3, nid3, 0, WPS_REFRESH_ALL); |
1199 | status_draw(true); | 1200 | status_draw(true); |
1200 | #ifdef HAVE_LCD_BITMAP | 1201 | #ifdef HAVE_LCD_BITMAP |
1201 | wps_display_images(); | 1202 | wps_display_images(); |
1202 | #endif | 1203 | #endif |
1203 | lcd_update(); | 1204 | lcd_update(); |
@@ -1284,7 +1285,7 @@ static void draw_player_fullbar(char* buf, int buf_size, | |||
1284 | time=(id3->elapsed + ff_rewind_count); | 1285 | time=(id3->elapsed + ff_rewind_count); |
1285 | 1286 | ||
1286 | memset(timestr, 0, sizeof(timestr)); | 1287 | memset(timestr, 0, sizeof(timestr)); |
1287 | format_time(timestr, sizeof(timestr), time); | 1288 | wps_format_time(timestr, sizeof(timestr), time); |
1288 | for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) { | 1289 | for(lcd_char_pos=0; lcd_char_pos<6; lcd_char_pos++) { |
1289 | digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]); | 1290 | digits[lcd_char_pos] = map_fullbar_char(timestr[lcd_char_pos]); |
1290 | } | 1291 | } |