diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-17 18:17:41 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-08-17 18:17:41 +0200 |
commit | eb543b8ddb00761de3a52f6da024ffacf5ba9b92 (patch) | |
tree | 3142be895745e48b78fd5e6679f02ddf747715cf | |
parent | 12e7f431ba4baf18b47ea2fced4091c61457069c (diff) |
Added encoder API.
-rw-r--r-- | encoder.c | 15 | ||||
-rw-r--r-- | encoder.h | 29 |
2 files changed, 44 insertions, 0 deletions
diff --git a/encoder.c b/encoder.c new file mode 100644 index 0000000..72bca9d --- /dev/null +++ b/encoder.c @@ -0,0 +1,15 @@ +#include "encoder.h" + +gboolean encoder_init(struct encoder *encoder) { + return encoder->encoder->init(&encoder->data); +} + +gssize encoder_encode(struct encoder *encoder, const guchar *inbuf, gsize inbuf_size, + guchar *outbuf, gsize outbuf_size) { + return encoder->encoder->encode(encoder->data, inbuf, inbuf_size, + outbuf, outbuf_size); +} + +void encoder_close(struct encoder *encoder) { + encoder->encoder->close(encoder->data); +} diff --git a/encoder.h b/encoder.h new file mode 100644 index 0000000..e55dfb0 --- /dev/null +++ b/encoder.h @@ -0,0 +1,29 @@ +#ifndef _ENCODER_H_ +#define _ENCODER_H_ + +#include <glib.h> +#include <gio/gio.h> + +struct encoder_plugin { + const gchar *name; + + gboolean (*init)(gpointer *data); + gssize (*encode)(gpointer data, const guchar *inbuf, gsize inbuf_size, + guchar *outbuf, gsize outbuf_size); + void (*close)(gpointer data); +}; + +struct encoder { + const struct encoder_plugin *encoder; + + gpointer data; +}; + +extern struct encoder_plugin *encoder_plugniss; + +gboolean encoder_init(struct encoder *encoder); +gssize encoder_encode(struct encoder *encoder, const guchar *inbuf, gsize inbuf_size, + guchar *outbuf, gsize outbuf_size); +void encoder_close(struct encoder *encoder); + +#endif |