summaryrefslogtreecommitdiff
path: root/apps/plugins/codecflac.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-06-09 09:47:04 +0000
committerDave Chapman <dave@dchapman.com>2005-06-09 09:47:04 +0000
commit7c54b3ad4b10cd58573a180a8bff5166c36e5580 (patch)
tree3e179637336ebe75bda55a351a4c2b12f4e2d1c2 /apps/plugins/codecflac.c
parent6271b2b9104e060f8e25c780f3cbb010cbcba827 (diff)
downloadrockbox-7c54b3ad4b10cd58573a180a8bff5166c36e5580.zip
rockbox-7c54b3ad4b10cd58573a180a8bff5166c36e5580.tar.gz
rockbox-7c54b3ad4b10cd58573a180a8bff5166c36e5580.tar.bz2
rockbox-7c54b3ad4b10cd58573a180a8bff5166c36e5580.tar.xz
Keep track of elapsed time during FLAC playback
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6637 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/codecflac.c')
-rw-r--r--apps/plugins/codecflac.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/plugins/codecflac.c b/apps/plugins/codecflac.c
index d7159df..57089ee 100644
--- a/apps/plugins/codecflac.c
+++ b/apps/plugins/codecflac.c
@@ -27,6 +27,7 @@
#define FLAC_MAX_SUPPORTED_CHANNELS 2
static struct plugin_api* rb;
+static uint32_t samplesdone;
/* Called when the FLAC decoder needs some FLAC data to decode */
FLAC__SeekableStreamDecoderReadStatus flac_read_handler(const FLAC__SeekableStreamDecoder *dec,
@@ -72,6 +73,9 @@ FLAC__StreamDecoderWriteStatus flac_write_handler(const FLAC__SeekableStreamDeco
}
}
+ samplesdone+=samples;
+ ci->set_elapsed(samplesdone/(ci->id3->frequency/1000));
+
while (!ci->audiobuffer_insert(pcmbuf, data_size))
rb->yield();
@@ -203,6 +207,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parm)
/* The first thing to do is to parse the metadata */
FLAC__seekable_stream_decoder_process_until_end_of_metadata(flacDecoder);
+ samplesdone=0;
+ ci->set_elapsed(0);
/* The main decoder loop */
while (FLAC__seekable_stream_decoder_get_state(flacDecoder)!=FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) {
rb->yield();