diff options
-rw-r--r-- | src/main.c | 34 | ||||
-rw-r--r-- | src/player.c | 12 | ||||
-rw-r--r-- | src/player.h | 2 | ||||
-rw-r--r-- | src/settings.c | 6 | ||||
-rw-r--r-- | src/settings.h | 2 | ||||
-rw-r--r-- | src/terminal.c | 4 | ||||
-rw-r--r-- | src/terminal.h | 4 |
7 files changed, 32 insertions, 32 deletions
@@ -43,7 +43,7 @@ THE SOFTWARE. * @param piano handle * @return pointer to selected station */ -PianoStation_t *selectStation (PianoHandle_t *ph) { +PianoStation_t *BarUiSelectStation (PianoHandle_t *ph) { PianoStation_t *curStation = NULL; size_t i; @@ -71,7 +71,7 @@ PianoStation_t *selectStation (PianoHandle_t *ph) { * @param song list * @return pointer to selected item in song list or NULL */ -PianoSong_t *selectSong (PianoSong_t *startSong) { +PianoSong_t *BarUiSelectSong (PianoSong_t *startSong) { PianoSong_t *tmpSong = NULL; size_t i; @@ -98,7 +98,7 @@ PianoSong_t *selectSong (PianoSong_t *startSong) { * @param artists (linked list) * @return pointer to selected artist or NULL on abort */ -PianoArtist_t *selectArtist (PianoArtist_t *startArtist) { +PianoArtist_t *BarUiSelectArtist (PianoArtist_t *startArtist) { PianoArtist_t *tmpArtist = NULL; size_t i; @@ -125,7 +125,7 @@ PianoArtist_t *selectArtist (PianoArtist_t *startArtist) { * @param piano handle * @return musicId or NULL on abort/error */ -char *selectMusicId (PianoHandle_t *ph) { +char *BarUiSelectMusicId (PianoHandle_t *ph) { char *musicId = NULL, *lineBuf; char yesnoBuf; PianoSearchResult_t searchResult; @@ -139,25 +139,25 @@ char *selectMusicId (PianoHandle_t *ph) { printf ("Is this an [a]rtist or [t]rack name? Press c to abort.\n"); read (fileno (stdin), &yesnoBuf, sizeof (yesnoBuf)); if (yesnoBuf == 'a') { - tmpArtist = selectArtist (searchResult.artists); + tmpArtist = BarUiSelectArtist (searchResult.artists); if (tmpArtist != NULL) { musicId = strdup (tmpArtist->musicId); } } else if (yesnoBuf == 't') { - tmpSong = selectSong (searchResult.songs); + tmpSong = BarUiSelectSong (searchResult.songs); if (tmpSong != NULL) { musicId = strdup (tmpSong->musicId); } } } else if (searchResult.songs != NULL) { printf ("Select song\n"); - tmpSong = selectSong (searchResult.songs); + tmpSong = BarUiSelectSong (searchResult.songs); if (tmpSong != NULL) { musicId = strdup (tmpSong->musicId); } } else if (searchResult.artists != NULL) { printf ("Select artist\n"); - tmpArtist = selectArtist (searchResult.artists); + tmpArtist = BarUiSelectArtist (searchResult.artists); if (tmpArtist != NULL) { musicId = strdup (tmpArtist->musicId); } @@ -198,15 +198,15 @@ int main (int argc, char **argv) { ao_initialize(); BarSettingsInit (&bsettings); - readSettings (&bsettings); + BarSettingsRead (&bsettings); if (bsettings.username == NULL) { bsettings.username = readline ("Username: "); } if (bsettings.password == NULL) { - termSetEcho (0); + BarTermSetEcho (0); bsettings.password = readline ("Password: "); - termSetEcho (1); + BarTermSetEcho (1); } PianoInit (&ph); @@ -227,7 +227,7 @@ int main (int argc, char **argv) { } curl_easy_setopt (ph.curlHandle, CURLOPT_CONNECTTIMEOUT, 60); - termSetBuffer (0); + BarTermSetBuffer (0); printf ("Login...\n"); if (PianoConnect (&ph, bsettings.username, bsettings.password) != @@ -242,7 +242,7 @@ int main (int argc, char **argv) { } /* select station */ - curStation = selectStation (&ph); + curStation = BarUiSelectStation (&ph); if (curStation != NULL) { printf ("Playing station \"%s\"\n", curStation->name); } @@ -310,7 +310,7 @@ int main (int argc, char **argv) { player.url = strdup (curSong->audioUrl); /* start player */ - pthread_create (&playerThread, NULL, threadPlayUrl, + pthread_create (&playerThread, NULL, BarPlayerThread, &player); } } @@ -338,7 +338,7 @@ int main (int argc, char **argv) { break; case 'a': - musicId = selectMusicId (&ph); + musicId = BarUiSelectMusicId (&ph); if (musicId == NULL) { printf ("Aborted.\n"); } else { @@ -368,7 +368,7 @@ int main (int argc, char **argv) { break; case 'c': - musicId = selectMusicId (&ph); + musicId = BarUiSelectMusicId (&ph); if (musicId != NULL) { printf ("Creating station... "); fflush (stdout); @@ -446,7 +446,7 @@ int main (int argc, char **argv) { player.doQuit = 1; PianoDestroyPlaylist (&ph); curSong = NULL; - curStation = selectStation (&ph); + curStation = BarUiSelectStation (&ph); if (curStation != NULL) { printf ("Changed station to %s\n", curStation->name); } diff --git a/src/player.c b/src/player.c index a969245..568d15a 100644 --- a/src/player.c +++ b/src/player.c @@ -30,7 +30,7 @@ THE SOFTWARE. * @param unsigned int * @return byteswapped unsigned int */ -unsigned int changeByteorderUI32 (char buf[4]) { +unsigned int BarChangeByteorderUI32 (char buf[4]) { unsigned int ret = 0; ret = buf[0] << 24 & 0xffffffff; @@ -47,7 +47,7 @@ unsigned int changeByteorderUI32 (char buf[4]) { * @param extra data (player data) * @return received bytes or less on error */ -size_t playCurlCb (void *ptr, size_t size, size_t nmemb, void *stream) { +size_t BarPlayerCurlCb (void *ptr, size_t size, size_t nmemb, void *stream) { char *data = ptr; struct aacPlayer *player = stream; @@ -160,7 +160,7 @@ size_t playCurlCb (void *ptr, size_t size, size_t nmemb, void *stream) { if (player->sampleSizeN == 0) { /* mp4 uses big endian, convert */ player->sampleSizeN = - changeByteorderUI32 (player->buffer + + BarChangeByteorderUI32 (player->buffer + player->bufferRead); player->sampleSize = calloc (player->sampleSizeN, sizeof (player->sampleSizeN)); @@ -169,7 +169,7 @@ size_t playCurlCb (void *ptr, size_t size, size_t nmemb, void *stream) { break; } else { player->sampleSize[player->sampleSizeCurr] = - changeByteorderUI32 (player->buffer + + BarChangeByteorderUI32 (player->buffer + player->bufferRead); player->sampleSizeCurr++; player->bufferRead += 4; @@ -209,7 +209,7 @@ size_t playCurlCb (void *ptr, size_t size, size_t nmemb, void *stream) { * @param aacPlayer structure * @return NULL NULL NULL ... */ -void *threadPlayUrl (void *data) { +void *BarPlayerThread (void *data) { struct aacPlayer *player = data; NeAACDecConfigurationPtr conf; @@ -222,7 +222,7 @@ void *threadPlayUrl (void *data) { NeAACDecSetConfiguration(player->aacHandle, conf); curl_easy_setopt (player->audioFd, CURLOPT_URL, player->url); - curl_easy_setopt (player->audioFd, CURLOPT_WRITEFUNCTION, playCurlCb); + curl_easy_setopt (player->audioFd, CURLOPT_WRITEFUNCTION, BarPlayerCurlCb); curl_easy_setopt (player->audioFd, CURLOPT_WRITEDATA, player); curl_easy_setopt (player->audioFd, CURLOPT_USERAGENT, PACKAGE_STRING); curl_easy_perform (player->audioFd); diff --git a/src/player.h b/src/player.h index 04275a9..89f99f8 100644 --- a/src/player.h +++ b/src/player.h @@ -48,5 +48,5 @@ struct aacPlayer { CURL *audioFd; }; -void *threadPlayUrl (void *data); +void *BarPlayerThread (void *data); diff --git a/src/settings.c b/src/settings.c index abdf5b7..91cd851 100644 --- a/src/settings.c +++ b/src/settings.c @@ -34,7 +34,7 @@ THE SOFTWARE. * @param but only up to this size * @return nothing */ -void getXdgConfigDir (char *filename, char *retDir, size_t retDirN) { +void BarGetXdgConfigDir (char *filename, char *retDir, size_t retDirN) { char *xdgConfigDir = NULL; if ((xdgConfigDir = getenv ("XDG_CONFIG_HOME")) != NULL && @@ -71,11 +71,11 @@ void BarSettingsDestroy (BarSettings_t *settings) { * @param where to save these settings * @return nothing yet */ -void readSettings (BarSettings_t *settings) { +void BarSettingsRead (BarSettings_t *settings) { char configfile[1024], key[256], val[256]; FILE *configfd; - getXdgConfigDir (PACKAGE "/config", configfile, sizeof (configfile)); + BarGetXdgConfigDir (PACKAGE "/config", configfile, sizeof (configfile)); if ((configfd = fopen (configfile, "r")) == NULL) { printf ("config file at %s not found\n", configfile); return; diff --git a/src/settings.h b/src/settings.h index 71737f2..2a6d8c3 100644 --- a/src/settings.h +++ b/src/settings.h @@ -40,6 +40,6 @@ typedef struct BarSettings BarSettings_t; void BarSettingsInit (BarSettings_t *settings); void BarSettingsDestroy (BarSettings_t *settings); -void readSettings (BarSettings_t *settings); +void BarSettingsRead (BarSettings_t *settings); #endif /* _SETTINGS_H */ diff --git a/src/terminal.c b/src/terminal.c index 1bbface..d29c42f 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -26,7 +26,7 @@ THE SOFTWARE. /* en/disable echoing for stdin * @param 1 = enable, everything else = disable */ -void termSetEcho (char enable) { +void BarTermSetEcho (char enable) { struct termios termopts; tcgetattr (fileno (stdin), &termopts); @@ -42,7 +42,7 @@ void termSetEcho (char enable) { * selected for you * @param 1 = enable, everything else = disable */ -void termSetBuffer (char enable) { +void BarTermSetBuffer (char enable) { struct termios termopts; tcgetattr (fileno (stdin), &termopts); diff --git a/src/terminal.h b/src/terminal.h index 397a5d6..c983ec5 100644 --- a/src/terminal.h +++ b/src/terminal.h @@ -23,7 +23,7 @@ THE SOFTWARE. #ifndef _TERMINAL_H #define _TERMINAL_H -void termSetEcho (char enable); -void termSetBuffer (char enable); +void BarTermSetEcho (char enable); +void BarTermSetBuffer (char enable); #endif /* _TERMINAL_H */ |