From 29241c4f835797f635816a9f37528aa981f722b5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 16 Sep 2011 21:06:12 +0200 Subject: input_plugin: add method check() To check for errors without reading. The decoder thread wants to do that, before it passes the input stream to the plugin. --- src/input/soup_input_plugin.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/input/soup_input_plugin.c') diff --git a/src/input/soup_input_plugin.c b/src/input/soup_input_plugin.c index ff73da559..23665c1a2 100644 --- a/src/input/soup_input_plugin.c +++ b/src/input/soup_input_plugin.c @@ -320,6 +320,23 @@ input_soup_close(struct input_stream *is) g_free(s); } +static bool +input_soup_check(struct input_stream *is, GError **error_r) +{ + struct input_soup *s = (struct input_soup *)is; + + g_mutex_lock(s->mutex); + + bool success = s->postponed_error == NULL; + if (!success) { + g_propagate_error(error_r, s->postponed_error); + s->postponed_error = NULL; + } + + g_mutex_unlock(s->mutex); + return success; +} + static int input_soup_buffer(struct input_stream *is, GError **error_r) { @@ -444,6 +461,7 @@ const struct input_plugin input_plugin_soup = { .open = input_soup_open, .close = input_soup_close, + .check = input_soup_check, .buffer = input_soup_buffer, .read = input_soup_read, .eof = input_soup_eof, -- cgit v1.2.3