Commit b2819e12 authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

make playerData_pd static

git-svn-id: https://svn.musicpd.org/mpd/trunk@7309 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 288a7087
...@@ -28,7 +28,7 @@ unsigned int buffered_chunks; ...@@ -28,7 +28,7 @@ unsigned int buffered_chunks;
#define DEFAULT_BUFFER_SIZE 2048 #define DEFAULT_BUFFER_SIZE 2048
#define DEFAULT_BUFFER_BEFORE_PLAY 10 #define DEFAULT_BUFFER_BEFORE_PLAY 10
static PlayerData *playerData_pd; static PlayerData playerData_pd;
void initPlayerData(void) void initPlayerData(void)
{ {
...@@ -36,7 +36,6 @@ void initPlayerData(void) ...@@ -36,7 +36,6 @@ void initPlayerData(void)
char *test; char *test;
int crossfade = 0; int crossfade = 0;
size_t bufferSize = DEFAULT_BUFFER_SIZE; size_t bufferSize = DEFAULT_BUFFER_SIZE;
size_t allocationSize;
ConfigParam *param; ConfigParam *param;
size_t device_array_size = audio_device_count() * sizeof(mpd_sint8); size_t device_array_size = audio_device_count() * sizeof(mpd_sint8);
...@@ -74,45 +73,40 @@ void initPlayerData(void) ...@@ -74,45 +73,40 @@ void initPlayerData(void)
buffered_before_play = buffered_chunks; buffered_before_play = buffered_chunks;
} }
/* for playerData struct */ playerData_pd.audioDeviceStates = xmalloc(device_array_size);
allocationSize = sizeof(PlayerData);
initOutputBuffer(&(playerData_pd.buffer));
playerData_pd = xmalloc(allocationSize);
notifyInit(&playerData_pd.playerControl.notify);
playerData_pd->audioDeviceStates = xmalloc(device_array_size); playerData_pd.playerControl.stop = 0;
playerData_pd.playerControl.pause = 0;
initOutputBuffer(&(playerData_pd->buffer)); playerData_pd.playerControl.play = 0;
playerData_pd.playerControl.error = PLAYER_ERROR_NOERROR;
notifyInit(&playerData_pd->playerControl.notify); playerData_pd.playerControl.lockQueue = 0;
playerData_pd->playerControl.stop = 0; playerData_pd.playerControl.unlockQueue = 0;
playerData_pd->playerControl.pause = 0; playerData_pd.playerControl.state = PLAYER_STATE_STOP;
playerData_pd->playerControl.play = 0; playerData_pd.playerControl.queueState = PLAYER_QUEUE_BLANK;
playerData_pd->playerControl.error = PLAYER_ERROR_NOERROR; playerData_pd.playerControl.queueLockState = PLAYER_QUEUE_UNLOCKED;
playerData_pd->playerControl.lockQueue = 0; playerData_pd.playerControl.seek = 0;
playerData_pd->playerControl.unlockQueue = 0; playerData_pd.playerControl.closeAudio = 0;
playerData_pd->playerControl.state = PLAYER_STATE_STOP; playerData_pd.playerControl.current_song = NULL;
playerData_pd->playerControl.queueState = PLAYER_QUEUE_BLANK; playerData_pd.playerControl.errored_song = NULL;
playerData_pd->playerControl.queueLockState = PLAYER_QUEUE_UNLOCKED; playerData_pd.playerControl.crossFade = crossfade;
playerData_pd->playerControl.seek = 0; playerData_pd.playerControl.softwareVolume = 1000;
playerData_pd->playerControl.closeAudio = 0; playerData_pd.playerControl.totalPlayTime = 0;
playerData_pd->playerControl.current_song = NULL;
playerData_pd->playerControl.errored_song = NULL; notifyInit(&playerData_pd.decoderControl.notify);
playerData_pd->playerControl.crossFade = crossfade; playerData_pd.decoderControl.stop = 0;
playerData_pd->playerControl.softwareVolume = 1000; playerData_pd.decoderControl.start = 0;
playerData_pd->playerControl.totalPlayTime = 0; playerData_pd.decoderControl.state = DECODE_STATE_STOP;
playerData_pd.decoderControl.seek = 0;
notifyInit(&playerData_pd->decoderControl.notify); playerData_pd.decoderControl.error = DECODE_ERROR_NOERROR;
playerData_pd->decoderControl.stop = 0; playerData_pd.decoderControl.current_song = NULL;
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) PlayerData *getPlayerData(void)
{ {
return playerData_pd; return &playerData_pd;
} }
void freePlayerData(void) void freePlayerData(void)
...@@ -122,6 +116,5 @@ void freePlayerData(void) ...@@ -122,6 +116,5 @@ void freePlayerData(void)
* access playerData_pd and we need to keep it available for them */ * access playerData_pd and we need to keep it available for them */
waitpid(-1, NULL, 0); waitpid(-1, NULL, 0);
free(playerData_pd->audioDeviceStates); free(playerData_pd.audioDeviceStates);
free(playerData_pd);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment