summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libwaitress/waitress.h21
-rw-r--r--src/player.h38
-rw-r--r--src/settings.h2
-rw-r--r--src/ui_dispatch.h61
4 files changed, 64 insertions, 58 deletions
diff --git a/src/libwaitress/waitress.h b/src/libwaitress/waitress.h
index b988591..f91985d 100644
--- a/src/libwaitress/waitress.h
+++ b/src/libwaitress/waitress.h
@@ -83,30 +83,37 @@ typedef enum {
/* reusable handle
*/
typedef struct {
- WaitressUrl_t url;
+ int timeout;
WaitressMethod_t method;
+
const char *extraHeaders;
const char *postData;
- WaitressUrl_t proxy;
/* extra data handed over to callback function */
void *data;
WaitressCbReturn_t (*callback) (void *, size_t, void *);
- int timeout;
const char *tlsFingerprint;
+
+ WaitressUrl_t url;
+ WaitressUrl_t proxy;
+
gnutls_certificate_credentials_t tlsCred;
/* per-request data */
struct {
- size_t contentLength, contentReceived, chunkSize;
int sockfd;
+
+ /* temporary return value storage */
+ WaitressReturn_t readWriteRet;
+
+ size_t contentLength, contentReceived, chunkSize;
+
char *buf;
- gnutls_session_t tlsSession;
/* first argument is WaitressHandle_t, but that's not defined yet */
WaitressHandlerReturn_t (*dataHandler) (void *, char *, const size_t);
WaitressReturn_t (*read) (void *, char *, const size_t, size_t *);
WaitressReturn_t (*write) (void *, const char *, const size_t);
- /* temporary return value storage */
- WaitressReturn_t readWriteRet;
+
+ gnutls_session_t tlsSession;
} request;
} WaitressHandle_t;
diff --git a/src/player.h b/src/player.h
index 248519f..070ac0f 100644
--- a/src/player.h
+++ b/src/player.h
@@ -47,11 +47,9 @@ THE SOFTWARE.
#define BAR_PLAYER_MS_TO_S_FACTOR 1000
struct audioPlayer {
- /* buffer; should be large enough */
- unsigned char buffer[WAITRESS_BUFFER_SIZE*2];
- size_t bufferFilled;
- size_t bufferRead;
- size_t bytesReceived;
+ char doQuit;
+ unsigned char channels;
+ unsigned char aoError;
enum {
PLAYER_FREED = 0, /* thread is not running */
@@ -64,20 +62,28 @@ struct audioPlayer {
PLAYER_RECV_DATA, /* playing track */
PLAYER_FINISHED_PLAYBACK
} mode;
-
PianoAudioFormat_t audioFormat;
+ unsigned int scale;
+ float gain;
+
/* duration and already played time; measured in milliseconds */
unsigned long int songDuration;
unsigned long int songPlayed;
+ unsigned long samplerate;
+
+ size_t bufferFilled;
+ size_t bufferRead;
+ size_t bytesReceived;
+
/* aac */
#ifdef ENABLE_FAAD
- NeAACDecHandle aacHandle;
/* stsz atom: sample sizes */
- unsigned int *sampleSize;
size_t sampleSizeN;
size_t sampleSizeCurr;
+ unsigned int *sampleSize;
+ NeAACDecHandle aacHandle;
#endif
/* mp3 */
@@ -87,22 +93,14 @@ struct audioPlayer {
struct mad_synth mp3Synth;
#endif
- unsigned long samplerate;
- unsigned char channels;
-
- float gain;
- unsigned int scale;
-
/* audio out */
ao_device *audioOutDevice;
- unsigned char aoError;
-
- WaitressHandle_t waith;
+ const BarSettings_t *settings;
- char doQuit;
pthread_mutex_t pauseMutex;
-
- const BarSettings_t *settings;
+ WaitressHandle_t waith;
+ /* buffer; should be large enough */
+ unsigned char buffer[WAITRESS_BUFFER_SIZE*2];
};
enum {PLAYER_RET_OK = 0, PLAYER_RET_ERR = 1};
diff --git a/src/settings.h b/src/settings.h
index 8ce1225..b975b23 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -86,7 +86,6 @@ typedef struct {
char *password;
char *controlProxy; /* non-american listeners need this */
char *proxy;
- char keys[BAR_KS_COUNT];
char *autostartStation;
char *eventCmd;
char *loveIcon;
@@ -97,6 +96,7 @@ typedef struct {
char *listSongFormat;
char *fifo;
char tlsFingerprint[20];
+ char keys[BAR_KS_COUNT];
BarMsgFormatStr_t msgFormat[MSG_COUNT];
} BarSettings_t;
diff --git a/src/ui_dispatch.h b/src/ui_dispatch.h
index 4a5f791..e8c9944 100644
--- a/src/ui_dispatch.h
+++ b/src/ui_dispatch.h
@@ -39,10 +39,10 @@ typedef void (*BarKeyShortcutFunc_t) (BarApp_t *, PianoStation_t *,
PianoSong_t *, BarUiDispatchContext_t);
typedef struct {
+ char defaultKey;
BarUiDispatchContext_t context;
BarKeyShortcutFunc_t function;
const char * const helpText;
- char defaultKey;
const char * const configKey;
} BarUiDispatchAction_t;
@@ -50,49 +50,50 @@ typedef struct {
/* see settings.h */
static const BarUiDispatchAction_t dispatchActions[BAR_KS_COUNT] = {
- {BAR_DC_UNDEFINED, BarUiActHelp, NULL, '?', "act_help"},
- {BAR_DC_SONG, BarUiActLoveSong, "love song", '+',
+ {'?', BAR_DC_UNDEFINED, BarUiActHelp, NULL, "act_help"},
+ {'+', BAR_DC_SONG, BarUiActLoveSong, "love song",
"act_songlove"},
- {BAR_DC_SONG, BarUiActBanSong, "ban song", '-', "act_songban"},
- {BAR_DC_STATION, BarUiActAddMusic, "add music to station", 'a',
+ {'-', BAR_DC_SONG, BarUiActBanSong, "ban song", "act_songban"},
+ {'a', BAR_DC_STATION, BarUiActAddMusic, "add music to station",
"act_stationaddmusic"},
- {BAR_DC_GLOBAL, BarUiActCreateStation, "create new station", 'c',
+ {'c', BAR_DC_GLOBAL, BarUiActCreateStation, "create new station",
"act_stationcreate"},
- {BAR_DC_STATION, BarUiActDeleteStation, "delete station", 'd',
+ {'d', BAR_DC_STATION, BarUiActDeleteStation, "delete station",
"act_stationdelete"},
- {BAR_DC_SONG, BarUiActExplain, "explain why this song is played", 'e',
+ {'e', BAR_DC_SONG, BarUiActExplain, "explain why this song is played",
"act_songexplain"},
- {BAR_DC_GLOBAL, BarUiActStationFromGenre, "add genre station", 'g',
+ {'g', BAR_DC_GLOBAL, BarUiActStationFromGenre, "add genre station",
"act_stationaddbygenre"},
- {BAR_DC_GLOBAL, BarUiActHistory, "song history", 'h', "act_history"},
- {BAR_DC_GLOBAL | BAR_DC_STATION | BAR_DC_SONG, BarUiActSongInfo,
- "print information about song/station", 'i',
- "act_songinfo"},
- {BAR_DC_GLOBAL, BarUiActAddSharedStation, "add shared station", 'j',
+ {'h', BAR_DC_GLOBAL, BarUiActHistory, "song history", "act_history"},
+ {'i', BAR_DC_GLOBAL | BAR_DC_STATION | BAR_DC_SONG, BarUiActSongInfo,
+ "print information about song/station", "act_songinfo"},
+ {'j', BAR_DC_GLOBAL, BarUiActAddSharedStation, "add shared station",
"act_addshared"},
- {BAR_DC_SONG, BarUiActMoveSong, "move song to different station", 'm',
+ {'m', BAR_DC_SONG, BarUiActMoveSong, "move song to different station",
"act_songmove"},
- {BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActSkipSong, "next song", 'n', "act_songnext"},
- {BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPause, "pause/continue", 'p', "act_songpause"},
- {BAR_DC_GLOBAL, BarUiActQuit, "quit", 'q', "act_quit"},
- {BAR_DC_STATION, BarUiActRenameStation, "rename station", 'r',
+ {'n', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActSkipSong, "next song",
+ "act_songnext"},
+ {'p', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPause, "pause/continue",
+ "act_songpause"},
+ {'q', BAR_DC_GLOBAL, BarUiActQuit, "quit", "act_quit"},
+ {'r', BAR_DC_STATION, BarUiActRenameStation, "rename station",
"act_stationrename"},
- {BAR_DC_GLOBAL, BarUiActSelectStation, "change station", 's',
+ {'s', BAR_DC_GLOBAL, BarUiActSelectStation, "change station",
"act_stationchange"},
- {BAR_DC_SONG, BarUiActTempBanSong, "tired (ban song for 1 month)", 't',
+ {'t', BAR_DC_SONG, BarUiActTempBanSong, "tired (ban song for 1 month)",
"act_songtired"},
- {BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPrintUpcoming, "upcoming songs", 'u',
- "act_upcoming"},
- {BAR_DC_STATION, BarUiActSelectQuickMix, "select quickmix stations",
- 'x', "act_stationselectquickmix"},
- {BAR_DC_GLOBAL, BarUiActDebug, NULL, '$', "act_debug"},
- {BAR_DC_SONG, BarUiActBookmark, "bookmark song/artist", 'b',
+ {'u', BAR_DC_GLOBAL | BAR_DC_STATION, BarUiActPrintUpcoming,
+ "upcoming songs", "act_upcoming"},
+ {'x', BAR_DC_STATION, BarUiActSelectQuickMix, "select quickmix stations",
+ "act_stationselectquickmix"},
+ {'$', BAR_DC_GLOBAL, BarUiActDebug, NULL, "act_debug"},
+ {'b', BAR_DC_SONG, BarUiActBookmark, "bookmark song/artist",
"act_bookmark"},
- {BAR_DC_GLOBAL, BarUiActVolDown, "decrease volume", '(',
+ {'(', BAR_DC_GLOBAL, BarUiActVolDown, "decrease volume",
"act_voldown"},
- {BAR_DC_GLOBAL, BarUiActVolUp, "increase volume", ')',
+ {')', BAR_DC_GLOBAL, BarUiActVolUp, "increase volume",
"act_volup"},
- {BAR_DC_STATION, BarUiActManageStation, "delete seeds/feedback", '=',
+ {'=', BAR_DC_STATION, BarUiActManageStation, "delete seeds/feedback",
"act_managestation"},
};