diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/codecflac.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/plugins/codecflac.c b/apps/plugins/codecflac.c index d7159df835..57089ee9a3 100644 --- a/apps/plugins/codecflac.c +++ b/apps/plugins/codecflac.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #define FLAC_MAX_SUPPORTED_CHANNELS 2 | 27 | #define FLAC_MAX_SUPPORTED_CHANNELS 2 |
28 | 28 | ||
29 | static struct plugin_api* rb; | 29 | static struct plugin_api* rb; |
30 | static uint32_t samplesdone; | ||
30 | 31 | ||
31 | /* Called when the FLAC decoder needs some FLAC data to decode */ | 32 | /* Called when the FLAC decoder needs some FLAC data to decode */ |
32 | FLAC__SeekableStreamDecoderReadStatus flac_read_handler(const FLAC__SeekableStreamDecoder *dec, | 33 | FLAC__SeekableStreamDecoderReadStatus flac_read_handler(const FLAC__SeekableStreamDecoder *dec, |
@@ -72,6 +73,9 @@ FLAC__StreamDecoderWriteStatus flac_write_handler(const FLAC__SeekableStreamDeco | |||
72 | } | 73 | } |
73 | } | 74 | } |
74 | 75 | ||
76 | samplesdone+=samples; | ||
77 | ci->set_elapsed(samplesdone/(ci->id3->frequency/1000)); | ||
78 | |||
75 | while (!ci->audiobuffer_insert(pcmbuf, data_size)) | 79 | while (!ci->audiobuffer_insert(pcmbuf, data_size)) |
76 | rb->yield(); | 80 | rb->yield(); |
77 | 81 | ||
@@ -203,6 +207,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parm) | |||
203 | /* The first thing to do is to parse the metadata */ | 207 | /* The first thing to do is to parse the metadata */ |
204 | FLAC__seekable_stream_decoder_process_until_end_of_metadata(flacDecoder); | 208 | FLAC__seekable_stream_decoder_process_until_end_of_metadata(flacDecoder); |
205 | 209 | ||
210 | samplesdone=0; | ||
211 | ci->set_elapsed(0); | ||
206 | /* The main decoder loop */ | 212 | /* The main decoder loop */ |
207 | while (FLAC__seekable_stream_decoder_get_state(flacDecoder)!=FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) { | 213 | while (FLAC__seekable_stream_decoder_get_state(flacDecoder)!=FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM) { |
208 | rb->yield(); | 214 | rb->yield(); |