diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-02-05 18:35:21 +0100 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2009-02-05 18:35:21 +0100 |
commit | a2aee035072a5d346c187a890539f72c6d5167a0 (patch) | |
tree | 50e595a0941e223191784966312097995c985ca8 /src/player.h | |
parent | 9bf820b044e846bb2b17dfb2b78a1d9a8d3c59f1 (diff) | |
download | pianobar-a2aee035072a5d346c187a890539f72c6d5167a0.tar.gz pianobar-a2aee035072a5d346c187a890539f72c6d5167a0.tar.bz2 pianobar-a2aee035072a5d346c187a890539f72c6d5167a0.zip |
Time display for mp3 playback
Time is now counted in milliseconds, not aac frames. Calculations seem
to be inaccurate sometimes (about +-2 seconds).
Diffstat (limited to 'src/player.h')
-rw-r--r-- | src/player.h | 10 |
1 files changed, 7 insertions, 3 deletions
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 <pthread.h> #include <piano.h> +#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; |