First crude elapsed-time display
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1237 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e56fa6dc84
commit
930880fb80
3 changed files with 18 additions and 7 deletions
20
apps/wps.c
20
apps/wps.c
|
@ -95,11 +95,6 @@ static void draw_screen(struct mp3entry* id3)
|
|||
lcd_puts(0, l++, id3->album?id3->album:"");
|
||||
lcd_puts(0, l++, id3->artist?id3->artist:"");
|
||||
|
||||
snprintf(buffer,sizeof(buffer), "Time: %d:%02d",
|
||||
id3->length / 60000,
|
||||
id3->length % 60000 / 1000 );
|
||||
lcd_puts(0, l++, buffer);
|
||||
|
||||
snprintf(buffer,sizeof(buffer), "%d kbits", id3->bitrate);
|
||||
|
||||
lcd_puts(0, l++, buffer);
|
||||
|
@ -124,6 +119,7 @@ void wps_show(void)
|
|||
struct mp3entry* id3 = mpeg_current_track();
|
||||
int lastlength=0, lastsize=0, lastrate=0;
|
||||
int lastartist=0, lastalbum=0, lasttitle=0;
|
||||
char buffer[32];
|
||||
|
||||
while ( 1 ) {
|
||||
int i;
|
||||
|
@ -144,7 +140,17 @@ void wps_show(void)
|
|||
lasttitle = id3->title[0];
|
||||
}
|
||||
|
||||
for ( i=0;i<20;i++ ) {
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
snprintf(buffer,sizeof(buffer), "Time: %d:%02d / %d:%02d",
|
||||
id3->elapsed / 60000,
|
||||
id3->elapsed % 60000 / 1000,
|
||||
id3->length / 60000,
|
||||
id3->length % 60000 / 1000 );
|
||||
lcd_puts(0, 6, buffer);
|
||||
lcd_update();
|
||||
#endif
|
||||
|
||||
for ( i=0;i<5;i++ ) {
|
||||
switch ( button_get(false) ) {
|
||||
case BUTTON_ON:
|
||||
return;
|
||||
|
@ -194,7 +200,7 @@ void wps_show(void)
|
|||
mpeg_stop();
|
||||
break;
|
||||
}
|
||||
sleep(HZ/20);
|
||||
sleep(HZ/10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ struct mp3entry {
|
|||
int id3v1len;
|
||||
int filesize; /* in bytes */
|
||||
int length; /* song length */
|
||||
int elapsed; /* ms played */
|
||||
|
||||
/* these following two fields are used for local buffering */
|
||||
char id3v2buf[300];
|
||||
|
|
|
@ -150,6 +150,7 @@ static struct {
|
|||
int mempos;
|
||||
} id3tags[MAX_ID3_TAGS];
|
||||
static int last_tag = 0;
|
||||
static int last_dma_tick = 0;
|
||||
|
||||
static void create_fliptable(void)
|
||||
{
|
||||
|
@ -228,6 +229,8 @@ static void dma_tick(void)
|
|||
start_dma();
|
||||
}
|
||||
}
|
||||
id3tags[0].id3.elapsed += (current_tick - last_dma_tick) * 1000 / HZ;
|
||||
last_dma_tick = current_tick;
|
||||
}
|
||||
|
||||
static void bitswap(unsigned short *data, int length)
|
||||
|
@ -387,6 +390,7 @@ static void mpeg_thread(void)
|
|||
mp3info(&(id3tags[0].id3), ev.data);
|
||||
id3tags[0].mempos = mp3buf_write;
|
||||
last_tag=1;
|
||||
id3tags[0].id3.elapsed = 0;
|
||||
|
||||
/* Make it read more data */
|
||||
filling = true;
|
||||
|
|
Loading…
Reference in a new issue