summaryrefslogtreecommitdiff
path: root/decoder.h
blob: 0a29c6409320b0360d1081f9821202f463fe4193 (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
29
30
#ifndef _DECODER_H_
#define _DECODER_H_

#include <glib.h>
#include <gio/gio.h>

struct decoder_plugin {
	const gchar *name;
	const gchar * const *extensions;

	gboolean (*init)(gpointer *data);
	gssize (*decode)(gpointer data, const guchar *inbuf, gsize inbuf_size,
			guchar *outbuf, gsize outbuf_size);
	void (*close)(gpointer data);
};

struct decoder {
	const struct decoder_plugin *decoder;

	gpointer data;
};

extern struct decoder_plugin *decoder_plugins;

gboolean decoder_init(struct decoder *decoder);
gssize decoder_decode(struct decoder *decoder, const guchar *inbuf,
		gsize inbuf_size, guchar *outbuf, gsize outbuf_size);
void decoder_close(struct decoder *decoder);

#endif