diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:16:03 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-13 01:16:03 +0000 |
commit | dec6b1612e953c6029d963ff55d2b4a669b60f43 (patch) | |
tree | a1138cb07f67c821ee5000618302d21367ab2245 /src/outputBuffer.c | |
parent | 98acfa8ac5bac09ca49a7c21938b5a5801e01ca5 (diff) | |
download | mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.tar.gz mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.tar.xz mpd-dec6b1612e953c6029d963ff55d2b4a669b60f43.zip |
Stop passing our single DecoderControl object everywhere
This at least makes the argument list to a lot of our plugin
functions shorter and removes a good amount of line nois^W^Wcode,
hopefully making things easier to read and follow.
git-svn-id: https://svn.musicpd.org/mpd/trunk@7353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/outputBuffer.c')
-rw-r--r-- | src/outputBuffer.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c index bc25bbf3f..f44f4c5e3 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -20,6 +20,7 @@ #include "utils.h" #include "normalize.h" +#include "playerData.h" void initOutputBuffer(OutputBuffer * cb, unsigned int size) { @@ -150,8 +151,7 @@ OutputBufferChunk * outputBufferGetChunk(const OutputBuffer * cb, unsigned i) * another thread requested stopping the decoder. */ static int tailChunk(OutputBuffer * cb, InputStream * inStream, - DecoderControl * dc, int seekable, - float data_time, mpd_uint16 bitRate) + int seekable, float data_time, mpd_uint16 bitRate) { unsigned int next; OutputBufferChunk *chunk; @@ -165,21 +165,20 @@ static int tailChunk(OutputBuffer * cb, InputStream * inStream, /* all chunks are full of decoded data; wait for the player to free one */ - if (dc->stop) + if (dc.stop) return OUTPUT_BUFFER_DC_STOP; - if (dc->seek) { + if (dc.seek) { if (seekable) { return OUTPUT_BUFFER_DC_SEEK; } else { - dc->seekError = 1; - dc->seek = 0; + dc.seekError = 1; + dc.seek = 0; decoder_wakeup_player(); } } - if (!inStream || - bufferInputStream(inStream) <= 0) { - decoder_sleep(dc); + if (!inStream || bufferInputStream(inStream) <= 0) { + decoder_sleep(); } } @@ -200,7 +199,7 @@ static int tailChunk(OutputBuffer * cb, InputStream * inStream, } int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, - DecoderControl * dc, int seekable, void *dataIn, + int seekable, void *dataIn, size_t dataInLen, float data_time, mpd_uint16 bitRate, ReplayGainInfo * replayGainInfo) { @@ -211,11 +210,11 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, static size_t convBufferLen; OutputBufferChunk *chunk = NULL; - if (cmpAudioFormat(&(cb->audioFormat), &(dc->audioFormat)) == 0) { + if (cmpAudioFormat(&(cb->audioFormat), &(dc.audioFormat)) == 0) { data = dataIn; datalen = dataInLen; } else { - datalen = pcm_sizeOfConvBuffer(&(dc->audioFormat), dataInLen, + datalen = pcm_sizeOfConvBuffer(&(dc.audioFormat), dataInLen, &(cb->audioFormat)); if (datalen > convBufferLen) { if (convBuffer != NULL) @@ -224,7 +223,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, convBufferLen = datalen; } data = convBuffer; - datalen = pcm_convertAudioFormat(&(dc->audioFormat), dataIn, + datalen = pcm_convertAudioFormat(&(dc.audioFormat), dataIn, dataInLen, &(cb->audioFormat), data, &(cb->convState)); } @@ -235,8 +234,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, normalizeData(data, datalen, &cb->audioFormat); while (datalen) { - int chunk_index = tailChunk(cb, inStream, - dc, seekable, + int chunk_index = tailChunk(cb, inStream, seekable, data_time, bitRate); if (chunk_index < 0) return chunk_index; |