aboutsummaryrefslogtreecommitdiffstats
path: root/src/outputBuffer.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/outputBuffer.c17
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