aboutsummaryrefslogtreecommitdiffstats
path: root/src/input_plugin.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-14 21:46:41 +0200
committerMax Kellermann <max@duempel.org>2011-09-16 21:22:13 +0200
commit754f26a97c816781e80500d98f2515ae97836145 (patch)
treecaa7dbaa879b29d018a4559524390670ad33a605 /src/input_plugin.h
parent29241c4f835797f635816a9f37528aa981f722b5 (diff)
downloadmpd-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/input_plugin.h')
-rw-r--r--src/input_plugin.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/input_plugin.h b/src/input_plugin.h
index 4e0993d12..6b0c77c85 100644
--- a/src/input_plugin.h
+++ b/src/input_plugin.h
@@ -48,7 +48,9 @@ struct input_plugin {
*/
void (*finish)(void);
- struct input_stream *(*open)(const char *uri, GError **error_r);
+ struct input_stream *(*open)(const char *uri,
+ GMutex *mutex, GCond *cond,
+ GError **error_r);
void (*close)(struct input_stream *is);
/**
@@ -66,7 +68,17 @@ struct input_plugin {
void (*update)(struct input_stream *is);
struct tag *(*tag)(struct input_stream *is);
- int (*buffer)(struct input_stream *is, GError **error_r);
+
+ /**
+ * Returns true if the next read operation will not block:
+ * either data is available, or end-of-stream has been
+ * reached, or an error has occurred.
+ *
+ * If this method is unimplemented, then it is assumed that
+ * reading will never block.
+ */
+ bool (*available)(struct input_stream *is);
+
size_t (*read)(struct input_stream *is, void *ptr, size_t size,
GError **error_r);
bool (*eof)(struct input_stream *is);