diff options
author | Max Kellermann <max@duempel.org> | 2011-09-14 21:46:41 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-16 21:22:13 +0200 |
commit | 754f26a97c816781e80500d98f2515ae97836145 (patch) | |
tree | caa7dbaa879b29d018a4559524390670ad33a605 /src/decoder/pcm_decoder_plugin.c | |
parent | 29241c4f835797f635816a9f37528aa981f722b5 (diff) | |
download | mpd-754f26a97c816781e80500d98f2515ae97836145.tar.gz mpd-754f26a97c816781e80500d98f2515ae97836145.tar.xz mpd-754f26a97c816781e80500d98f2515ae97836145.zip |
input_stream: non-blocking I/O
Add GMutex, GCond attributes which will be used by callers to
conditionally wait on the stream.
Remove the (now-useless) plugin method buffer(), wait on GCond
instead. Lock the input_stream before each method call. Do the same
with the playlist plugins.
Diffstat (limited to 'src/decoder/pcm_decoder_plugin.c')
-rw-r--r-- | src/decoder/pcm_decoder_plugin.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/decoder/pcm_decoder_plugin.c b/src/decoder/pcm_decoder_plugin.c index c8340ab67..24ad93cb6 100644 --- a/src/decoder/pcm_decoder_plugin.c +++ b/src/decoder/pcm_decoder_plugin.c @@ -52,7 +52,7 @@ pcm_stream_decode(struct decoder *decoder, struct input_stream *is) size_t nbytes = decoder_read(decoder, is, buffer, sizeof(buffer)); - if (nbytes == 0 && input_stream_eof(is)) + if (nbytes == 0 && input_stream_lock_eof(is)) break; cmd = nbytes > 0 @@ -62,7 +62,8 @@ pcm_stream_decode(struct decoder *decoder, struct input_stream *is) if (cmd == DECODE_COMMAND_SEEK) { goffset offset = (goffset)(time_to_size * decoder_seek_where(decoder)); - if (input_stream_seek(is, offset, SEEK_SET, &error)) { + if (input_stream_lock_seek(is, offset, SEEK_SET, + &error)) { decoder_command_finished(decoder); } else { g_warning("seeking failed: %s", error->message); |