summaryrefslogtreecommitdiff
path: root/encoder.h
blob: 68dc3fb6cb4e6fa3c5edab22c2b3fc5dd134c154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#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;
};

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);
const struct encoder_plugin *encoder_get(const gchar *name);

#endif