aboutsummaryrefslogtreecommitdiffstats
path: root/src/input_stream.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-26 20:38:44 +0100
committerMax Kellermann <max@duempel.org>2008-10-26 20:38:44 +0100
commitf08041f0eb8512304584b583073508629a934c88 (patch)
tree6a0d548ac1ee174b5505abe621fcb6f67afc688b /src/input_stream.h
parentdbc7e9ba2f57c71a9b73cd6d035ba2906190be72 (diff)
downloadmpd-f08041f0eb8512304584b583073508629a934c88.tar.gz
mpd-f08041f0eb8512304584b583073508629a934c88.tar.xz
mpd-f08041f0eb8512304584b583073508629a934c88.zip
input_stream: added struct input_plugin
Instead of managing a set of method pointers in each input_stream struct, move these into the new input_plugin struct. Each input_stream has only a pointer to the plugin struct. Pointers to all implementations are kept in the array "input_plugins".
Diffstat (limited to '')
-rw-r--r--src/input_stream.h21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/input_stream.h b/src/input_stream.h
index fbd8eb3fd..b2887e10d 100644
--- a/src/input_stream.h
+++ b/src/input_stream.h
@@ -20,8 +20,23 @@
#define INPUT_STREAM_H
#include <stddef.h>
+#include <stdbool.h>
+
+struct input_stream;
+
+struct input_plugin {
+ bool (*open)(struct input_stream *is, const char *url);
+ int (*close)(struct input_stream *is);
+
+ int (*buffer)(struct input_stream *is);
+ size_t (*read)(struct input_stream *is, void *ptr, size_t size);
+ int (*eof)(struct input_stream *is);
+ int (*seek)(struct input_stream *is, long offset, int whence);
+};
struct input_stream {
+ const struct input_plugin *plugin;
+
int ready;
int error;
@@ -30,12 +45,6 @@ struct input_stream {
char *mime;
int seekable;
- int (*seekFunc)(struct input_stream *is, long offset, int whence);
- size_t (*readFunc)(struct input_stream *is, void *ptr, size_t size);
- int (*closeFunc)(struct input_stream *is);
- int (*atEOFFunc)(struct input_stream *is);
- int (*bufferFunc)(struct input_stream *is);
-
void *data;
char *meta_name;
char *meta_title;