diff options
author | Max Kellermann <max@duempel.org> | 2008-04-12 04:12:42 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-04-12 04:12:42 +0000 |
commit | e626028b41a957d969b93f2d3cb39813eebaac2b (patch) | |
tree | 8cdc984c07644ec30594e50276cf2ddf708ad976 /src/outputBuffer.c | |
parent | a5464282639e46550f3120126d0ba877dd91a44b (diff) | |
download | mpd-e626028b41a957d969b93f2d3cb39813eebaac2b.tar.gz mpd-e626028b41a957d969b93f2d3cb39813eebaac2b.tar.xz mpd-e626028b41a957d969b93f2d3cb39813eebaac2b.zip |
moved check to outputBufferAbsolute()
decoderParent() uses a lot of OutputBuffer internals to see whether
cross-fading should be started. Move these checks to outputBuffer.c,
which also simplifies decoderParent().
git-svn-id: https://svn.musicpd.org/mpd/trunk@7262 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/outputBuffer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c index f5a6dbf51..b5fddd98d 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -65,6 +65,23 @@ unsigned availableOutputBuffer(const OutputBuffer * cb) return cb->end + buffered_chunks - cb->begin; } +int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative) +{ + unsigned i, max; + + max = cb->end; + if (max < cb->begin) + max += buffered_chunks; + i = (unsigned)cb->begin + relative; + if (i >= max) + return -1; + + if (i >= buffered_chunks) + i -= buffered_chunks; + + return (int)i; +} + /** * 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 |