diff options
author | Max Kellermann <max@duempel.org> | 2008-03-26 10:38:12 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-03-26 10:38:12 +0000 |
commit | 1910df96a321085410be575a0148dce586929c4b (patch) | |
tree | 4842b80f383ac550f22687cf6dc19355d086c83d | |
parent | 27f12c173d57d09d095d0e5ecfeb18acf5d2434a (diff) | |
download | mpd-1910df96a321085410be575a0148dce586929c4b.tar.gz mpd-1910df96a321085410be575a0148dce586929c4b.tar.xz mpd-1910df96a321085410be575a0148dce586929c4b.zip |
moved code to initOutputBuffer()
This patch moves code which initializes the OutputBuffer struct to
outputBuffer.c. Although this is generally a good idea, it prepares
the following patch.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7206 09075e82-0dd4-0310-85a5-a0d7c8717e4f
-rw-r--r-- | src/outputBuffer.c | 17 | ||||
-rw-r--r-- | src/outputBuffer.h | 2 | ||||
-rw-r--r-- | src/playerData.c | 19 |
3 files changed, 22 insertions, 16 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 25325ecb7..25c9b3c12 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -30,6 +30,23 @@ static mpd_sint16 currentChunk = -1; static mpd_sint8 currentMetaChunk = -1; static mpd_sint8 sendMetaChunk; +void initOutputBuffer(OutputBuffer * cb, char *chunks) +{ + memset(&cb->convState, 0, sizeof(ConvState)); + cb->chunks = chunks; + cb->chunkSize = (mpd_uint16 *) (((char *)cb->chunks) + + buffered_chunks * CHUNK_SIZE); + cb->bitRate = (mpd_uint16 *) (((char *)cb->chunkSize) + + buffered_chunks * sizeof(mpd_sint16)); + cb->metaChunk = (mpd_sint8 *) (((char *)cb->bitRate) + + buffered_chunks * + sizeof(mpd_sint16)); + cb->times = + (float *)(((char *)cb->metaChunk) + + buffered_chunks * sizeof(mpd_sint8)); + cb->acceptMetadata = 0; +} + void clearAllMetaChunkSets(OutputBuffer * cb) { memset(cb->metaChunkSet, 0, BUFFERED_METACHUNKS); diff --git a/src/outputBuffer.h b/src/outputBuffer.h index 150748328..9bd9d48c8 100644 --- a/src/outputBuffer.h +++ b/src/outputBuffer.h @@ -47,6 +47,8 @@ typedef struct _OutputBuffer { volatile mpd_sint8 acceptMetadata; } OutputBuffer; +void initOutputBuffer(OutputBuffer * cb, char *chunks); + void clearOutputBuffer(OutputBuffer * cb); void flushOutputBuffer(OutputBuffer * cb); diff --git a/src/playerData.c b/src/playerData.c index a84601bb0..551582e45 100644 --- a/src/playerData.c +++ b/src/playerData.c @@ -37,7 +37,6 @@ void initPlayerData(void) int crossfade = 0; size_t bufferSize = DEFAULT_BUFFER_SIZE; size_t allocationSize; - OutputBuffer *buffer; ConfigParam *param; size_t device_array_size = audio_device_count() * sizeof(mpd_sint8); @@ -95,21 +94,9 @@ void initPlayerData(void) playerData_pd->audioDeviceStates = (mpd_uint8 *)playerData_pd + allocationSize - device_array_size; - buffer = &(playerData_pd->buffer); - - memset(&buffer->convState, 0, sizeof(ConvState)); - buffer->chunks = ((char *)playerData_pd) + sizeof(PlayerData); - buffer->chunkSize = (mpd_uint16 *) (((char *)buffer->chunks) + - buffered_chunks * CHUNK_SIZE); - buffer->bitRate = (mpd_uint16 *) (((char *)buffer->chunkSize) + - buffered_chunks * sizeof(mpd_sint16)); - buffer->metaChunk = (mpd_sint8 *) (((char *)buffer->bitRate) + - buffered_chunks * - sizeof(mpd_sint16)); - buffer->times = - (float *)(((char *)buffer->metaChunk) + - buffered_chunks * sizeof(mpd_sint8)); - buffer->acceptMetadata = 0; + + initOutputBuffer(&(playerData_pd->buffer), + ((char *)playerData_pd) + sizeof(PlayerData)); playerData_pd->playerControl.wait = 0; playerData_pd->playerControl.stop = 0; |