aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:17:55 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:17:55 +0000
commitb2819e12e7abe9cbe918a68eb9f917d2711402fa (patch)
tree5eddde75959a1829ec251f3be463703b25e27b96
parent288a7087f6bf981b4aa424c9bcfe8e83db587398 (diff)
downloadmpd-b2819e12e7abe9cbe918a68eb9f917d2711402fa.tar.gz
mpd-b2819e12e7abe9cbe918a68eb9f917d2711402fa.tar.xz
mpd-b2819e12e7abe9cbe918a68eb9f917d2711402fa.zip
make playerData_pd static
git-svn-id: https://svn.musicpd.org/mpd/trunk@7309 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/playerData.c71
1 files changed, 32 insertions, 39 deletions
diff --git a/src/playerData.c b/src/playerData.c
index 1a2946a64..3fd330d63 100644
--- a/src/playerData.c
+++ b/src/playerData.c
@@ -28,7 +28,7 @@ unsigned int buffered_chunks;
#define DEFAULT_BUFFER_SIZE 2048
#define DEFAULT_BUFFER_BEFORE_PLAY 10
-static PlayerData *playerData_pd;
+static PlayerData playerData_pd;
void initPlayerData(void)
{
@@ -36,7 +36,6 @@ void initPlayerData(void)
char *test;
int crossfade = 0;
size_t bufferSize = DEFAULT_BUFFER_SIZE;
- size_t allocationSize;
ConfigParam *param;
size_t device_array_size = audio_device_count() * sizeof(mpd_sint8);
@@ -74,45 +73,40 @@ void initPlayerData(void)
buffered_before_play = buffered_chunks;
}
- /* for playerData struct */
- allocationSize = sizeof(PlayerData);
-
- playerData_pd = xmalloc(allocationSize);
-
- playerData_pd->audioDeviceStates = xmalloc(device_array_size);
-
- initOutputBuffer(&(playerData_pd->buffer));
-
- notifyInit(&playerData_pd->playerControl.notify);
- playerData_pd->playerControl.stop = 0;
- playerData_pd->playerControl.pause = 0;
- playerData_pd->playerControl.play = 0;
- playerData_pd->playerControl.error = PLAYER_ERROR_NOERROR;
- playerData_pd->playerControl.lockQueue = 0;
- playerData_pd->playerControl.unlockQueue = 0;
- playerData_pd->playerControl.state = PLAYER_STATE_STOP;
- playerData_pd->playerControl.queueState = PLAYER_QUEUE_BLANK;
- playerData_pd->playerControl.queueLockState = PLAYER_QUEUE_UNLOCKED;
- playerData_pd->playerControl.seek = 0;
- playerData_pd->playerControl.closeAudio = 0;
- playerData_pd->playerControl.current_song = NULL;
- playerData_pd->playerControl.errored_song = NULL;
- playerData_pd->playerControl.crossFade = crossfade;
- playerData_pd->playerControl.softwareVolume = 1000;
- playerData_pd->playerControl.totalPlayTime = 0;
-
- notifyInit(&playerData_pd->decoderControl.notify);
- playerData_pd->decoderControl.stop = 0;
- playerData_pd->decoderControl.start = 0;
- playerData_pd->decoderControl.state = DECODE_STATE_STOP;
- playerData_pd->decoderControl.seek = 0;
- playerData_pd->decoderControl.error = DECODE_ERROR_NOERROR;
- playerData_pd->decoderControl.current_song = NULL;
+ playerData_pd.audioDeviceStates = xmalloc(device_array_size);
+
+ initOutputBuffer(&(playerData_pd.buffer));
+
+ notifyInit(&playerData_pd.playerControl.notify);
+ playerData_pd.playerControl.stop = 0;
+ playerData_pd.playerControl.pause = 0;
+ playerData_pd.playerControl.play = 0;
+ playerData_pd.playerControl.error = PLAYER_ERROR_NOERROR;
+ playerData_pd.playerControl.lockQueue = 0;
+ playerData_pd.playerControl.unlockQueue = 0;
+ playerData_pd.playerControl.state = PLAYER_STATE_STOP;
+ playerData_pd.playerControl.queueState = PLAYER_QUEUE_BLANK;
+ playerData_pd.playerControl.queueLockState = PLAYER_QUEUE_UNLOCKED;
+ playerData_pd.playerControl.seek = 0;
+ playerData_pd.playerControl.closeAudio = 0;
+ playerData_pd.playerControl.current_song = NULL;
+ playerData_pd.playerControl.errored_song = NULL;
+ playerData_pd.playerControl.crossFade = crossfade;
+ playerData_pd.playerControl.softwareVolume = 1000;
+ playerData_pd.playerControl.totalPlayTime = 0;
+
+ notifyInit(&playerData_pd.decoderControl.notify);
+ playerData_pd.decoderControl.stop = 0;
+ playerData_pd.decoderControl.start = 0;
+ playerData_pd.decoderControl.state = DECODE_STATE_STOP;
+ playerData_pd.decoderControl.seek = 0;
+ playerData_pd.decoderControl.error = DECODE_ERROR_NOERROR;
+ playerData_pd.decoderControl.current_song = NULL;
}
PlayerData *getPlayerData(void)
{
- return playerData_pd;
+ return &playerData_pd;
}
void freePlayerData(void)
@@ -122,6 +116,5 @@ void freePlayerData(void)
* access playerData_pd and we need to keep it available for them */
waitpid(-1, NULL, 0);
- free(playerData_pd->audioDeviceStates);
- free(playerData_pd);
+ free(playerData_pd.audioDeviceStates);
}