aboutsummaryrefslogtreecommitdiff
path: root/test/read_tags.c
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 /test/read_tags.c
parent29241c4f835797f635816a9f37528aa981f722b5 (diff)
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 'test/read_tags.c')
-rw-r--r--test/read_tags.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/read_tags.c b/test/read_tags.c
index c2e3b2ca..1d742e9e 100644
--- a/test/read_tags.c
+++ b/test/read_tags.c
@@ -91,7 +91,7 @@ decoder_read(G_GNUC_UNUSED struct decoder *decoder,
struct input_stream *is,
void *buffer, size_t length)
{
- return input_stream_read(is, buffer, length, NULL);
+ return input_stream_lock_read(is, buffer, length, NULL);
}
void
@@ -193,7 +193,11 @@ int main(int argc, char **argv)
tag = decoder_plugin_tag_dup(plugin, path);
if (tag == NULL && plugin->stream_tag != NULL) {
- struct input_stream *is = input_stream_open(path, &error);
+ GMutex *mutex = g_mutex_new();
+ GCond *cond = g_cond_new();
+
+ struct input_stream *is =
+ input_stream_open(path, mutex, cond, &error);
if (is == NULL) {
g_printerr("Failed to open %s: %s\n",
@@ -204,6 +208,9 @@ int main(int argc, char **argv)
tag = decoder_plugin_stream_tag(plugin, is);
input_stream_close(is);
+
+ g_cond_free(cond);
+ g_mutex_free(mutex);
}
decoder_plugin_deinit_all();