aboutsummaryrefslogtreecommitdiffstats
path: root/src/outputBuffer.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:12:53 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:12:53 +0000
commit4e60343e552e8b7339678c6df7255a0f91dc769e (patch)
treeca4f2994b441819c28af63da20fe5279fd234050 /src/outputBuffer.c
parent50dc380f2385988047821fe15c5616f44019250f (diff)
downloadmpd-4e60343e552e8b7339678c6df7255a0f91dc769e.tar.gz
mpd-4e60343e552e8b7339678c6df7255a0f91dc769e.tar.xz
mpd-4e60343e552e8b7339678c6df7255a0f91dc769e.zip
added outputBufferRelative()
The cross-fade check is still very complicated whenever it uses OutputBuffer internals. Greatly simplify another check by introducing outputBufferRelative(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7264 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/outputBuffer.c')
-rw-r--r--src/outputBuffer.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index f6fb38937..aadd5e379 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -62,12 +62,17 @@ int outputBufferEmpty(const OutputBuffer * cb)
return cb->begin == cb->end;
}
-unsigned availableOutputBuffer(const OutputBuffer * cb)
+unsigned int outputBufferRelative(const OutputBuffer * cb, unsigned i)
{
- if (cb->end >= cb->begin)
- return cb->end - cb->begin;
+ if (i >= cb->begin)
+ return i - cb->begin;
else
- return cb->end + buffered_chunks - cb->begin;
+ return i + buffered_chunks - cb->begin;
+}
+
+unsigned availableOutputBuffer(const OutputBuffer * cb)
+{
+ return outputBufferRelative(cb, cb->end);
}
int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative)