From c9e23f4e29f08fc53b2306311fa70b1cf4b78b0c Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Sun, 1 Feb 2009 13:35:50 +0100 Subject: mp3 playback support Now libfaad and/or libmad are used for playback. There's currently no remaining time displayed for mp3 playback. --- src/player.h | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'src/player.h') diff --git a/src/player.h b/src/player.h index 7756d0a..eab03a9 100644 --- a/src/player.h +++ b/src/player.h @@ -24,37 +24,68 @@ THE SOFTWARE. #ifndef _PLAYER_H #define _PLAYER_H +#include "config.h" + #include + +#ifdef ENABLE_FAAD #include +#endif + +#ifdef ENABLE_MAD +#include +#endif + #include #include +#include -struct aacPlayer { +struct audioPlayer { /* buffer; should be large enough */ - char buffer[CURL_MAX_WRITE_SIZE*2]; + unsigned char buffer[CURL_MAX_WRITE_SIZE*2]; size_t bufferFilled; size_t bufferRead; + size_t bytesReceived; + enum {PLAYER_FREED = 0, PLAYER_INITIALIZED, PLAYER_FOUND_ESDS, PLAYER_AUDIO_INITIALIZED, PLAYER_FOUND_STSZ, PLAYER_SAMPLESIZE_INITIALIZED, PLAYER_RECV_DATA, PLAYER_FINISHED_PLAYBACK} mode; - size_t bytesReceived; - /* stsz atom: sample sizes */ - unsigned int *sampleSize; + + PianoAudioFormat_t audioFormat; + size_t sampleSizeN; size_t sampleSizeCurr; + /* aac */ + #ifdef ENABLE_FAAD NeAACDecHandle aacHandle; + /* stsz atom: sample sizes */ + unsigned int *sampleSize; + #endif + + /* mp3 */ + #ifdef ENABLE_MAD + struct mad_stream mp3Stream; + struct mad_frame mp3Frame; + struct mad_synth mp3Synth; + mad_timer_t mp3Timer; + #endif + unsigned long samplerate; unsigned char channels; + float gain; - float scale; + unsigned int scale; + /* audio out */ ao_device *audioOutDevice; + + CURL *audioFd; char *url; + char doQuit; pthread_mutex_t pauseMutex; - CURL *audioFd; }; void *BarPlayerThread (void *data); -- cgit v1.2.3