Commit 7a6c31ae authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

added outputBufferChunkData()

Hiding OutputBuffer internals, again. We get an extra assertion in return. git-svn-id: https://svn.musicpd.org/mpd/trunk@7267 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 71b24e09
...@@ -506,10 +506,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * ...@@ -506,10 +506,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
} }
nextChunk = outputBufferAbsolute(cb, crossFadeChunks); nextChunk = outputBufferAbsolute(cb, crossFadeChunks);
if (nextChunk >= 0) { if (nextChunk >= 0) {
pcm_mix(cb->chunks + pcm_mix(outputBufferChunkData(cb, cb->begin),
cb->begin * CHUNK_SIZE, outputBufferChunkData(cb, nextChunk),
cb->chunks +
nextChunk * CHUNK_SIZE,
cb->chunkSize[cb->begin], cb->chunkSize[cb->begin],
cb->chunkSize[nextChunk], cb->chunkSize[nextChunk],
&(cb->audioFormat), &(cb->audioFormat),
......
...@@ -92,6 +92,13 @@ int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative) ...@@ -92,6 +92,13 @@ int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative)
return (int)i; return (int)i;
} }
char * outputBufferChunkData(const OutputBuffer * cb, unsigned i)
{
assert(i < buffered_chunks);
return cb->chunks + i * CHUNK_SIZE;
}
/** /**
* Return the tail chunk has room for additional data. If there is no * Return the tail chunk has room for additional data. If there is no
* room in the queue, this function blocks until the player thread has * room in the queue, this function blocks until the player thread has
......
...@@ -73,6 +73,8 @@ unsigned availableOutputBuffer(const OutputBuffer * cb); ...@@ -73,6 +73,8 @@ unsigned availableOutputBuffer(const OutputBuffer * cb);
*/ */
int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative); int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative);
char * outputBufferChunkData(const OutputBuffer * cb, unsigned i);
/* we send inStream for buffering the inputStream while waiting to /* we send inStream for buffering the inputStream while waiting to
send the next chunk */ send the next chunk */
int sendDataToOutputBuffer(OutputBuffer * cb, int sendDataToOutputBuffer(OutputBuffer * cb,
......
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