From a2aee035072a5d346c187a890539f72c6d5167a0 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Thu, 5 Feb 2009 18:35:21 +0100 Subject: Time display for mp3 playback Time is now counted in milliseconds, not aac frames. Calculations seem to be inaccurate sometimes (about +-2 seconds). --- src/player.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/player.h') diff --git a/src/player.h b/src/player.h index eab03a9..ec77f16 100644 --- a/src/player.h +++ b/src/player.h @@ -40,6 +40,8 @@ THE SOFTWARE. #include #include +#define BAR_PLAYER_MS_TO_S_FACTOR 1000 + struct audioPlayer { /* buffer; should be large enough */ unsigned char buffer[CURL_MAX_WRITE_SIZE*2]; @@ -54,14 +56,17 @@ struct audioPlayer { PianoAudioFormat_t audioFormat; - size_t sampleSizeN; - size_t sampleSizeCurr; + /* duration and already played time; measured in milliseconds */ + unsigned long int songDuration; + unsigned long int songPlayed; /* aac */ #ifdef ENABLE_FAAD NeAACDecHandle aacHandle; /* stsz atom: sample sizes */ unsigned int *sampleSize; + size_t sampleSizeN; + size_t sampleSizeCurr; #endif /* mp3 */ @@ -69,7 +74,6 @@ struct audioPlayer { struct mad_stream mp3Stream; struct mad_frame mp3Frame; struct mad_synth mp3Synth; - mad_timer_t mp3Timer; #endif unsigned long samplerate; -- cgit v1.2.3