diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2014-07-21 17:17:03 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2014-07-21 17:17:03 +0200 |
commit | d16d6eb53869e8380ccfbe7dbc2c09d98c40ab6c (patch) | |
tree | f7bb0a9b5b1ff9a99082e69aa5ecf9d171acc274 /src/player.h | |
parent | 8172003638eb2e5bb38e9a98be0f86a0c6e1cf1f (diff) | |
download | pianobar-d16d6eb53869e8380ccfbe7dbc2c09d98c40ab6c.tar.gz pianobar-d16d6eb53869e8380ccfbe7dbc2c09d98c40ab6c.tar.bz2 pianobar-d16d6eb53869e8380ccfbe7dbc2c09d98c40ab6c.zip |
Refactor audio player, add retry timeout
Fixes #442.
Diffstat (limited to 'src/player.h')
-rw-r--r-- | src/player.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/player.h b/src/player.h index 2c89c93..eb06d64 100644 --- a/src/player.h +++ b/src/player.h @@ -31,14 +31,17 @@ THE SOFTWARE. #include <pthread.h> #include <stdint.h> +#include <ao/ao.h> +#include <libavformat/avformat.h> #include <libavfilter/avfilter.h> #include <libavfilter/avfiltergraph.h> #include <piano.h> #include <waitress.h> #include "settings.h" +#include "config.h" -struct audioPlayer { +typedef struct { /* protected by pauseMutex */ volatile bool doQuit; volatile bool doPause; @@ -52,9 +55,21 @@ struct audioPlayer { PLAYER_FINISHED, } mode; + /* libav */ AVFilterContext *fvolume; AVFilterGraph *fgraph; - + AVFormatContext *fctx; + AVStream *st; + AVFilterContext *fbufsink, *fabuf; + int streamIdx; + int64_t lastTimestamp; +#ifndef HAVE_AV_TIMEOUT + int64_t ping; +#endif + + ao_device *aoDev; + + /* settings */ volatile double volume; double gain; char *url; @@ -63,12 +78,12 @@ struct audioPlayer { /* measured in seconds */ volatile unsigned int songDuration; volatile unsigned int songPlayed; -}; +} player_t; enum {PLAYER_RET_OK = 0, PLAYER_RET_HARDFAIL = 1, PLAYER_RET_SOFTFAIL = 2}; void *BarPlayerThread (void *data); -void BarPlayerSetVolume (struct audioPlayer * const player); +void BarPlayerSetVolume (player_t * const player); void BarPlayerInit (); void BarPlayerDestroy (); |