aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mpc_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:14 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:14 +0200
commit940ecf5345f339b9d3ec3e8029e345540358fa4c (patch)
treebe22d8c04732d41f1ba6f49298eef7829d097095 /src/inputPlugins/mpc_plugin.c
parentd80260ab4e1d4f926344ab2074543ea4a7723216 (diff)
downloadmpd-940ecf5345f339b9d3ec3e8029e345540358fa4c.tar.gz
mpd-940ecf5345f339b9d3ec3e8029e345540358fa4c.tar.xz
mpd-940ecf5345f339b9d3ec3e8029e345540358fa4c.zip
added decoder_read()
On our way to stabilize the decoder API, we will one day remove the input stream functions. The most basic function, read() will be provided by decoder_api.h with this patch. It already contains a loop (still with manual polling), error/eof handling and decoder command checks. This kind of code used to be duplicated in all decoder plugins.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/mpc_plugin.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c
index 411373283..611c4f4d6 100644
--- a/src/inputPlugins/mpc_plugin.c
+++ b/src/inputPlugins/mpc_plugin.c
@@ -32,20 +32,9 @@ typedef struct _MpcCallbackData {
static mpc_int32_t mpc_read_cb(void *vdata, void *ptr, mpc_int32_t size)
{
- mpc_int32_t ret = 0;
MpcCallbackData *data = (MpcCallbackData *) vdata;
- while (1) {
- ret = readFromInputStream(data->inStream, ptr, 1, size);
- if (ret == 0 && !inputStreamAtEOF(data->inStream) &&
- (data->decoder &&
- decoder_get_command(data->decoder) != DECODE_COMMAND_STOP))
- my_usleep(10000);
- else
- break;
- }
-
- return ret;
+ return decoder_read(data->decoder, data->inStream, ptr, size);
}
static mpc_bool_t mpc_seek_cb(void *vdata, mpc_int32_t offset)