aboutsummaryrefslogtreecommitdiffstats
path: root/src/outputBuffer.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:05 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:05 +0200
commit5df6ff8d22115f8588c321527bd4e33624306422 (patch)
tree98b285a1292601f04ce7720abec6023ceeb97da3 /src/outputBuffer.c
parent2a83ccdb8f71d224341ea5a6ddbc002693d887fb (diff)
downloadmpd-5df6ff8d22115f8588c321527bd4e33624306422.tar.gz
mpd-5df6ff8d22115f8588c321527bd4e33624306422.tar.xz
mpd-5df6ff8d22115f8588c321527bd4e33624306422.zip
added OutputBuffer.notify
OutputBuffer should be a more generic low-level library, without dependencies to the other headers. This patch adds the field "notify", which is used to signal the player thread. It is passed in the constructor, and removes the need to compile with the decode.h header.
Diffstat (limited to '')
-rw-r--r--src/outputBuffer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index 97a9e78bd..aee2f832b 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -21,7 +21,7 @@
#include "utils.h"
-void ob_init(unsigned int size)
+void ob_init(unsigned int size, Notify *notify)
{
assert(size > 0);
@@ -31,6 +31,7 @@ void ob_init(unsigned int size)
ob.begin = 0;
ob.end = 0;
ob.lazy = 0;
+ ob.notify = notify;
ob.chunks[0].chunkSize = 0;
}
@@ -61,7 +62,7 @@ static inline unsigned successor(unsigned i)
*/
static void output_buffer_expand(unsigned i)
{
- int was_empty = !ob.lazy || ob_is_empty();
+ int was_empty = ob.notify != NULL && (!ob.lazy || ob_is_empty());
assert(i == (ob.end + 1) % ob.size);
assert(i != ob.end);
@@ -72,7 +73,7 @@ static void output_buffer_expand(unsigned i)
/* if the buffer was empty, the player thread might be
waiting for us; wake it up now that another decoded
buffer has become available. */
- notify_signal(&pc.notify);
+ notify_signal(ob.notify);
}
void ob_flush(void)