summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-06-27 17:20:30 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-06-27 17:20:30 +0000
commit930880fb807e51e83e09ca7424d7b4ea6c3f42b8 (patch)
tree30ec1ac6eb7ff8020367f76600961cc971181845 /firmware
parente56fa6dc84c963207b4dfafb4a9e814aee5ad343 (diff)
First crude elapsed-time display
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1237 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/id3.h1
-rw-r--r--firmware/mpeg.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/firmware/id3.h b/firmware/id3.h
index 4729d5355f..1f8aef6310 100644
--- a/firmware/id3.h
+++ b/firmware/id3.h
@@ -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];
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index d130a8b572..ab99fa744c 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -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;