aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-03 21:49:29 +0100
committerMax Kellermann <max@duempel.org>2008-11-03 21:49:29 +0100
commit862bbc21a1864e766d22dab07ac745c20fcb8f59 (patch)
tree30fd393df4c22ca8817c5e7d7f68216f6a7fd884
parentcfaf85e37de7261201d863ad80e06801d52baab6 (diff)
downloadmpd-862bbc21a1864e766d22dab07ac745c20fcb8f59.tar.gz
mpd-862bbc21a1864e766d22dab07ac745c20fcb8f59.tar.xz
mpd-862bbc21a1864e766d22dab07ac745c20fcb8f59.zip
player: no CamelCase
Renamed variables and internal functions. Most of the player_control.h API remains in CamelCase for now.
Diffstat (limited to '')
-rw-r--r--src/player_control.c20
-rw-r--r--src/player_control.h14
-rw-r--r--src/player_thread.c56
3 files changed, 45 insertions, 45 deletions
diff --git a/src/player_control.c b/src/player_control.c
index 086ef505a..b35a8c5dc 100644
--- a/src/player_control.c
+++ b/src/player_control.c
@@ -34,8 +34,8 @@ void pc_init(unsigned int buffered_before_play)
pc.command = PLAYER_COMMAND_NONE;
pc.error = PLAYER_ERROR_NOERROR;
pc.state = PLAYER_STATE_STOP;
- pc.crossFade = 0;
- pc.softwareVolume = 1000;
+ pc.cross_fade_seconds = 0;
+ pc.software_volume = 1000;
}
void pc_deinit(void)
@@ -112,17 +112,17 @@ void playerSetPause(int pause_flag)
int getPlayerElapsedTime(void)
{
- return (int)(pc.elapsedTime + 0.5);
+ return (int)(pc.elapsed_time + 0.5);
}
unsigned long getPlayerBitRate(void)
{
- return pc.bitRate;
+ return pc.bit_rate;
}
int getPlayerTotalTime(void)
{
- return (int)(pc.totalTime + 0.5);
+ return (int)(pc.total_time + 0.5);
}
enum player_state getPlayerState(void)
@@ -192,7 +192,7 @@ playerSeek(struct song *song, float seek_time)
pc.next_song = song;
if (pc.error == PLAYER_ERROR_NOERROR) {
- pc.seekWhere = seek_time;
+ pc.seek_where = seek_time;
player_command(PLAYER_COMMAND_SEEK);
idle_add(IDLE_PLAYER);
@@ -203,14 +203,14 @@ playerSeek(struct song *song, float seek_time)
float getPlayerCrossFade(void)
{
- return pc.crossFade;
+ return pc.cross_fade_seconds;
}
void setPlayerCrossFade(float crossFadeInSeconds)
{
if (crossFadeInSeconds < 0)
crossFadeInSeconds = 0;
- pc.crossFade = crossFadeInSeconds;
+ pc.cross_fade_seconds = crossFadeInSeconds;
idle_add(IDLE_OPTIONS);
}
@@ -218,12 +218,12 @@ void setPlayerCrossFade(float crossFadeInSeconds)
void setPlayerSoftwareVolume(int volume)
{
volume = (volume > 1000) ? 1000 : (volume < 0 ? 0 : volume);
- pc.softwareVolume = volume;
+ pc.software_volume = volume;
}
double getPlayerTotalPlayTime(void)
{
- return pc.totalPlayTime;
+ return pc.total_play_time;
}
/* this actually creates a dupe of the current metadata */
diff --git a/src/player_control.h b/src/player_control.h
index 8d89bfb2a..2eeb537aa 100644
--- a/src/player_control.h
+++ b/src/player_control.h
@@ -64,16 +64,16 @@ struct player_control {
volatile enum player_command command;
volatile enum player_state state;
volatile int8_t error;
- volatile uint16_t bitRate;
+ volatile uint16_t bit_rate;
struct audio_format audio_format;
- volatile float totalTime;
- volatile float elapsedTime;
+ volatile float total_time;
+ volatile float elapsed_time;
struct song *volatile next_song;
struct song *errored_song;
- volatile double seekWhere;
- volatile float crossFade;
- volatile uint16_t softwareVolume;
- volatile double totalPlayTime;
+ volatile double seek_where;
+ volatile float cross_fade_seconds;
+ volatile uint16_t software_volume;
+ volatile double total_play_time;
};
extern struct player_control pc;
diff --git a/src/player_thread.c b/src/player_thread.c
index 5df189f78..484c8deb7 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -82,14 +82,14 @@ static void player_command_finished(void)
wakeup_main_task();
}
-static void quitDecode(void)
+static void player_stop_decoder(void)
{
dc_stop(&pc.notify);
pc.state = PLAYER_STATE_STOP;
wakeup_main_task();
}
-static int waitOnDecode(struct player *player)
+static int player_wait_for_decoder(struct player *player)
{
dc_command_wait(&pc.notify);
@@ -100,9 +100,9 @@ static int waitOnDecode(struct player *player)
return -1;
}
- pc.totalTime = pc.next_song->tag != NULL
+ pc.total_time = pc.next_song->tag != NULL
? pc.next_song->tag->time : 0;
- pc.bitRate = 0;
+ pc.bit_rate = 0;
audio_format_clear(&pc.audio_format);
player->song = pc.next_song;
@@ -113,7 +113,7 @@ static int waitOnDecode(struct player *player)
return 0;
}
-static bool decodeSeek(struct player *player)
+static bool player_seek_decoder(struct player *player)
{
double where;
bool ret;
@@ -123,25 +123,25 @@ static bool decodeSeek(struct player *player)
player->next_song_chunk = -1;
music_pipe_clear();
dc_start_async(pc.next_song);
- waitOnDecode(player);
+ player_wait_for_decoder(player);
}
- where = pc.seekWhere;
- if (where > pc.totalTime)
- where = pc.totalTime - 0.1;
+ where = pc.seek_where;
+ if (where > pc.total_time)
+ where = pc.total_time - 0.1;
if (where < 0.0)
where = 0.0;
ret = dc_seek(&pc.notify, where);
if (ret)
- pc.elapsedTime = where;
+ pc.elapsed_time = where;
player_command_finished();
return ret;
}
-static void processDecodeInput(struct player *player)
+static void player_process_command(struct player *player)
{
switch (pc.command) {
case PLAYER_COMMAND_NONE:
@@ -181,7 +181,7 @@ static void processDecodeInput(struct player *player)
case PLAYER_COMMAND_SEEK:
dropBufferedAudio();
- if (decodeSeek(player)) {
+ if (player_seek_decoder(player)) {
player->xfade = XFADE_UNKNOWN;
/* abort buffering when the user has requested
@@ -214,11 +214,11 @@ static void processDecodeInput(struct player *player)
}
static int
-playChunk(struct song *song, struct music_chunk *chunk,
- const struct audio_format *format, double sizeToTime)
+play_chunk(struct song *song, struct music_chunk *chunk,
+ const struct audio_format *format, double sizeToTime)
{
- pc.elapsedTime = chunk->times;
- pc.bitRate = chunk->bit_rate;
+ pc.elapsed_time = chunk->times;
+ pc.bit_rate = chunk->bit_rate;
if (chunk->tag != NULL) {
sendMetadataToAudioDevice(chunk->tag);
@@ -240,12 +240,12 @@ playChunk(struct song *song, struct music_chunk *chunk,
return 0;
pcm_volume(chunk->data, chunk->length,
- format, pc.softwareVolume);
+ format, pc.software_volume);
if (!playAudio(chunk->data, chunk->length))
return -1;
- pc.totalPlayTime += sizeToTime * chunk->length;
+ pc.total_play_time += sizeToTime * chunk->length;
return 0;
}
@@ -272,18 +272,18 @@ static void do_play(void)
music_pipe_set_lazy(false);
dc_start(&pc.notify, pc.next_song);
- if (waitOnDecode(&player) < 0) {
- quitDecode();
+ if (player_wait_for_decoder(&player) < 0) {
+ player_stop_decoder();
player_command_finished();
return;
}
- pc.elapsedTime = 0;
+ pc.elapsed_time = 0;
pc.state = PLAYER_STATE_PLAY;
player_command_finished();
while (1) {
- processDecodeInput(&player);
+ player_process_command(&player);
if (pc.command == PLAYER_COMMAND_STOP ||
pc.command == PLAYER_COMMAND_EXIT ||
pc.command == PLAYER_COMMAND_CLOSE_AUDIO) {
@@ -329,7 +329,7 @@ static void do_play(void)
if (player.paused)
closeAudioDevice();
- pc.totalTime = dc.total_time;
+ pc.total_time = dc.total_time;
pc.audio_format = dc.in_audio_format;
play_audio_format = dc.out_audio_format;
sizeToTime = audioFormatSizeToTime(&dc.out_audio_format);
@@ -367,7 +367,7 @@ static void do_play(void)
calculate how many chunks will be required
for it */
crossFadeChunks =
- cross_fade_calc(pc.crossFade, dc.total_time,
+ cross_fade_calc(pc.cross_fade_seconds, dc.total_time,
&dc.out_audio_format,
music_pipe_size() -
pc.buffered_before_play);
@@ -426,8 +426,8 @@ static void do_play(void)
}
/* play the current chunk */
- if (playChunk(player.song, beginChunk,
- &play_audio_format, sizeToTime) < 0)
+ if (play_chunk(player.song, beginChunk,
+ &play_audio_format, sizeToTime) < 0)
break;
music_pipe_shift();
@@ -450,7 +450,7 @@ static void do_play(void)
player.xfade = XFADE_UNKNOWN;
player.next_song_chunk = -1;
- if (waitOnDecode(&player) < 0)
+ if (player_wait_for_decoder(&player) < 0)
return;
wakeup_main_task();
@@ -469,7 +469,7 @@ static void do_play(void)
}
}
- quitDecode();
+ player_stop_decoder();
}
static void * player_task(mpd_unused void *arg)